delay controller?

is there some python script out there that would allow me(for example) to use a keyboard sensor and then use the py script (which would be a delay) and then have a motion kick in after the delay?? this would be a life saver!

You don’t need a python script for that (even though it’s probably at the same level of difficultly as using logic bricks).

There’s a type of sensor called “Delay”, it’s pretty self explanatory to use. Just connect it to an AND controller along with the keyboard sensor, set the settings and you’re good to go!

i believe that is the delay sensor your talking about. what i need is a delay controller.

thanks for replying though. :slight_smile:

Why do you need a controller specifically? Could you specify because if all you’re doing is delaying something for a little bit, it’s best to go with the delay sensor than with python.

EDIT:
Look, there’s an example with both python and logic bricks. They both work exactly the same way. (the one with python stops a little after the one with logic bricks) I used properties as a delay timer (the delay sensor didn’t work how I thought it did). Nonetheless, both cubes work in the same way, except the one made with logic bricks runs faster than the one with python.

Logic bricks allow your game to run faster. The difference is very small when dealing with two cubes but when you get deep into a project, you’ll notice it makes a big difference in FPS performance.

Cube left = python
Cube right = logic bricks

test.blend (424 KB)

Use W to move and wait for the “kick”.
If you want to change the delay for the python cube, in the script called “delay.py” change the value of “wait_time”. For logic bricks, change the property on the cube called “max_delay”.

ok, so this is moving all the time, but it does not have to,

this is a logic for loop that is 10 frames,

you can get rid of the motions that are driven by the property interval sensor, and just keep the last one,

if count = 10 ----------and------------Do whatever

so you can make a delay, etc, and even trigger things leading up to the delay,

the script goes

x=0
if X>1 While X<10 then X = X+1
if X=10 , do whatever, X=0;

(Note) you can use a property added to X instead of 1 or -1, and change the property based on conditions, like X=X*X etc

Attachments

CodeItAll.blend (522 KB)

thank you guys! I’ve got a solution now. :slight_smile: