# Why is the animation failing?

**URL:** <https://forum.makecode.com/t/why-is-the-animation-failing/3221>\
**Category:** Help\
**Created:** [August 24, 2020, 1:55pm UTC](https://forum.makecode.com/t/why-is-the-animation-failing/3221 "2020-08-24T13:55:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlbanT](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/albant/32/1464_2.png) [@AlbanT](https://forum.makecode.com/u/AlbanT)\
**Post date:** [August 24, 2020, 1:55pm UTC](https://forum.makecode.com/t/why-is-the-animation-failing/3221/1 "2020-08-24T13:55:19Z")

</div>

Hi,  
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](https://makecode.com/_3V4dy71XAaP9)  
And this is mine: [https://makecode.com/\_1v1XxgXWrTFW](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?

Best regards,

Alban

---

<div class="post-metadata">

**Author:** ![techahoynyc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/techahoynyc/32/1023_2.png) [@techahoynyc](https://forum.makecode.com/u/techahoynyc)\
**Post date:** [August 24, 2020, 4:07pm UTC](https://forum.makecode.com/t/why-is-the-animation-failing/3221/2 "2020-08-24T16:07:37Z")

</div>

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:

> **[chicken won't walk](https://arcade.makecode.com/47095-65243-98543-90581)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

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.

---

<div class="post-metadata">

**Author:** ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)\
**Post date:** [August 24, 2020, 4:18pm UTC](https://forum.makecode.com/t/why-is-the-animation-failing/3221/3 "2020-08-24T16:18:41Z")

</div>

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.

> **[chicken walks!](https://arcade.makecode.com/12768-39095-79476-48377)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![AlbanT](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/albant/32/1464_2.png) [@AlbanT](https://forum.makecode.com/u/AlbanT)\
**Post date:** [August 26, 2020, 9:41am UTC](https://forum.makecode.com/t/why-is-the-animation-failing/3221/4 "2020-08-26T09:41:38Z")

</div>

Thanks Alex for noticing that!!!  
I’ll forward this to my son so he can try it in his game.
