# Auto-Aiming?

**URL:** <https://forum.makecode.com/t/auto-aiming/31095>\
**Category:** Help\
**Tags:** game\
**Created:** [October 10, 2024, 1:41pm UTC](https://forum.makecode.com/t/auto-aiming/31095 "2024-10-10T13:41:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkplayz](https://avatars.discourse-cdn.com/v4/letter/p/a587f6/32.png) [@pkplayz](https://forum.makecode.com/u/pkplayz)\
**Post date:** [October 10, 2024, 1:41pm UTC](https://forum.makecode.com/t/auto-aiming/31095/1 "2024-10-10T13:41:33Z")

</div>

I plan to make multiple weapons in my game, but realized it was gonna be really time consuming to make the aim function for each weapon. Is there a way to constantly check all enemies on the screen, and if that enemy is in the range where the attack in use can hit, then the attack will automatically shoot towards the closest enemy which fits both above criterias?

---

<div class="post-metadata">

**Author:** ![redSprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/redsprite/32/34262_2.png) [@redSprite](https://forum.makecode.com/u/redSprite)\
**Post date:** [October 10, 2024, 5:50pm UTC](https://forum.makecode.com/t/auto-aiming/31095/2 "2024-10-10T17:50:27Z")

</div>

Oh, you will love this extension:

> jwunderl/arcade-sprite-util

---

<div class="post-metadata">

**Author:** ![wispycrispy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/wispycrispy/32/19222_2.png) [@wispycrispy](https://forum.makecode.com/u/wispycrispy)\
**Post date:** [October 10, 2024, 5:54pm UTC](https://forum.makecode.com/t/auto-aiming/31095/3 "2024-10-10T17:54:46Z")

</div>

> **[GitHub - jwunderl/arcade-sprite-util: A few utility functions for sprites](https://github.com/jwunderl/arcade-sprite-util)**
>
> A few utility functions for sprites

This might help

---

<div class="post-metadata">

**Author:** ![pkplayz](https://avatars.discourse-cdn.com/v4/letter/p/a587f6/32.png) [@pkplayz](https://forum.makecode.com/u/pkplayz)\
**Post date:** [October 11, 2024, 8:42pm UTC](https://forum.makecode.com/t/auto-aiming/31095/4 "2024-10-11T20:42:18Z")

</div>

I see how this could help a lot, but since im not really into the technical stuff in makecode, what blocks can I use to find the closest enemy and get the angle to shoot? Theres the “find distance between” block and “angle between” block. So I just need a possible way to find the angle from the player and the closest enemy.

---

<div class="post-metadata">

**Author:** ![wispycrispy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/wispycrispy/32/19222_2.png) [@wispycrispy](https://forum.makecode.com/u/wispycrispy)\
**Post date:** [October 18, 2024, 6:08pm UTC](https://forum.makecode.com/t/auto-aiming/31095/5 "2024-10-18T18:08:16Z")

</div>

This might help you:

> **[Auto Aim](https://arcade.makecode.com/S94106-96594-20697-20755)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

(A to shoot, B to spawn an enemy)

---

<div class="post-metadata">

**Author:** ![pkplayz](https://avatars.discourse-cdn.com/v4/letter/p/a587f6/32.png) [@pkplayz](https://forum.makecode.com/u/pkplayz)\
**Post date:** [October 20, 2024, 4:55pm UTC](https://forum.makecode.com/t/auto-aiming/31095/6 "2024-10-20T16:55:26Z")

</div>

Yes, this was what I was trying to find, thanks!

---

<div class="post-metadata">

**Author:** ![Table](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/table/32/16503_2.png) [@Table](https://forum.makecode.com/u/Table)\
**Post date:** [October 20, 2024, 4:58pm UTC](https://forum.makecode.com/t/auto-aiming/31095/7 "2024-10-20T16:58:40Z")

</div>

This has the potential to be an amazing game.
