From 680b7b1c8b0f04bcc10d80106819f73501177b48 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 12 Mar 2021 10:47:26 -0500 Subject: Prevented bonking if you moved on at least one axis #18 --- src/character_system.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') 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) { } } - if (collision.blocked && sprite.characterState == CharacterState::Running && !sprite.clipping) { - stopRunning(spriteId); - game_.getMixer().playSound("../res/sfx/bump.wav"); - } - // Move everything if (pLoc != sprite.loc) { game_.getSystem().moveSprite(spriteId, pLoc); @@ -231,6 +226,12 @@ void CharacterSystem::tick(double dt) { pNext.trail.pop_front(); pNext.trail.push_back({.pos = pLoc, .dir = sprite.dir, .medium = sprite.characterMedium}); } + } else { + // We haven't moved at all. + if (sprite.characterState == CharacterState::Running) { + stopRunning(spriteId); + game_.getMixer().playSound("../res/sfx/bump.wav"); + } } } } -- cgit 1.4.1