Changing animations when sprite stops moving

A student is trying to make it so the “Hero” sprite shows its “protagonist block” animation once it stops moving right with the right arrow key and show its “protagonist block 2” when it stops moving left. Right now the he continues to “walk” in place.

We can’t figure out how to do it! Any ideas?

Here is a copy of the project so far:

Thanks in advance!

1 Like


Look at lines 62 & 66. The student is “redeclaring” the variable “facingleft” in both of those lines and it has already been declared at the beginning of the program. If they remove the “var” declaration and just leave it as “facingleft” they may be closer to a solution.

Good luck!


1 Like

Lines 62 & 66 the student redeclared a variable - they wrote var facingLeft = false; instead of facingLeft = false;
same on 93 - but they also misspelled bossHP as BossHP - case matters!

I add a [Remix] here with some minor changes.(

Keep us updated here, as this looks like a cool project!

1 Like