A timer for my actors question
DrGlickert
Member Posts: 1,135
Here's what I'm struggling with right this second;
I want a ball to continuously fly around the screen, however, only if it's hitting certain actors. So if it doesn't hit an actor then it should only last on screen for 5 seconds.
So if this ball is flying around and it hits another actor, how can I reset the timer before the ball get's destroyed?
This may be a simpler fix than I'm making it out to be...
I want a ball to continuously fly around the screen, however, only if it's hitting certain actors. So if it doesn't hit an actor then it should only last on screen for 5 seconds.
So if this ball is flying around and it hits another actor, how can I reset the timer before the ball get's destroyed?
This may be a simpler fix than I'm making it out to be...
Comments
Have a attribute called balldestroy set to 0, and a boolean called ballinplay or whatever set to false.
In the ball have a rule when the ball enters screen (or whenever you want the 5 second countdown to begin)change ballinplay to true.
Have another rule when ballinplay is true, change attribute balldestroy to balldestroy+1.
hen have another rule when the ball collides with whatever you want to reset the timer, change attribute ball destroy to 0. (so it will reset the timer but keep countin)
Have another rule when ball destroy =5 ,destroy ball, and change attribute balldestroy to 0 and change ballinplay to false.
Then whenever you introduce a new ball into your scene change ball in play to true to start your timer up again.
I don't want a static number in the timer, I want the timer to be able to increase with the ball's activity in the scene.
So if the ball's "doin' work" and "being productive" by hitting bricks, then I want the ball to stay. If it's not, then I want the ball to be destroyed.
That way each individual instance of the ball will have it's own timer.