# Help with animation and code

**URL:** <https://forum.makecode.com/t/help-with-animation-and-code/26681>\
**Category:** Help\
**Created:** [February 5, 2024, 5:10pm UTC](https://forum.makecode.com/t/help-with-animation-and-code/26681 "2024-02-05T17:10:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![amiram](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@amiram](https://forum.makecode.com/u/amiram)\
**Post date:** [February 5, 2024, 5:10pm UTC](https://forum.makecode.com/t/help-with-animation-and-code/26681/1 "2024-02-05T17:10:56Z")

</div>

I’m making a very basic game based on the “Over and Under #2” tutorial. The game works fine and I can finish the race no problem. But once I add animation to my player the player gets stuck on a loop and won’t advance the game. Problem is, in the original tutorial the animation works fine so idk what is different between the two games or what I did wrong. I don’t think the problem is with the tileset because without animation everything works fine.

I ran out of ideas, any help is welcomed, thank you.

 ![error1](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/3/3425f7ff19678cfc736454a1939b7a900cc406c8.jpeg)  
 ![error2](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/b/bd3b7b6af9fdf448a90a2bf2eaacf027f603c4ac.jpeg)

---

<div class="post-metadata">

**Author:** ![Bifrosty](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bifrosty/32/24819_2.png) [@Bifrosty](https://forum.makecode.com/u/Bifrosty)\
**Post date:** [February 6, 2024, 12:01am UTC](https://forum.makecode.com/t/help-with-animation-and-code/26681/2 "2024-02-06T00:01:27Z")

</div>

I think I know what’s happening, but to be sure I need to see all the animations frames or send me a link to the game by pressing the button in between the home and ? Buttons and then clicking share. This should give you a link.

---

<div class="post-metadata">

**Author:** ![amiram](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@amiram](https://forum.makecode.com/u/amiram)\
**Post date:** [February 7, 2024, 6:34pm UTC](https://forum.makecode.com/t/help-with-animation-and-code/26681/3 "2024-02-07T18:34:00Z")

</div>

Hi, here is the link [https://makecode.com/\_CpjRtWP2Wf73](https://makecode.com/_CpjRtWP2Wf73)

 ![error3](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/1/18ef42a81b54f399799716214f399ca9c305115b.jpeg)

thanks

---

<div class="post-metadata">

**Author:** ![Bifrosty](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bifrosty/32/24819_2.png) [@Bifrosty](https://forum.makecode.com/u/Bifrosty)\
**Post date:** [February 8, 2024, 9:23pm UTC](https://forum.makecode.com/t/help-with-animation-and-code/26681/4 "2024-02-08T21:23:18Z")

</div>

Yup, it was what I thought, the animation was uneven, and it was changing the hit box here is the updated link where it’s fixed —-\> [https://makecode.com/\_W5cC0FeK9PAX](https://makecode.com/_W5cC0FeK9PAX)

---

<div class="post-metadata">

**Author:** ![amiram](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@amiram](https://forum.makecode.com/u/amiram)\
**Post date:** [February 9, 2024, 9:44pm UTC](https://forum.makecode.com/t/help-with-animation-and-code/26681/5 "2024-02-09T21:44:51Z")

</div>

can you explain to me what do you mean by uneven and what changes did you make to do it? Thank you

---

<div class="post-metadata">

**Author:** ![Bifrosty](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bifrosty/32/24819_2.png) [@Bifrosty](https://forum.makecode.com/u/Bifrosty)\
**Post date:** [February 11, 2024, 9:56pm UTC](https://forum.makecode.com/t/help-with-animation-and-code/26681/6 "2024-02-11T21:56:42Z")

</div>

Hi Ariram!  
The distance to the ground was uneven so when it went from a distance of two to zero of the ground it would glitch into it. Here is a gif of me fixing it  
 ![IMG_4552](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/c/c796d9172c8567dc3655ef5db0480361974a98bf.gif)

---

<div class="post-metadata">

**Author:** ![amiram](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@amiram](https://forum.makecode.com/u/amiram)\
**Post date:** [February 12, 2024, 4:41pm UTC](https://forum.makecode.com/t/help-with-animation-and-code/26681/7 "2024-02-12T16:41:40Z")

</div>

ohhhhhh I see, wonderful, thank you 🙏 Do you know why it still gets stuck in random places sometimes?

---

<div class="post-metadata">

**Author:** ![Bifrosty](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bifrosty/32/24819_2.png) [@Bifrosty](https://forum.makecode.com/u/Bifrosty)\
**Post date:** [February 12, 2024, 11:46pm UTC](https://forum.makecode.com/t/help-with-animation-and-code/26681/8 "2024-02-12T23:46:03Z")

</div>

Yes, the problem is the same but vertically. The stem will phase through the felling. If you make all the demotions the same in the animation or just add a hitbox. In this example—\> [https://arcade.makecode.com/S71681-26740-91179-34281](https://arcade.makecode.com/S71681-26740-91179-34281) I added a hitbox, now you can make the sprite’s animation look like whatever you want without changing it’s hitbox. I also think the game would be better if it were randomly generated. In an unfinished game I made —\> [https://arcade.makecode.com/S09232-78140-21096-94337](https://arcade.makecode.com/S09232-78140-21096-94337) It is similar to yours, feel free to copy or take inspiration from my code. Good pixel art in your game btw

---

<div class="post-metadata">

**Author:** ![amiram](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@amiram](https://forum.makecode.com/u/amiram)\
**Post date:** [February 15, 2024, 12:52am UTC](https://forum.makecode.com/t/help-with-animation-and-code/26681/9 "2024-02-15T00:52:49Z")

</div>

This is wonderful! Can you explain to me what this line is for?

 ![imagen](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/6/6eed20586bdd669087e3e06468cff92a6dca0560.png)

Also, I will have to check the randomly part slower bc that’s a lot of coding ^^U but I will, thanks \<3

---

<div class="post-metadata">

**Author:** ![Bifrosty](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bifrosty/32/24819_2.png) [@Bifrosty](https://forum.makecode.com/u/Bifrosty)\
**Post date:** [February 20, 2024, 8:05pm UTC](https://forum.makecode.com/t/help-with-animation-and-code/26681/10 "2024-02-20T20:05:23Z")

</div>

That line turns of collisions for the pumpkin sprite
