Skip to content

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

@mederand mederand force-pushed the fix-enemy-stuck-tiles branch from 1e57453 to 907ca4e Compare April 25, 2025 22:51

// 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) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you maybe move the std::abs(hit.slope_normal.x) into a variable? That way, this if statement would fit into a line

@Alasdairbugs Alasdairbugs added status:needs-information PR/Issue author needs to provide additional information status:needs-work In progress, but no one is currently working on it (New volunteers welcome) labels Jul 7, 2025
@Alasdairbugs Alasdairbugs modified the milestones: 0.7.1, Future Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:needs-information PR/Issue author needs to provide additional information status:needs-work In progress, but no one is currently working on it (New volunteers welcome)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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