Auto-Aiming?

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?

1 Like

Oh, you will love this extension:

jwunderl/arcade-sprite-util

3 Likes

This might help

2 Likes

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.

This might help you:

(A to shoot, B to spawn an enemy)

3 Likes

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

1 Like

This has the potential to be an amazing game.

1 Like