As you can see, you will only shoot arrows when the enemies are in range, but the problem is the arrows always go towards enemies in the same order(That is, the order in which the enemies were created) instead of going to the closest one, so you will always attack the same enemy no matter where you are. How can I fix this?
A much smaller issue(which I already tried to fix until I gave up): I want to make the camera follow the player(moving slightly slower than the player), then make the camera go a little faster when you release the button until it gets to the player position, as smoothly as possible. The problem is the camera sprite keeps moving around the center of the player forever, vibrating.
Thanks for your time, guys .