Skip to content

Commit d54b0a6

Browse files
Fix zeekling jittering after death (#3378)
* Fix Zeekling jittering after death Fixes #3353 * Do not set badguy's x-velocity to zero if ignited or squished in air * Fix WalkingBadguy handling when inactive
1 parent ebc110a commit d54b0a6

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
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;

src/badguy/bouncing_snowball.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,16 @@ BouncingSnowball::collision_squished(MovingObject& object)
131131
void
132132
BouncingSnowball::collision_solid(const CollisionHit& hit)
133133
{
134-
if (m_sprite->get_action() == "squished")
135-
return;
136-
137-
if (m_frozen)
134+
if (m_frozen || !is_active())
138135
{
139136
BadGuy::collision_solid(hit);
140137
return;
141138
}
142139

140+
if (m_sprite->get_action() == "squished")
141+
return;
142+
143+
143144
if (hit.bottom) {
144145
if (get_state() == STATE_ACTIVE) {
145146
float bounce_speed = -m_physic.get_velocity_y()*0.8f;

src/badguy/walking_badguy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ WalkingBadguy::collision_solid(const CollisionHit& hit)
187187

188188
update_on_ground_flag(hit);
189189

190-
if (m_frozen)
190+
if (m_frozen || !is_active())
191191
{
192192
BadGuy::collision_solid(hit);
193193
return;

src/badguy/zeekling.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,12 @@ Zeekling::on_bump_vertical()
104104
void
105105
Zeekling::collision_solid(const CollisionHit& hit)
106106
{
107-
if (m_frozen)
107+
if (m_frozen || !is_active())
108108
{
109109
BadGuy::collision_solid(hit);
110110
return;
111111
}
112112

113-
if (BadGuy::get_state() == STATE_SQUISHED ||
114-
BadGuy::get_state() == STATE_BURNING)
115-
{
116-
return;
117-
}
118-
119113
if (hit.top || hit.bottom)
120114
on_bump_vertical();
121115
else if (hit.left || hit.right)

0 commit comments

Comments
 (0)