![]() |
#3
|
|||
|
|||
I am sorry, but the reason why I didn't include much code is because everything works. The problem is, In the oncollide function there's a yield to pause time for 5 secs before calling the function default(). But for I keep getting errors on the use viztask, maybe it's because the function called is within the fuction using viztask.schedule. If so how do I implement the use of yield.waitTime in a callback oncollide function.
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) def Begin(): viztask.schedule(condition1()) |
|
|