# Make my enemy sprite face the right direction?

**URL:** <https://forum.makecode.com/t/make-my-enemy-sprite-face-the-right-direction/4612>\
**Category:** Help\
**Created:** [November 24, 2020, 4:39pm UTC](https://forum.makecode.com/t/make-my-enemy-sprite-face-the-right-direction/4612 "2020-11-24T16:39:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stompey](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@Stompey](https://forum.makecode.com/u/Stompey)\
**Post date:** [November 24, 2020, 4:39pm UTC](https://forum.makecode.com/t/make-my-enemy-sprite-face-the-right-direction/4612/1 "2020-11-24T16:39:28Z")

</div>

I am trying to get my badguy sprite to flip when he changes directions but flipping him like I flip mySprite doesn’t work. Any ideas on where or how to code this.

> **[11-24-? Platform](https://arcade.makecode.com/96500-11152-58759-31104)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Kat](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kat/32/2596_2.png) [@Kat](https://forum.makecode.com/u/Kat)\
**Post date:** [November 24, 2020, 4:40pm UTC](https://forum.makecode.com/t/make-my-enemy-sprite-face-the-right-direction/4612/2 "2020-11-24T16:40:17Z")

</div>

Welcome to the forum! Let me look into your code and see the best way to do this.

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [November 24, 2020, 4:48pm UTC](https://forum.makecode.com/t/make-my-enemy-sprite-face-the-right-direction/4612/3 "2020-11-24T16:48:45Z")

</div>

This is where I come in and say:

* * *

Use @richard’s character animations extension! It allows you to design animations and it will automatically start and stop animations based on certain rules you define. But it doesn’t solve the problem of flipping them. ☹ But if you post your image by copy and paste it here, I can flip it for you. 🙂

> **[GitHub - riknoll/character-animations](https://github.com/riknoll/character-animations)**
>
> Contribute to riknoll/character-animations development by creating an account on GitHub.

* * *

Not related, but I only have to type `git` for [https://github.com/riknoll/character-animations](https://github.com/riknoll/character-animations) to come up lol.

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/2/299d50001cf47cdb30904727ae6e933d765bda30.png)

* * *

Also not related, but I made a gist for very useful MakeCode Arcade extensions:

> [@Useful Arcade extensions](https://forum.makecode.com/t/useful-arcade-extensions/4472):
>
> Hello all, I have made a Gist that links to a lot of useful extensions that I use frequently, so I didn’t have to scour the Forums trying to find the Github links that I use a lot. If I’ve missed any, (and I surely did) please tell me! Don’t forget to star the Gist so you won’t lose track of it! (Or you could just bookmark it) As more extensions keep popping up, I’ll add to this.

Hopefully, some of the extensions can help or extend your game!

---

<div class="post-metadata">

**Author:** ![shakao](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/shakao/32/113_2.png) [@shakao](https://forum.makecode.com/u/shakao)\
**Post date:** [November 24, 2020, 7:20pm UTC](https://forum.makecode.com/t/make-my-enemy-sprite-face-the-right-direction/4612/4 "2020-11-24T19:20:01Z")

</div>

The problem is when you use `badguy` here:

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/8/86511d83eb0320a4922f7573f588a0896ab5d40d.png)

You are only referencing the _last_ “badguy” sprite created. so it will only flip one enemy. Another issue is that when the x velocity is greater than zero the image will flip constantly, making it flicker. Instead, you can just do a “flip image horizontally” whenever you change the velocity of your badguy, like so:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/5/58b9406cb4523c92d0cab45335ba2f26d0f40809.png)

Hope that helps!

---

<div class="post-metadata">

**Author:** ![Stompey](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@Stompey](https://forum.makecode.com/u/Stompey)\
**Post date:** [November 24, 2020, 8:16pm UTC](https://forum.makecode.com/t/make-my-enemy-sprite-face-the-right-direction/4612/5 "2020-11-24T20:16:37Z")

</div>

That is awesome! Thanks so much Shakao!
