How to make it so I can 'damage' a certain amount of 'enemies' in an area?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Jan Gabriel

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?

:bust_in_silhouette: Reply From: exuin

break or return after a certain amount of enemies.

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

Jan Gabriel | 2022-05-29 07:19

Sort the enemies by hp and choose the lowest.

exuin | 2022-05-29 13:18