Movement script

I got a problem with my movement script. When i rotate with my mouselook scipt. the cube rotates as it should. but when i try to move forward it only goes the original y axis. will post a blend example so you understand

Also got a problem when i jump. The problem is written in the blend file.

PytonProblem.blend (414 KB)

cont = GameLogic.getCurrentController()

own = cont.owner

SENSORS

fwd = cont.sensors[“fwd”]
bwd = cont.sensors[“bwd”]
left = cont.sensors[“left”]
right = cont.sensors[“right”]
jump = cont.sensors[“jump”]
ground = cont.sensors[“ground”] # collision sensor linket to the ground by a property

ACTUATORS

move = cont.actuators[“move”]

SPEED

movement = [0,0,0]
speed = 6
jspeed = 150

EVENT

if fwd.positive:
movement[1] = speed
elif bwd.positive:
movement[1] = -speed

if left.positive:
movement[0] = -speed
elif right.positive:
movement[0] = speed

if jump.positive and ground.positive:
movement[2] = jspeed

move.force = movement

cont.activate(move)


i hope it help you !


Is this a standalone script or shall i change my scripy with this parts?

uh, no, it’s much more simple, I fixed it in literally 1 second, no kidding. All you have to do is enable that “L” beside the servo motion values. Easy, done, finished. Good luck.

Edit: The L means the cube moves on the local axis. Without the L, the cube is moving on the global Y axis and not it’s local.

omg was it that simple? :open_mouth: Damn! Thx :smiley: whouldent come up too that myself :slight_smile: But do you know how to fix the jumping stuff on the wall?

what’s the problem with the jumping?

I had some problem that i could jump up on the wall and stay there :stuck_out_tongue: but i think i have fixed it now :slight_smile: So next project is to make my character go up on stairs and ladders :slight_smile: