Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Qrow |
Hello there, I’m attempting my first go at developing a game and it’s going to be a roguelike 2d bullet hell type game. I’ve seen many games like these already with a cursor system where the player shoots wherever the cursor is currently pointed. I was wondering if there was a way to remove the need for a cursor entirely and just have an auto targetting system that locks your aim at the nearest enemy visible in your line of sight.
Thank you in advance!
distance_to
if player.global_position.distance_to(enemy.global_position) < 10:
print("bla bla")
10 = distance between player and enemy
ramazan | 2022-09-02 08:41