diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/animation_system.cpp | 11 | ||||
-rw-r--r-- | src/script_system.cpp | 3 | ||||
-rw-r--r-- | src/sprite.h | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/src/animation_system.cpp b/src/animation_system.cpp index 5892f64..997b53a 100644 --- a/src/animation_system.cpp +++ b/src/animation_system.cpp | |||
@@ -120,6 +120,16 @@ void AnimationSystem::tick(double dt) { | |||
120 | sprite.animations[sprite.animationId].timerNum == timerNum && | 120 | sprite.animations[sprite.animationId].timerNum == timerNum && |
121 | !sprite.animFinished && | 121 | !sprite.animFinished && |
122 | !sprite.animPaused) { | 122 | !sprite.animPaused) { |
123 | if (sprite.animSlowdown > 1) { | ||
124 | sprite.animSlowdownProgress++; | ||
125 | |||
126 | if (sprite.animSlowdownProgress == sprite.animSlowdown) { | ||
127 | sprite.animSlowdownProgress = 0; | ||
128 | } else { | ||
129 | continue; | ||
130 | } | ||
131 | } | ||
132 | |||
123 | sprite.animationFrame++; | 133 | sprite.animationFrame++; |
124 | 134 | ||
125 | if (sprite.animationFrame >= sprite.animations[sprite.animationId].frameIndices.size()) { | 135 | if (sprite.animationFrame >= sprite.animations[sprite.animationId].frameIndices.size()) { |
@@ -177,4 +187,5 @@ void AnimationSystem::updateAnimation(int spriteId) { | |||
177 | sprite.animationFrame = 0; | 187 | sprite.animationFrame = 0; |
178 | sprite.animFinished = false; | 188 | sprite.animFinished = false; |
179 | sprite.animPaused = false; | 189 | sprite.animPaused = false; |
190 | sprite.animSlowdownProgress = 0; | ||
180 | } | 191 | } |
diff --git a/src/script_system.cpp b/src/script_system.cpp index e218969..18a4e39 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp | |||
@@ -41,7 +41,8 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
41 | "paused", &Sprite::paused, | 41 | "paused", &Sprite::paused, |
42 | "clipping", &Sprite::clipping, | 42 | "clipping", &Sprite::clipping, |
43 | "cantCrouch", &Sprite::cantCrouch, | 43 | "cantCrouch", &Sprite::cantCrouch, |
44 | "bobsWhenNormal", &Sprite::bobsWhenNormal); | 44 | "bobsWhenNormal", &Sprite::bobsWhenNormal, |
45 | "animSlowdown", &Sprite::animSlowdown); | ||
45 | 46 | ||
46 | engine_.new_usertype<MessageSystem>( | 47 | engine_.new_usertype<MessageSystem>( |
47 | "message", | 48 | "message", |
diff --git a/src/sprite.h b/src/sprite.h index 570a906..733c792 100644 --- a/src/sprite.h +++ b/src/sprite.h | |||
@@ -78,11 +78,13 @@ public: | |||
78 | bool hasShadow = false; | 78 | bool hasShadow = false; |
79 | int bobAmount = 0; | 79 | int bobAmount = 0; |
80 | bool bobbingDown = false; | 80 | bool bobbingDown = false; |
81 | int animSlowdownProgress = 0; | ||
81 | 82 | ||
82 | // Animation (controls) | 83 | // Animation (controls) |
83 | bool normallyHasShadow = false; | 84 | bool normallyHasShadow = false; |
84 | bool animPaused = false; | 85 | bool animPaused = false; |
85 | bool bobbing = false; | 86 | bool bobbing = false; |
87 | int animSlowdown = 1; // Animation will only advance every X frames (so, 1 means it's disabled) | ||
86 | 88 | ||
87 | // Character | 89 | // Character |
88 | bool orientable = false; | 90 | bool orientable = false; |