WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-11-2016, 01:02 PM
emmy rando emmy rando is offline
Member
 
Join Date: Apr 2016
Posts: 3
Problem with viztask, callback, and oncollide

Hello, I am trying to use viztask to wait for at least 5 seconds before calling a function as seen below. I know you need to call condition 1 with viztask.schedule(condition1()), but with that I still get errors maybe it's because of the second function in it which i am using the yield call on. But I have tried using it with the callback but to no avail. Please any help will be appreciate and the oncollide function is not called anywhere else but in the function condition1.

def condition1():
#Code...........
.
.
.
#more code
def oncollide(e):
#Check if a ball collided with a duck
#code.............
if e.obj2 in ducks:
#code.............
e.obj2.execute(2)
#code.............
#Increment score
scoreLabel.score += 10
scoreLabel.message(str(scoreLabel.score))
panel.visible(True)
endPanel.visible(False)
op1PanelLabel6.label.color(viz.GREEN)
yield.waitTime(5)
default()

elif e.obj2 in ducks2:
#code.............
e.obj2.execute(2)
#code.............
#Increment score
scoreLabel.score += 15
scoreLabel.message(str(scoreLabel.score))
panel.visible(True)
endPanel.visible(False)
op1PanelLabel6.label.color(viz.GREEN)
yield.waitTime(5)
default()

elif e.obj2 in ducks3:
#code.............
e.obj2.execute(2)
#code.............
#Increment score
scoreLabel.score +=20
scoreLabel.message(str(scoreLabel.score))
panel.visible(True)
endPanel.visible(False)
op1PanelLabel6.label.color(viz.GREEN)
yield.waitTime(5)
default()

elif e.obj2 not in ducks or e.obj2 not in ducks2 or e.obj2 not in ducks3 :
#code.............

#code.............
viz.callback(viz.COLLIDE_BEGIN_EVENT,oncollide)
Reply With Quote
 

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:46 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC