Skip to content

Commit 01f6706

Browse files
Do not set badguy's x-velocity to zero if ignited or squished in air
1 parent 88bd7c5 commit 01f6706

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/badguy/badguy.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,11 @@ BadGuy::kill_squished(GameObject& object)
720720

721721
SoundManager::current()->play("sounds/squish.wav", get_pos());
722722
m_physic.enable_gravity(true);
723-
m_physic.set_velocity(0, 0);
723+
724+
if (on_ground())
725+
m_physic.set_velocity(0, 0);
726+
else
727+
m_physic.set_velocity_y(0.0f);
724728
set_state(STATE_SQUISHED);
725729
set_group(COLGROUP_MOVING_ONLY_STATIC);
726730
auto player = dynamic_cast<Player*>(&object);
@@ -1194,7 +1198,12 @@ BadGuy::ignite()
11941198
unfreeze();
11951199

11961200
m_physic.enable_gravity(true);
1197-
m_physic.set_velocity(0, 0);
1201+
1202+
if (on_ground())
1203+
m_physic.set_velocity(0, 0);
1204+
else
1205+
m_physic.set_velocity_y(0.0f);
1206+
11981207
set_group(COLGROUP_MOVING_ONLY_STATIC);
11991208
m_sprite->stop_animation();
12001209
m_ignited = true;

0 commit comments

Comments
 (0)