python* force actuator problem
hi, Im having a problem, Im trying to learn python, so I decided to make a movement script. The walking/running works as it should, the jumping works as it should, most times. Sometimes it just continues up, like if the force added when you tap space continues. And the same thing happens when you “climb”, touching a plane and holding space.
heres the code:
cont = GameLogic.getCurrentController()
obj = cont.owner
forward = cont.getSensor("forward")
back = cont.getSensor("back")
right = cont.getSensor("right")
left = cont.getSensor("left")
jump = cont.getSensor("jump")
sprint = cont.getSensor("sprint")
touchGround = cont.getSensor("touchGround")
touchNothing = cont.getSensor("touchNothing")
ledge = cont.getSensor('ledge')
climb = cont.getSensor('climb')
#Actuators
Move = cont.getActuator("move")
#sprint speed
SSpeed = 30000
#forward speed
FSpeed = 10000
#default speed
Speed = 6000
LR = 0
FB = 0
up = -10000
if sprint.isPositive():
FSpeed = SSpeed
else:
FSpeed = 10000
if touchGround.isPositive():
if obj['jumpTimer'] > 0.2:
if jump.isPositive():
up = 600000
obj['jumpTimer'] = 0
if ledge.isPositive():
if climb.isPositive():
if not touchGround.isPositive():
up = 12000
if touchNothing.isPositive():
if left.isPositive():
LR = -Speed
elif right.isPositive():
LR = Speed
if back.isPositive():
FB = -Speed
elif forward.isPositive():
FB = FSpeed
Move.setForce(LR, FB, up, True)
GameLogic.addActiveActuator(Move, True)
anyone know whats wrong?
Attachments
movement.blend (528 KB)