Home > Blockchain >  Scratch walking animation broken
Scratch walking animation broken

Time:05-17

What it's supposed to do:

I'm making a game on Scratch in which the character has a walking animation. The walking animation is supposed to switch their costume to a walking stance, wait 0.5 seconds then go to an idle stance, wait 0.5 seconds then go to a walking stance, and repeat that until they let go of the button.
The image below is an image of the animation blocks put together that play the animation when walking left.

Animation blocks.

What it does do and suspected reason for the bug:

It worked perfectly until I added a block function for the same character, when suddenly the animations broke for that character and the other one (who also has a walking animation with the same code). The second image below is an image of the blocking code.
After adding the block function, instead of waiting 0.5 seconds in between costume switches, it seems to switch to the walking stance and then immediately switch to the idle stance instead of waiting.
The image below is showing the blocking blocks and the movement it controls. While they are blocking it isn't supposed to be able to move. That part works fine but I included it in case it has something else to do with my problem.

Movement and blocking blocks.

What I have tried:

I tried running the peice of code shown individually (seperate from the other animation parts) but the bug still occurs and the animation doesn't wait 0.5 seconds. I also tried changing the other character's animation so that it wouldn't activate when the animation broadcast was sent but it still bugged, which means:

  • The problem isn't because it runs with another sprite too. (Because if it was it would have fixed when I deactivated the other animation).
  • The problem also isn't because it's connected with the right side walking and idle animations (Because if it was it would have fixed when I ran it alone).

  • Link to shared game:

    enter image description here

    • Related