Spawn and Gone using two timers

I want the enemy to spawn the trap every 0.5 second and it will gone in 1.5 all traps that will spawn must have their own timer so that they will gone when their own timer reaches 1.5 and the enemy keeps spawning every 0.5 second.

This is pseudo logic:

Begin of the scene
Action: Reset timer “enemytrap”
Action: Pause timer “enemytrap”

In other Event you need to somehow unpause “enemytrap”

In other Event
Condition: Foreach enemy
Condition: if timer “enemytrap” greater than 0.5
Action: Create trap at position X/Y
Action: Reset trap timer “placed”

In other event check the timer
Condition: Foreach trap
Condition: if timer trap “placed” greater than 1.5
Action: delete trap

1 Like

I try that but I don’t put for each enemy because it’s a boss. The problem is the enemy must continuously spawn trap every 0.5 sec. so I need to reset the timer. But if I do that, The timer of trap “placed” will never reach because the timer “enemytrap” will reset every 0.5 and the timer “placed” will be reset too. The goal is to have the boss spawn traps at 0.5 continuously while each of the trap have their own timer that will delete itself when it reach 1.5s. It’s like trap with a lifespan of 1.5s.

edit:

the for each loop is not needed, if you use object timers:

1 Like

I forgot the object timer. It works perfectly now, thanks.