Hi! i did a script to open and close a drawer, with one clic in any part of the drawer it opens and with the next clic it closes. It works but i can’t show this to my client because many times it doesn’t work.
I have the camera with an Always sensor and the drawer with a Mouse over sensor and a Left Button sensor, all linked to a python script .
The script is very simple:
c=GameLogic.getCurrentController()
o=c.getOwner()
sens = c.getSensor (“sens”) #Left Button
sens1=c.getSensor(“sens1”) #Mouse Over
#closed is an integer Property inicialized=0
if sens.isPositive() and sens1.isPositive and (o.closed==0)
o.setPosition([6.074, 3.721, 0.848])
o.closed=1
else
if sens.isPositive() and sens1.isPositive and (o.closed==1)
o.setPosition([6.074, 4.216, 0.848])
o.closed=0
It works but not always, sometimes i click the drawer and nothing happens, other times i have to click it 4 times for it to move, other times it moves but blinking, and so on.
So the user can’t trust on this, how can I improve this???