Help with lists and for loopin'

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

flippi13
Posts: 1
Joined: Wed Jun 06, 2012 7:30 pm
Location: Los Angeles

Help with lists and for loopin'

Postby flippi13 » Wed Jun 06, 2012 8:15 pm

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)

Return to “Python”

Who is online

Users browsing this forum: No registered users and 1 guest