# Problem with movements script in BGE

I'm pretty new to the bge, which I'm using for a school project and right now I'm having a problem with my movements.py script. I know this question is quite 'noobish' but I just can't find the problem. The 'player' object is just a cube with character physics and actor enabled but won't move when I start the game simulation and press the different keys.

import bge

def main():

cont = bge.logic.getCurrentController()
player = cont.owner

keyboard = bge.logic.keyboard

if keyboard.events[bge.events.WKEY] == bge.logic.KX_INPUT_ACTIVE:
player.applyMovement((0, .2, 0), True)

if keyboard.events[bge.events.SKEY] == bge.logic.KX_INPUT_ACTIVE:
player.applyMovement((0,-.2, 0), True)

if keyboard.events[bge.events.AKEY] == bge.logic.KX_INPUT_ACTIVE:
player.applyMovement((-.2, 0, 0), True)

if keyboard.events[bge.events.DKEY] == bge.logic.KX_INPUT_ACTIVE:
player.applyMovement((.2, 0, 0), True)

main()

• Can you elaborate on what your problem is? "I'm having a problem with my script" does not really tell us anything. – David Mar 18 '17 at 23:36
• Yeah, sorry for that. Edited the question. My character won't move like he should with this script. Nothing happens at all. – Laurits Hofmeyer Mar 19 '17 at 0:16
• I made a quick scene using your script and the cube move fine. Make sure the Sensor running your script is always running. i.stack.imgur.com/Uv0Cr.png Connect an Always sensor to the Python controller and activate TRUE level triggering. – David Mar 19 '17 at 0:47
• Thanks, forgot about this one. Used BGE like 5 years ago so I couldn't remember small things like this. – Laurits Hofmeyer Mar 19 '17 at 9:48