I’m new to python, my current project is a Sonic clone. I want the character to increase speed over time when a button is pressed then resets when let go. I experimented and I found no way to do this.
Sprint = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.LEFTSHIFTKEY]
speed = .1
jump_height = .1
if Sprint:
speed = .1+2 <-- This only makes it 2.1 but I want it to keep adding 2 as time passes.
main()
You have to take into account the behaviour of the sensor you use to trigger the python script above. The standard behaviour of a sensor is to fire only once (when the button is pressed for example). What you might need for the sensor is to fire continually.