Restart time (timer) property

I guys. In my game i want restart the timer the game. For example i have a sphere with a collision sensor, and collides a new floor the time restarts.I know how to do that. But i dont know then how to make timer intervals. for example. the sphere collides and 5 seconds later something happen (some objects end with a endObject). 10 seconds later another objects ends…And so consecutively.

You need a sequencer script or tons of logic bricks. You can use Property sensor to check if timer value is in range from 5.0 to 7.0 and then activate some actuator. In script you can use if statements to check if timer value is more than 5 and then trigger something.

if obj[‘timer’] >= 5.0:
scene.endObjec() <— this clears the object or you can add object with scene.addObject(obj,where,timelimit)

i tried that… i dont work like i want…

. I did this… if msg1.positive. cont.activate(Property). it restarts the timer. but the if i do timeAmount >= 5 -> object.endObject() … doesnt work

You think we can see a .blend? Kind of hard to see what you are trying to do here. A simple

if own["timer"] &gt;= 5:

should work just fine.!CJpXGbbS!1lorWY2-mTCt-OO91ILXc427cgP0LPoncbtPtut0tPQ
I hope you understand the idea… go to red color… and you see the time restarts… but then i dont know how to “control” the time to work in that… to do what i want… :confused:

How do you want it to work ? Upload the blend file tell me how do you want it to work and I will try to fix it if I can figure it out.

State “waiting for collision”:
collision sensor -> switch state to “waiting”

State “waiting”
Always [level] -> Property assign timer = 0
Property sensor time > 5 -> do something

You forgot to mention what your “later” relates to. So I assume you mean the collision
State “waiting”
Property sensor time > 10 -> another objects ends

Can you do that in the file that i upload. is in the mega link. because i dont know very well how to work with the states :confused:

Just say what you want to happen and I’ll do it. When one sphere is touching the plane you want what to happen ? I need a detailed description. From that code I can’t figure out what are you trying to do there. Forget about the code just give description how you want things to happen.

Like this ? After 5 seconds the plane to clear ?


ExampleEdit 001.blend (136 KB)ExampleEdit 002.blend (137 KB)

. i want when the sphere colides with red cube on the corner… timer restarts and 5 seconds later. the plane ends…


ExampleEdit 002.blend (135 KB)

Ok here is the result. I used state machine to sequence the entire thing. No script only logic bricks. When Player ball collides with red cube it’s switching state to state-2 and it’s resetting the timer to zero than switching state to state-3 where it’s waiting for the timer to reach 5 seconds again and clears object.


ExampleEdit 003.blend (137 KB)

you are not understanding… maybe is because my english… i changed the colors… because i think you are make confusion. I want when i move the sphere for collides with RED cube. the time restarts five seconds later after the collision with the red cube…and then the green plane ends ExampleEdit 003.blend (134 KB)

Ok try this one maybe this one is doing it how you want.


ExampleEdit 004.blend (135 KB)

YEESSSS!! Thanks a lot… its that. later i will try apply this on my game… :slight_smile:

Hey show me the precious game. What game are you making ? LOL

Its very simple. i hope finish maybe in july, or september. is final project for my course. when finished i will post here. Its a liitle bit hard for me sometimes, because i had a subject in blender but just make some a little animation… make a game is different and harder…

Can i apply this for more “green planes”?? like 5 seconds later, dies another plane, 10 seconds dies another,???

Can i apply this for more “green planes”?? like 5 seconds later, dies another plane, 10 seconds dies another,???

Yes you can apply that either with menu command: Object-Game-CopyLogicBricks or turn it into a script function and reuse that function everywhere but you have to set state on red cube back to state1 because right now is at state3 after green plane clears/ends.

Yes i did that :slight_smile: