Character movemente script - Help

Edited, all below.

i managed to do somefondamental corrections by my one, but I need help now to make it perfect

This is the code applied to the external-bound, th eone actually controling the movements.

g = GameLogic
c = g.getCurrentController()
o = c.getOwner()

W = c.getSensor(“W”)
A = c.getSensor(“A”)
D = c.getSensor(“D”)

def RunSpeed():

Direction = c.getActuator("Direction")
Direction.setLinearVelocity(0,-6.0,0,1)
g.addActiveActuator(Direction,1)

def Stationary():

g.addActiveActuator(c.getActuator("Direction"),0)

def LeftRot():

Rotation = c.getActuator("Rotation")
Rotation.setAngularVelocity(0,0,2,1)
g.addActiveActuator(Rotation,1)

def RightRot():

Rotation = c.getActuator("Rotation")
Rotation.setAngularVelocity(0,0,-2,1)
g.addActiveActuator(Rotation,1)

def NoRot():

g.addActiveActuator(c.getActuator("Rotation"),0)

if W.isPositive():

RunSpeed()

else:

Stationary()

if A.isPositive():

LeftRot()

elif D.isPositive():

RightRot()

else:

NoRot()

This is the code applide to the armature

g = GameLogic
c = g.getCurrentController()
o = c.getOwner()

W = c.getSensor(“W”)
A = c.getSensor(“A”)
D = c.getSensor(“D”)

def RunAnim():

g.addActiveActuator(c.getActuator("run_legcycle"),1)
g.addActiveActuator(c.getActuator("run_armcycle"),1)

def TurnleftAnim():

g.addActiveActuator(c.getActuator("turnleft"),1)

def TurnrightAnim():

g.addActiveActuator(c.getActuator("turnright"),1)

def NoAnim():
g.addActiveActuator(c.getActuator(“run_legcycle”),0)
g.addActiveActuator(c.getActuator(“run_armcycle”),0)
g.addActiveActuator(c.getActuator(“turnleft”),0)
g.addActiveActuator(c.getActuator(“turnright”),0)

if W.isPositive():

RunAnim()

elif A.isPositive():

TurnleftAnim()

elif D.isPositive():

TurnrightAnim()

else:
NoAnim()
The original script was taken from blending online
I need to insert walking back.

I most need help for this folowing thing:

If I press S (down-arrow) I want my character to walk backwards for, let assume, 2 seconds and then automatically rotating itself and continue running normally but in the same direction.) This can’t be in the same animation, if not he will continue rotating at every loop. Or is there a way in python to make an animation play from start to end for some time and then continue playing from a given frame o the end?

I’d like this “changing” movements even with the left and right arrow (A and D). Yes, I want to eliminate the rotation that is on now when the char is not running and make it possible only pressing another key with A and D (like Shift or Ctrl), if not, pressing A and D will make him run in that direction. It this will be to difficult I can eliminate definetely the character rotation movement, since the camera can still rotate around him.

This the third point. I need a script so that the camera will move around the player only when this is not moving, instead when he’s moving I only want the char to rotate (the rotation while running to change direction). In the original template of aandria this was possible, but I’ve deleted quite all of that template, except for the camera setting and I losed this option too.

If you think I should arrange the control in another way, fell free to tell me.

This the file if you want to take a look and understand the scripts and my questions better.
http://www.pasteall.org/blend/596 6-7MB

The idle (with a lot of variations) wil be in another script, jumppig with all of his issues in a third script, the “real” actions, such as punches, kiks will be in another script too. I don’t still know how I will set the weapons.

No idea? Any comment will be appreciated

Aside from syntax errors, It doesnt look like your using whitespace properly here. Maybe you ought to go and learn a bit more about python before attempting something like this.

You will certainly perdon my english, since I don’t usually speak english

You need to learn syntax (Such as when to indent anything after an “if” statement that you want affected by that). Here’s the movement script I usually use (And unfortunately the tabs don’t show up, so wherever there should be a tab I’ll mark it with a ):

c = GameLogic.getCurrentController()

#These are keyboard sensors with the keys you want selected in them
W = c.sensors[“W”].positive
A = c.sensors[“A”].positive
S = c.sensors[“S”].positive
D = c.sensors[“D”].positive

#This is a motion actuator with all blank values, Make sure the “L” is selected
Move = c.actuators[“Move”]

#Necessary variables:
FB = 0.0
LR = 0.0

#Set these variables whenever the appropriate key is pressed (The tabs are important)

if W:
\FB = 1
if S:
\FB = -1
if A:
\LR = -1
if D:
\LR = 1

#Assign these variables to the actuator and activate it
Move.dLoc = (LR, FB, 0.0)
c.activate(Move)

And the animations can be applied similarly.
Good Luck!

I misunderstood you before. Can you tell me the other syntax errors?