View Single Post
  #3  
Old 08-25-2011, 03:32 PM
Sakiot Sakiot is offline
Member
 
Join Date: Aug 2011
Posts: 2
Thank you very much, actually the use of a global variable cross my mind but... it didnīt work... this is my code with the global variable "estadoPuerta" (door status)

estadoPuerta = 0 #Global Variable

def clickIzquierdo(): #Left button action
objeto = viz.pick()
if objeto == puerta:
if estadoPuerta == 0:
abrePuerta()
else:
if estadoPuerta == 1:
cierraPuerta()

vizact.onmousedown(viz.MOUSEBUTTON_LEFT,clickIzqui erdo)

def abrePuerta(): #Open door
puerta.runAction(vizact.spinTo(euler = [-90,0,0], speed = 10.0)) # Euler(Y,X,Z)
estadoPuerta = 1
sonido_abre.play() #Asignar sonido al picarle al boton de la puerta

vizact.onkeydown("x",abrePuerta)

def cierraPuerta(): #Close door
puerta.runAction(vizact.spinTo(euler = [0,0,0], speed = 10.0)) # Euler(Y,X,Z)
estadoPuerta = 0
sonido_cierra.play()

vizact.onkeydown("z",cierraPuerta)

I am sure that my problem is the "clickIzquierdo" section and the use of IF and ELSE... Itīs my first time with the program and I still don't know so much (I have worked with C# and C++ and the logic is the same but... the way of writing it is different and thats my problem... I think).

Thank you for your attention =D
Reply With Quote