Previous Thread  Next Thread

chat icon Help with lists and for loopin'

flippi13

Posted: Wed Jun 06, 2012 7:15 pm
Joined: 06 Jun 2012
Posts: 1
Hello All,

I am having an issue with some code in my game. The point of this code is to allow the player to press a button which causes the player obj. to rotate 180 degrees. Then with the press of the same button the player obj. rotates back around. I am using a list and a for loop to assign a direction. Then an "if" statement and a "for" loop.

Here is my code. If you have any questions please ask. This is my first time using a forum for coding and I would really appreciate the help.

Thank you

CODE:

Note : only half the condition is there for testing purposes.

if bge.logic.KX_INPUT_JUST_ACTIVATED == keyboard.events [bge.events.RIGHTCTRLKEY]:

if qDirection == "forward":

qlance.playAction("bRotate", 1, 60)


if bge.logic.KX_INPUT_JUST_ACTIVATED == keyboard.events [bge.events.RIGHTCTRLKEY]:
qlange.playAction("fRotate", 1, 60)



def rotman(keyboard):

qDirection ([])


for i in qDirection:
i, "forward"
if bge.logic.KX_INPUT_JUST_ACTIVATED == keyboard.events[bge.events.RIGHTCTRLKEY]:

del [0].qDirection
qDirection[0].append("backward")

elif qDirections[0] == "backward":

del [0].qDirection
qDirection[0].append("forward")
_________________
P.P. Seeholzer
flippicus(monkicus)
Reply with quote


 
Jump to:  
Powered by phpBB © 2001, 2005 phpBB Group