View Single Post
  #2  
Old 07-20-2009, 09:54 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
There seems to be a problem with your current code. The while loop inside your game task is not yielding. This will probably cause the graphics loop to freeze. It seems like there should be a yield None statement at the end of the loop.

Regarding your original question. You can setup a simple callback function that restarts the game task when the 'r' key is pressed. Example:
Code:
def ResetGame():
	global myTask
	myTask.kill() # Kill existing task
	myTask = viztask.schedule( game() ) # Create new game task
	
vizact.onkeydown('r',ResetGame)
Reply With Quote