Greetings:
I am having a python script problem, i use this code
import GameLogic as g
control=g.getCurrentController()
objeto=control.getOwner()
actores=control.getActuators()
sensores=control.getSensors()
aX=actores[0]
bX=sensores[0]
if bX.isPositive():
random=(int) (g.getRandomFloat()*10)
if random>7 | random==0:
while random>7:
random=(int)(g.getRandomFloat()*10)
if random==1:
aX.setObject("Box1")
elif random==2:
aX.setObject("Tri1")
elif random==3:
aX.setObject("LL1")
elif random==4:
aX.setObject("SR1")
elif random==5:
aX.setObject("LR1")
elif random==6:
aX.setObject("Linea1")
else:
aX.setObject("SL1")
g.addActiveActuator(aX,1)
to randomize the piece to add in a tetris like game, i have a Message sensor and a EditObject actuator, the message is send whenever a piece touches the floor, the problem is that it allways adds two pieces instead of one
Any ideas on how to fix this?
Edited::
Changed if bx: for if bx.isPositive()