Skip to content

Commit 1e57453

Browse files
author
vboxuser
committed
Fix WalkingBadguy getting stuck on curved tiles (#3239)
1 parent b02e260 commit 1e57453

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/badguy/walking_badguy.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,18 @@ WalkingBadguy::collision_solid(const CollisionHit& hit)
200200
if (m_physic.get_velocity_y() > 0) m_physic.set_velocity_y(0);
201201
}
202202

203-
if ( hit.slope_normal.x == 0.0f &&
204-
((hit.left && m_dir == Direction::LEFT) ||
205-
(hit.right && m_dir == Direction::RIGHT)) ) {
203+
if ((hit.left && m_dir == Direction::LEFT) ||
204+
(hit.right && m_dir == Direction::RIGHT)) {
205+
206+
// Enemies get stuck in some tiles #3239 FIX
207+
// When a bad guy is about to step onto a slope, have it manually step onto it
208+
if (std::abs(hit.slope_normal.x) > 0.0f && std::abs(hit.slope_normal.x) < 0.7f) {
209+
m_col.m_bbox.move(Vector(0, -5));
210+
} else {
211+
// If it's anything but a sloped surface, turn around like normal
206212
turn_around();
213+
}
207214
}
208-
209215
}
210216

211217
HitResponse

0 commit comments

Comments
 (0)