diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-26 19:08:49 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-26 19:08:49 -0500 |
commit | c304defdd7b0c5a8bea83f2540c009ededd450cb (patch) | |
tree | f959d12fe879c7d1d20eeb8689ee62a0aa073990 /src/animation_system.cpp | |
parent | c1fc60c5a2a4b96b830afc29942648714944b9d7 (diff) | |
download | tanetane-c304defdd7b0c5a8bea83f2540c009ededd450cb.tar.gz tanetane-c304defdd7b0c5a8bea83f2540c009ededd450cb.tar.bz2 tanetane-c304defdd7b0c5a8bea83f2540c009ededd450cb.zip |
Added animation slowdown effect (for Lucas underwater)
Diffstat (limited to 'src/animation_system.cpp')
-rw-r--r-- | src/animation_system.cpp | 11 |
1 files changed, 11 insertions, 0 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 | } |