Ok so I have a python question.
I set up a script to make the character run, walk, and jump. Now what I want is to set it up so that if he is running (up arrow) then when you jump, if you let go of the up arrow in air he will continue moving forward at the same speed until he hits the ground. So basicly I want him to retain the speed at which he was moving on the ground, whenever he is not touching the ground.
here is the script:
import GameLogic as gl cont = gl.getCurrentController() own = cont.getOwner() up = cont.getSensor("up") right = cont.getSensor("right") left = cont.getSensor("left") motion = cont.getActuator("motion") walk = cont.getSensor("shift") space = cont.getSensor("space") touch = cont.getSensor("touch") ray = cont.getSensor("forward_ray") and cont.getSensor("forward_ray1") speed = 0.01 jumpspeed = 12 rotspeed = 0.04 move = 0 jump = 0 rotate = 0 if space.isPositive() and touch.isPositive(): jump = jumpspeed if walk.isPositive():speed = 0.06 else: speed = 0.20 if ray.isPositive():speed = 0.01 if up.isPositive():move = speed if right.isPositive():rotate = -rotspeed if left.isPositive():rotate = rotspeed motion.setDLoc(0,move,0,1) motion.setDRot(0,0,rotate,1) motion.setLinearVelocity(0,0,jump,0) gl.addActiveActuator(motion, 1)