Help with lists and for loopin'

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
Posts: 0
Joined: Wed Jun 06, 2012 7:30 pm
Location: Los Angeles

Help with lists and for loopin'

Post by 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


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

if bge.logic.KX_INPUT_JUST_ACTIVATED == []:

if qDirection == "forward":

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

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

def rotman(keyboard):

qDirection ([])

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

del [0].qDirection

elif qDirections[0] == "backward":

del [0].qDirection
P.P. Seeholzer

Post Reply