From 907ca4e476f8a54cc368b35235dfa40eff661248 Mon Sep 17 00:00:00 2001 From: vboxuser Date: Fri, 25 Apr 2025 17:45:38 -0400 Subject: [PATCH] Fix WalkingBadguy getting stuck on curved tiles (#3239) --- src/badguy/walking_badguy.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/badguy/walking_badguy.cpp b/src/badguy/walking_badguy.cpp index efa6b743343..5e47a4eb517 100644 --- a/src/badguy/walking_badguy.cpp +++ b/src/badguy/walking_badguy.cpp @@ -200,12 +200,21 @@ WalkingBadguy::collision_solid(const CollisionHit& hit) if (m_physic.get_velocity_y() > 0) m_physic.set_velocity_y(0); } - if ( hit.slope_normal.x == 0.0f && - ((hit.left && m_dir == Direction::LEFT) || - (hit.right && m_dir == Direction::RIGHT)) ) { + if ((hit.left && m_dir == Direction::LEFT) || + (hit.right && m_dir == Direction::RIGHT)) { + + // Enemies get stuck in some tiles #3239 FIX + // When a bad guy is about to step onto a slope, have it manually step onto it + if (std::abs(hit.slope_normal.x) > 0.0f && std::abs(hit.slope_normal.x) < 0.7f) { + Vector movement = m_col.get_movement(); + movement.y -= 5; + m_col.set_movement(movement); + // setting the movement of the CollisionObject + } else { + // If it's anything but a sloped surface, turn around like normal turn_around(); + } } - } HitResponse