Skip to content

Fix WalkingBadguy getting stuck on curved tiles (#3239) #3252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mederand
Copy link

This pull request fixes issue #3239 where WalkingBadguy enemies would get stuck indefinitely on certain curved snow or cave tiles.

Changes:

  • When a collision against a shallow slope is detected (0 < slope_normal.x < 0.7), the enemy is manually nudged upward slightly.
  • Otherwise, if the slope is steep or it's a wall, the enemy turns around as usual.

Testing:

  • Reproduced the original stuck behavior in a sandbox level.
  • After applying the fix, enemies now smoothly turn around properly on curved tiles without getting stuck.
  • Regression tested normal wall collisions and enemy behavior across different tile types via playing a couple levels.

Closes #3239

// 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) {
m_col.m_bbox.move(Vector(0, -5));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of moving the box directly, set the movement of the CollisionObject.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. I updated the fix using get_movement() and set_movement(). Let me know if there's anything I need to adjust.

@mederand mederand force-pushed the fix-enemy-stuck-tiles branch from 1e57453 to 907ca4e Compare April 25, 2025 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Enemies get stuck in some tiles
2 participants