gravity and animation

hi guys im learning python that im using for a game. i was wondering how to give your player or an object using python code. i have animated my player of him walking and i was wondering what the python code would be to play the animation while hes walking for ward of backward

hello, I think i have an answer:
(take into account that i am still learning myself)


import bge
c = bge.logic.getCurrentController()
o = c.owner

#get actuators
actuators = c.actuators

#get key input
wKey = bge.logic.keyboard.events[bge.events.WKEY]

#if w is pressed activate the first actuator
if wKey == 2:
   c.activate(actuators[0])
#if w key is unpressed, deactivate it
if wKey == 3:
   c.deactivate(actuators[0])


awesome thanks
wait isn’t this blender 2.49b code
im actually looking for the python 3.2 code using blender 2.57

No, this is definitely 2.5*

always trust agoose, he knows his stuff :smiley:

Haha, krystof :wink:

hmm ok thanks ill try out the code then