diff --git a/src/badguy/igel.cpp b/src/badguy/igel.cpp index 310c9fab4f8..acad39fcb3d 100644 --- a/src/badguy/igel.cpp +++ b/src/badguy/igel.cpp @@ -63,6 +63,9 @@ void Igel::active_update(float dt_sec) { WalkingBadguy::active_update(dt_sec); + + if (m_frozen) return; + switch (m_state) { case STATE_ROLLING: @@ -160,6 +163,26 @@ Igel::run_dead_script() WalkingBadguy::run_dead_script(); } +void +Igel::unfreeze(bool melt) +{ + WalkingBadguy::unfreeze(melt); + + if (melt) return; + + m_state = STATE_NORMAL; + m_bonked = false; + + set_action(m_dir); + + float vel = get_normal_walk_speed(); + set_walk_speed(vel); + m_physic.set_velocity_x(vel * (m_dir == Direction::LEFT ? -1 : 1)); + + m_roll_timer.stop(); + m_ease_timer.stop(); +} + GameObjectTypes Igel::get_types() const { diff --git a/src/badguy/igel.hpp b/src/badguy/igel.hpp index 1898fa7b86b..6740ec9a1f3 100644 --- a/src/badguy/igel.hpp +++ b/src/badguy/igel.hpp @@ -39,6 +39,7 @@ class Igel final : public WalkingBadguy virtual std::string get_display_name() const override { return display_name(); } virtual bool is_freezable() const override { return true; } + virtual void unfreeze(bool melt = true) override; virtual GameObjectTypes get_types() const override; virtual std::string get_default_sprite_name() const override;