From 32fcfda5dca8985b82de01909a8b7aa40490c5c6 Mon Sep 17 00:00:00 2001 From: Vankata453 <78196474+Vankata453@users.noreply.github.com> Date: Mon, 21 Aug 2023 00:57:22 +0300 Subject: [PATCH] Do not unload falling badguys 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. --- src/badguy/badguy.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 16350c41e0d..4b260111c9b 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -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); }