My son was trying to make a little chicken game and started by animating a little chicken.
It is virtually identical to a test I did but in my project I can walk with the left and right buttone swhile in my son’s project the walking stops working as soon as we add the animation to the button press block.
THis is my sons project: https://makecode.com/_3V4dy71XAaP9
And this is mine: https://makecode.com/_1v1XxgXWrTFW
When I compare the button press/release blocks and the animations they seem to be identical…
Any ideas on why this is?
That’s a strange bug. I thought it might be due to button debounce, but running your son’s code in debug doesn’t call ‘set mysprite vx 0’ until you actually release the buttons. I rearranged and pulled out the animation blocks and the ‘set vx’ blocks still weren’t working as expected.
So, while I can’t offer a reason as to why that bug exists, I can offer a different version of the same code:
This uses the ‘move mysprite with buttons’ block along with an ‘ongame update’ block to achieve the same effect. Hope this helps, but I know it’s not the exact answer you’re hoping for.
First, the chicken is absolutely adorable. I love it!
The animation frames in the
Animatie function are 16x14 (and some are 16x13), and the image when creating the sprite in
on start is 16x16. The images all need to be the same size. Another issue has to do with the chicken’s feet in the animation frames. Because the chicken is walking on a wall, its feet need to always be at the bottom of the frame. In some of the images, the chicken’s feet are a pixel or two away from the bottom, so the chicken “sinks” into the walls, and it gets stuck there.
I switched the sprites to all be 16x14 and moved the chicken down in the frames where its feet were not at the bottom of the frame, and the chicken is now walking on the ground.
Thanks Alex for noticing that!!!
I’ll forward this to my son so he can try it in his game.