0 votes

What I wanna do is,
-Damage a certain amount of enemies in a hitbox

For example, there are 5 'enemies' inside the 'hitbox' and if I press 'attack' it'll only damage 1 of the enemies inside the 'hitbox'.

What I have right now is that if I pressed 'attack I would 'damage' all of the 'enemies' in the 'hitbox'. I don't know how to make it so I could 'damage' only 1 'enemie' per attack. Is there a way to do this?

in Engine by (45 points)

1 Answer

+1 vote
Best answer

break or return after a certain amount of enemies.

by (8,528 points)
selected by

Yes, it worked. But what if I wanna make it so the 'enemies' with the lowest 'life' gets 'damaged'.

Sort the enemies by hp and choose the lowest.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.