Skip to content

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

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

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

Conversation

@gvalves2005
Copy link

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

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
Author

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

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