Hello there, not too long ago I posted about help for too much logic, and was told that python would be the best route for fixing my problem. So I’ve decided to learn python! I tried typing a simple movement script from what I remember from like a year and a half ago, and its not quite working.
heres the code.
import bgeg = bge.logic
o=g.getCurrentController().owner
cont = bge.logic.getCurrentController()
own = cont.owner
move = cont.actuators["move"]
up = cont.sensors["up"]
down = cont.sensors["down"]
left = cont.sensors["left"]
right = cont.sensors["right"]
if up.positive:
move.dLoc [0.0, 0.0, 0.02]
cont.activate(move)
if down.positive:
move.dLoc [0.0, 0.0, -0.02]
cont.activate(move)
if left.positive:
move.dLoc [-0.02, 0.0, 0.0]
cont.activate(move)
if right.positive:
move.dLoc [0.02, 0.0, 0.0]
cont.activate(move)
So here are my questions.
- Why isnt my character moving?
- Is it possible to move other objects through the script?
- How would I use a property? like “if property [name] = 0, then do this” and “set property [name] = 1”
Thanks in advanced for any help!