summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2021-03-12 10:47:26 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2021-03-12 10:47:26 -0500
commit680b7b1c8b0f04bcc10d80106819f73501177b48 (patch)
tree412e774a854e2d571ffdb5ae84458a91c1750f65 /src
parenta10c90788847c67c4dc65197088608a7ed44342b (diff)
downloadtanetane-680b7b1c8b0f04bcc10d80106819f73501177b48.tar.gz
tanetane-680b7b1c8b0f04bcc10d80106819f73501177b48.tar.bz2
tanetane-680b7b1c8b0f04bcc10d80106819f73501177b48.zip
Prevented bonking if you moved on at least one axis
#18
Diffstat (limited to 'src')
-rw-r--r--src/character_system.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/character_system.cpp b/src/character_system.cpp index 368505e..695e8f5 100644 --- a/src/character_system.cpp +++ b/src/character_system.cpp
@@ -180,11 +180,6 @@ void CharacterSystem::tick(double dt) {
180 } 180 }
181 } 181 }
182 182
183 if (collision.blocked && sprite.characterState == CharacterState::Running && !sprite.clipping) {
184 stopRunning(spriteId);
185 game_.getMixer().playSound("../res/sfx/bump.wav");
186 }
187
188 // Move everything 183 // Move everything
189 if (pLoc != sprite.loc) { 184 if (pLoc != sprite.loc) {
190 game_.getSystem<TransformSystem>().moveSprite(spriteId, pLoc); 185 game_.getSystem<TransformSystem>().moveSprite(spriteId, pLoc);
@@ -231,6 +226,12 @@ void CharacterSystem::tick(double dt) {
231 pNext.trail.pop_front(); 226 pNext.trail.pop_front();
232 pNext.trail.push_back({.pos = pLoc, .dir = sprite.dir, .medium = sprite.characterMedium}); 227 pNext.trail.push_back({.pos = pLoc, .dir = sprite.dir, .medium = sprite.characterMedium});
233 } 228 }
229 } else {
230 // We haven't moved at all.
231 if (sprite.characterState == CharacterState::Running) {
232 stopRunning(spriteId);
233 game_.getMixer().playSound("../res/sfx/bump.wav");
234 }
234 } 235 }
235 } 236 }
236 } 237 }