Open Prid13 opened 4 years ago
I ran into the same problem, and also, the demo that shows the finished game here does. And so does the gif here
So this would need to be fixed in the tutorial, the gif, and the actual source code of flixel-demos here
Assuming fixing it in flixel-demos would propogate to the host of the IFrame here then I think everything would be fine.
I agree that the animation code needs to be explained more, per #241. Fixing this could be a good time to do that. I could PR flixel-docs and flixel-demos to do the work.
Part 4 - "Sprites and Animation" contains a slight error in the code.
In step 3, the code is supposed to "end with the player in their 'neutral' pose (legs together), that way each time we animate the player, it will return to the correct frame as soon as they stop animating"
However, that doesn't seem to be working. After moving, the animation always stops on the last frame where one leg is out. Maybe the player sprite got updated after the tutorial and the frames changed?
Either way, the solution is simply to move the first frame numbers in each array to the very end of the array, like this:
That way the animation sequence will end with the neutral pose.
Another solution I found online was to add the code below after
if(up || down || left || right){
: