their is a special move(powerBall) needed to hit all enemies

this power ball needs to hit all the enemies… let’s say if it hit a enemy it should subtract 10 from the health, so if add “trigger once while true” it just attack one enemies (standing in front of all) at a time and if don’t add “trigger once while true” then it takes all the health. what to do?

Maybe you can do it manually with variables, I’m not sure if something like this would work (it’s a kind of pseudo code, but I think you can understand):

On scene loaded: scene variable decrease_health=1

if power_ball in collision with enemy and decrease_health=1 then:
enemy.health = enemy.health-10
decrease_health = 0

if power_ball not in collision with enemy
decrease_health = 1

So unless I got something wrong here, enemy health should decrease only once, and then the decreasing will get deactivated. But after the ball is no longer in collision with enemy, health decreasing will get activated again (so it can decrease health from the next enemy).

P.S. This wouldn’t work properly with complex collision shapes (e.g. polygons) as collision could happen a few times while the ball is passing through the enemy. It should work with spherical collision shapes best, and maybe with box collision shape as well.

:mrgreen: thanks man you solution gave me an idea which might work. I think what you are telling might not do exactly what I want, but thank you because it gave me a similar Idea, I mean to say I understand what you are trying to explain. :smiley:

I used object variable instead of scene! because the powerball might be big enough to be colliding with multiple enemies at the same time. So it wont work!