# Sprite rotation help

**URL:** <https://forum.makecode.com/t/sprite-rotation-help/42827>\
**Category:** Help\
**Tags:** game\
**Created:** [March 22, 2026, 6:51am UTC](https://forum.makecode.com/t/sprite-rotation-help/42827 "2026-03-22T06:51:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RizeUpDev](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/rizeupdev/32/35291_2.png) [@RizeUpDev](https://forum.makecode.com/u/RizeUpDev)\
**Post date:** [March 22, 2026, 6:51am UTC](https://forum.makecode.com/t/sprite-rotation-help/42827/1 "2026-03-22T06:51:50Z")

</div>

@Rune, I played Nine Cores. I wanted to learn how did you make the gun rotate using the mouse? I want to use that to make my own gun game called battlefront. I didn’t want to go into the project because it was too laggy.

Regards, RizeUpDev

---

<div class="post-metadata">

**Author:** ![Rune](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/rune/32/18951_2.png) [@Rune](https://forum.makecode.com/u/Rune)\
**Post date:** [March 24, 2026, 3:24am UTC](https://forum.makecode.com/t/sprite-rotation-help/42827/2 "2026-03-24T03:24:25Z")

</div>

Sorry I took awhile to respond, here’s how it works:

1. I used the browser extension to get the mouses location, but then I had to do a little math to make it relative to camera. I placed a sprite on that position every frame as a cursor.
2. I have another sprite for the gun, which is set to the players location every frame. I placed the gun art to the far right of the Sprite so that when it rotated it swiveled around the character.
3. Then, I used a block in the Sprite Util extension to find the angle between the player and the cursor, and set that to the guns rotation.
4. When it fired, I got the same angle and made a sprite to move in that angle using a different block in Sprite Util.

Hope this was helpful! If you want, you can look at the code in [this](https://makecode.com/_6r00xF48sHkL), it should be less laggy.

---

<div class="post-metadata">

**Author:** ![RizeUpDev](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/rizeupdev/32/35291_2.png) [@RizeUpDev](https://forum.makecode.com/u/RizeUpDev)\
**Post date:** [March 24, 2026, 9:41pm UTC](https://forum.makecode.com/t/sprite-rotation-help/42827/3 "2026-03-24T21:41:29Z")

</div>

Oh thanks! Now I can complete all of my other 21 pending projects!
