Skip to content

Fix #3569: Fix Tux not turning around in 1-block gaps#3745

Open
gvalves2005 wants to merge 1 commit into
SuperTux:masterfrom
gvalves2005:fix-bug-3569
Open

Fix #3569: Fix Tux not turning around in 1-block gaps#3745
gvalves2005 wants to merge 1 commit into
SuperTux:masterfrom
gvalves2005:fix-bug-3569

Conversation

@gvalves2005

Copy link
Copy Markdown

This PR fixes issue #3569, where Tux ignores user directional input when placed in a 1-block gap while the fancy idle animation timer is active.

Root Cause & Fix

When Tux's horizontal velocity becomes zero, the draw() function in player.cpp waits for the idle timer to finish before updating the sprite's direction. This patch adds a check during the idle wait state to force an action update if the direction changes, resetting the idle stage to zero.

Testing

I validated this fix via manual runtime testing.

  • Compiled locally and ran the game.
  • Verified Tux turns smoothly in 1-block gaps without getting stuck in the idle animation.

Closes #3569

Comment thread src/object/player.cpp Outdated
When Tux is in a 1-block gap, his horizontal velocity becomes zero.
If the fancy idle timer was active, the draw() function would wait
for the timer to finish before updating the sprite's direction,
ignoring user input. This patch adds a check during the idle wait
state to force an action update if the direction changes,
resetting the idle stage to zero.

A unit test (PlayerAnimationTest) was also added to verify the
state machine logic for the idle animation turnaround

Closes SuperTux#3569
@gvalves2005

Copy link
Copy Markdown
Author

Just noticed I missed an 'S' on IDLE_STAGES which upset the CI. Force-pushed the compilation fix!

@gvalves2005

Copy link
Copy Markdown
Author

Hi @tobbi! Hope you're doing well. I just wanted to check in on the status of this PR. Let me know if the current implementation looks good to you, or if I need to adjust anything else.

@tobbi

tobbi commented Jun 3, 2026

Copy link
Copy Markdown
Member

Thank you! From my side it looks good. I'm checking in with the rest of the team.

One thing I'm not sure about: There's some code duplication and I'm wondering whether that can be moved into its own function. But I'll discuss that with the rest of the team first.

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]: Tux does not visually turn around when in a one-block gap

2 participants