# Sprite not animating when moving

**URL:** <https://forum.makecode.com/t/sprite-not-animating-when-moving/22629>\
**Category:** Help\
**Created:** [September 20, 2023, 4:42pm UTC](https://forum.makecode.com/t/sprite-not-animating-when-moving/22629 "2023-09-20T16:42:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChaosChaos1997](https://avatars.discourse-cdn.com/v4/letter/c/b4bc9f/32.png) [@ChaosChaos1997](https://forum.makecode.com/u/ChaosChaos1997)\
**Post date:** [September 20, 2023, 4:42pm UTC](https://forum.makecode.com/t/sprite-not-animating-when-moving/22629/1 "2023-09-20T16:42:46Z")

</div>

I’m currently working on a basic game where you slash at enimies and try not to die. I’m having a problem where my enemy is not doing his movement animation unless the player is still since he’s constantly following the player. Any suggestions on how to fix this?  
Game Link: [https://arcade.makecode.com/S08375-35874-27527-92388](https://arcade.makecode.com/S08375-35874-27527-92388) (remove the ‘change life by -1’ block to disable character death0

---

<div class="post-metadata">

**Author:** ![ChaosChaos1997](https://avatars.discourse-cdn.com/v4/letter/c/b4bc9f/32.png) [@ChaosChaos1997](https://forum.makecode.com/u/ChaosChaos1997)\
**Post date:** [September 20, 2023, 6:01pm UTC](https://forum.makecode.com/t/sprite-not-animating-when-moving/22629/2 "2023-09-20T18:01:24Z")

</div>

Update: I made many changes to the project but the glitch is still happening. Here is the updated project.

> **[Placeholder Title](https://arcade.makecode.com/48707-14546-54745-77364)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)\
**Post date:** [October 2, 2023, 5:03pm UTC](https://forum.makecode.com/t/sprite-not-animating-when-moving/22629/3 "2023-10-02T17:03:38Z")

</div>

> [@ChaosChaos1997](#):
>
> …my enemy is not doing his movement animation unless the player is still…

Something like this, maybe, @ChaosChaos1997?:

> **[Placeholder Title w/animations](https://arcade.makecode.com/76585-60820-22641-28734)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

The reason why your last version appeared to have no enemy animations while moving, was that the animation was changed or restarted too frequently and before it could really start. I put in some state switches to only change animation if direction was significantly altered.
