Fixed some of the easing functions but still not sure with RAT_GIANT doesn't move.
This commit is contained in:
parent
a53f81715d
commit
acbf384e2a
3 changed files with 13 additions and 6 deletions
|
@ -10,17 +10,19 @@ namespace components {
|
|||
}
|
||||
|
||||
float Animation::twitching() {
|
||||
float tick = ease::sine(float(frames) / subframe * ease_rate);
|
||||
|
||||
switch(easing) {
|
||||
case ease::NONE:
|
||||
return 0.0;
|
||||
case ease::SINE:
|
||||
return ease::sine(float(frames) / subframe * ease_rate);
|
||||
return tick;
|
||||
case ease::OUT_CIRC:
|
||||
return ease::out_circ(ease::sine(float(frames) / subframe * ease_rate));
|
||||
return ease::out_circ(tick);
|
||||
case ease::OUT_BOUNCE:
|
||||
return ease::out_bounce(ease::sine(float(frames) / subframe * ease_rate));
|
||||
return ease::sine(ease::out_bounce(tick));
|
||||
case ease::IN_OUT_BACK:
|
||||
return ease::in_out_back(ease::sine(float(frames) / subframe * ease_rate));
|
||||
return ease::sine(ease::in_out_back(tick));
|
||||
default:
|
||||
dbc::sentinel(
|
||||
fmt::format("Invalid easing {} given to animation",
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
{"_type": "Motion", "dx": 0, "dy": 0, "random": false},
|
||||
{"_type": "EnemyConfig", "ai_script": "Enemy::actions", "ai_start_name": "Enemy::initial_state", "ai_goal_name": "Enemy::final_state"},
|
||||
{"_type": "Personality", "hearing_distance": 5, "tough": false},
|
||||
{"_type": "Animation", "easing": 3, "ease_rate": 0.5, "scale": 0.1, "simple": true, "frames": 10, "speed": 1.0, "stationary": false},
|
||||
{"_type": "Animation", "easing": 3, "ease_rate": 0.5, "scale": 0.1, "simple": true, "frames": 1, "speed": 1.0, "stationary": false},
|
||||
{"_type": "Sprite", "name": "rat_with_sword", "width": 256, "height": 256, "scale": 1.0},
|
||||
{"_type": "Sound", "attack": "Small_Rat", "death": "Creature_Death_1"}
|
||||
]
|
||||
|
|
|
@ -4,7 +4,12 @@
|
|||
namespace ease {
|
||||
|
||||
enum Style {
|
||||
NONE, SINE, OUT_CIRC, OUT_BOUNCE, IN_OUT_BACK, FUCKFACE
|
||||
NONE=0,
|
||||
SINE=1,
|
||||
OUT_CIRC=2,
|
||||
OUT_BOUNCE=3,
|
||||
IN_OUT_BACK=4,
|
||||
FUCKFACE
|
||||
};
|
||||
|
||||
inline double sine(double x) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue