# Enemies won't face direction they're moving! Help!

**URL:** <https://forum.makecode.com/t/enemies-wont-face-direction-theyre-moving-help/10469>\
**Category:** Help\
**Created:** [October 18, 2021, 4:31pm UTC](https://forum.makecode.com/t/enemies-wont-face-direction-theyre-moving-help/10469 "2021-10-18T16:31:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LukaBakio](https://avatars.discourse-cdn.com/v4/letter/l/b5a626/32.png) [@LukaBakio](https://forum.makecode.com/u/LukaBakio)\
**Post date:** [October 18, 2021, 4:31pm UTC](https://forum.makecode.com/t/enemies-wont-face-direction-theyre-moving-help/10469/1 "2021-10-18T16:31:59Z")

</div>

([https://makecode.com/\_bwRV4yJqjLHi](https://makecode.com/_bwRV4yJqjLHi))

I’m having a hard time making my enemies face the direction that they are moving. Only one will face to the left when moving left. Anyone have any insight?

I included a link to my game.

Thank you!

---

<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:** [October 18, 2021, 5:17pm UTC](https://forum.makecode.com/t/enemies-wont-face-direction-theyre-moving-help/10469/2 "2021-10-18T17:17:15Z")

</div>

Welcome, @LukaBakio !

Let’s focus on this code:

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

Your variable `Bumper` only points to _one_ sprite - the last Bumper that was created. Instead, you want to work on _all_ Bumpers. You need a loop for that:

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

Each time the code inside of the `for element` loop runs, `value` (called the _loop variable_) will change and point to a different `Enemy` sprite. (In your game, `value` will change to each of your Bumper sprites.) So, inside of the `for element` loop, be sure to use the loop variable and not your `Bumper` variable.

Give it a try! If you get stuck, reveal the spoiler below for my version of the code.

**Version 1**

This is similar to your version of the code:

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

You’ll probably get some flicker, though. Reveal the next spoiler for a version that should reduce flicker.

**Version 2**

This version should have less flicker:

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

---

<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:** [October 18, 2021, 5:17pm UTC](https://forum.makecode.com/t/enemies-wont-face-direction-theyre-moving-help/10469/3 "2021-10-18T17:17:30Z")

</div>

Besides doing the image flip manually, you could try an extension that riknoll wrote. Take a look at these two forum threads:

[Making a character sprite face four different directions when moving - Arcade / Help - Microsoft MakeCode](https://forum.makecode.com/t/making-a-character-sprite-face-four-different-directions-when-moving/9200)

[Make my enemy sprite face the right direction? - Arcade / Help - Microsoft MakeCode](https://forum.makecode.com/t/make-my-enemy-sprite-face-the-right-direction/4612)

If you are not familiar with using extensions, then take a look at the **Simple Extensions** tutorial. You can find it in the **Tutorials** section on the MakeCode Arcade home screen. (Scroll to the right to find it.)

---

<div class="post-metadata">

**Author:** ![LukaBakio](https://avatars.discourse-cdn.com/v4/letter/l/b5a626/32.png) [@LukaBakio](https://forum.makecode.com/u/LukaBakio)\
**Post date:** [October 19, 2021, 12:25am UTC](https://forum.makecode.com/t/enemies-wont-face-direction-theyre-moving-help/10469/4 "2021-10-19T00:25:58Z")

</div>

Thanks so much! Huge help!
