# How do you make your sprite image look left and shoot left or look right and shoot right

**URL:** <https://forum.makecode.com/t/how-do-you-make-your-sprite-image-look-left-and-shoot-left-or-look-right-and-shoot-right/2839>\
**Category:** Help\
**Created:** [July 20, 2020, 3:43pm UTC](https://forum.makecode.com/t/how-do-you-make-your-sprite-image-look-left-and-shoot-left-or-look-right-and-shoot-right/2839 "2020-07-20T15:43:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [July 20, 2020, 3:43pm UTC](https://forum.makecode.com/t/how-do-you-make-your-sprite-image-look-left-and-shoot-left-or-look-right-and-shoot-right/2839/1 "2020-07-20T15:43:43Z")

</div>

same for down and up as well

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [July 20, 2020, 3:49pm UTC](https://forum.makecode.com/t/how-do-you-make-your-sprite-image-look-left-and-shoot-left-or-look-right-and-shoot-right/2839/2 "2020-07-20T15:49:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [July 20, 2020, 3:49pm UTC](https://forum.makecode.com/t/how-do-you-make-your-sprite-image-look-left-and-shoot-left-or-look-right-and-shoot-right/2839/3 "2020-07-20T15:49:33Z")

</div>

that didnt work. it only shot right

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [July 20, 2020, 4:12pm UTC](https://forum.makecode.com/t/how-do-you-make-your-sprite-image-look-left-and-shoot-left-or-look-right-and-shoot-right/2839/4 "2020-07-20T16:12:11Z")

</div>

Instead of checking the image, it might be easier to store a variable. I usually create a variable called “facingLeft” and set it to be true or false when I change the image from facing left to facing right.

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [July 20, 2020, 4:37pm UTC](https://forum.makecode.com/t/how-do-you-make-your-sprite-image-look-left-and-shoot-left-or-look-right-and-shoot-right/2839/5 "2020-07-20T16:37:52Z")

</div>

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

Im really confused but this is what i got

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [July 20, 2020, 4:40pm UTC](https://forum.makecode.com/t/how-do-you-make-your-sprite-image-look-left-and-shoot-left-or-look-right-and-shoot-right/2839/6 "2020-07-20T16:40:32Z")

</div>

that code should work! You need to add the variable to the “and” block in each of the forever loops. For example,

```auto
if (facingLeft) and (is A button pressed):
    set projectile to (sprite of projectile facing left)

```

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [July 20, 2020, 4:47pm UTC](https://forum.makecode.com/t/how-do-you-make-your-sprite-image-look-left-and-shoot-left-or-look-right-and-shoot-right/2839/7 "2020-07-20T16:47:31Z")

</div>

I did that

> **[ghost hunters](https://arcade.makecode.com/62195-43046-51632-03156)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

but now its just rapid firing

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [July 20, 2020, 5:44pm UTC](https://forum.makecode.com/t/how-do-you-make-your-sprite-image-look-left-and-shoot-left-or-look-right-and-shoot-right/2839/9 "2020-07-20T17:44:40Z")

</div>

You can slow it down by putting a pause block inside the forever. Also, your game will probably work a little better if you combine all of the forever blocks (just put all the if/else blocks one after another).

To limit the ghosts, you can create a counter variable (numGhosts) and increase it when you spawn ghosts and decrease it when they get destroyed (there is an “on sprite of kind destroyed” event in the sprites category). Then, when you create a ghost, only create it if numGhosts is less than the limit.

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [July 20, 2020, 5:45pm UTC](https://forum.makecode.com/t/how-do-you-make-your-sprite-image-look-left-and-shoot-left-or-look-right-and-shoot-right/2839/10 "2020-07-20T17:45:55Z")

</div>

That makes sense.

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [July 20, 2020, 10:42pm UTC](https://forum.makecode.com/t/how-do-you-make-your-sprite-image-look-left-and-shoot-left-or-look-right-and-shoot-right/2839/11 "2020-07-20T22:42:17Z")

</div>

with the shooting part, all you had to do is drag it in to an A Button Pressed block instead of forever block or on game update
