Movement Script - Need help changing logic bricks to python script.

Translate my logic bricks to python please :smiley:
I made a really neat system for movement.
It is similar to the way your typing cursor moves in that you press a key and it moves, but if you hold the key for a little, it moves really fast and places a bunch of letters.
I’ve used logic bricks to move my cube this way but logic bricks aren’t efficient and it would take forever to duplicate this technique or manipulate it.
If this has been done before in python and someone knows where i can find the script please let me know. Alternatively, i will explain my logic bricks a little more thoroughly just in case anyone is kind enough to open the blend and translate my system from logic Bricks to python.
I have a simple key sensor for w a s and d with tap that moves the cube one space when pressed. The tap keyboard sensors also assign my timer to 0. I’ve got a property sensor for my timer property that is inverted and on an interval, it gives off a positive pulse once the time limit has been reached telling the cube to go into fast mode. Then i have a sensor for all of those without the tap. I have a delay sensor that determines how fast the block moves once it is in fast mode.
I combine the delay, sustained keyboard sensor, and timer to create the fast moving effect.
I hope this makes sense, its really not too complicated and I know there is a simpler way to do it in python but i’m just not very good with python syntax and i don’t know what tools are at my hand with python. Thanks in advance, sorry for such a long post but i didn’t know how else to explain my problem.


Slow then Fast Movement.blend (398 KB)

I’m not good at python, so this is probably wrong but is this sorta what you were looking for?


Slow then Fast Movement.blend (377 KB)

Thank you so much scuba! This is exactly what i was looking for! Thanks for taking time to help :slight_smile:

No problem, I’m glad it works, feel free to mess with the times to get it to feel the way you want