djdesmangles
05-31-2007, 07:40 AM
Hello Wizards,
I've some codes that doesn't work... If I want a delay of 2 seconds before playing a sound:
# my variables
# wait for 2 seconds before playing track
def onTimer(num):
Track1.play()
viz.callback(viz.TIMER_EVENT, onTimer)
viz.starttimer(0, 2)
- If I want to listening to my joystick event:
# add a joystick and listen
joy = vizjoy.add()
def joystickListener(num):
y = joy.getPosition[1]
x = joy.getPosition[0]
if math.fabs(y) > 0.2:
viz.move(0,0,-y*0.1)
if math.fabs(x) > 0.2:
viz.move(x*0.1,0,0)
viz.callback(viz.TIMER_EVENT, joystickListener)
viz.starttimer(1, 0.001, viz.FOREVER)
The problem is that only the joystick fonction will work. The sound will never be played. If I change the first fonction to something that requires an infinite loop, the two callbacks will work !!!
I don't undestand why I can't have a delay while starting my joystick...
Thanks,
viz.FOREVER,
D.
I've some codes that doesn't work... If I want a delay of 2 seconds before playing a sound:
# my variables
# wait for 2 seconds before playing track
def onTimer(num):
Track1.play()
viz.callback(viz.TIMER_EVENT, onTimer)
viz.starttimer(0, 2)
- If I want to listening to my joystick event:
# add a joystick and listen
joy = vizjoy.add()
def joystickListener(num):
y = joy.getPosition[1]
x = joy.getPosition[0]
if math.fabs(y) > 0.2:
viz.move(0,0,-y*0.1)
if math.fabs(x) > 0.2:
viz.move(x*0.1,0,0)
viz.callback(viz.TIMER_EVENT, joystickListener)
viz.starttimer(1, 0.001, viz.FOREVER)
The problem is that only the joystick fonction will work. The sound will never be played. If I change the first fonction to something that requires an infinite loop, the two callbacks will work !!!
I don't undestand why I can't have a delay while starting my joystick...
Thanks,
viz.FOREVER,
D.