Skip to content

Commit

Permalink
Do not unload falling badguys
Browse files Browse the repository at this point in the history
Falling `BadGuy`s (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 20, 2023
1 parent 0836c36 commit 32fcfda
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 32fcfda

Please sign in to comment.