Skip to content

Commit 9a5ffb8

Browse files
Fix bouncing snowball and captain snowball collision solid when inactive
1 parent 01f6706 commit 9a5ffb8

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

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/captainsnowball.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ CaptainSnowball::collision_solid(const CollisionHit& hit)
8787
walk_speed = CAPTAIN_WALK_SPEED;
8888
m_physic.set_velocity_x(m_dir == Direction::LEFT ? -walk_speed : walk_speed);
8989
}
90-
WalkingBadguy::collision_solid(hit);
90+
if (!is_active())
91+
BadGuy::collision_solid(hit);
92+
else
93+
WalkingBadguy::collision_solid(hit);
9194
}
9295

9396
bool

0 commit comments

Comments
 (0)