Skip to content

Commit

Permalink
Do not unload falling badguys (#2594)
Browse files Browse the repository at this point in the history
Falling BadGuys (which have Y-velocity bigger than 0), no longer are unloaded.

This allows level designers to have more freedom with height of levels and not worry about badguys not being counted towards the total badguy counter, because they have been unloaded, before dying.
  • Loading branch information
Vankata453 committed Aug 21, 2023
1 parent c090048 commit 4a5bdc0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/badguy/badguy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ BadGuy::update(float dt_sec)
}
}

if (m_is_active_flag && is_offscreen()) {
// Deactivate badguy, if off-screen and not falling down.
if (m_is_active_flag && is_offscreen() && m_physic.get_velocity_y() <= 0.f)
{
deactivate();
set_state(STATE_INACTIVE);
}
Expand Down

0 comments on commit 4a5bdc0

Please sign in to comment.