View Single Post
  #1  
Old 11-18-2015, 08:56 AM
Qiliang He Qiliang He is offline
Member
 
Join Date: Mar 2014
Posts: 24
Yield until joystick is deflected by a certain degree

I've read the example scripts of yield statement, but I don't know how to realize this function: The function won't go to the next line until the user deflected the joystick beyond a certain degree. Here's my code:

HTML Code:
def pointing_task(joystick)
      some codes
      return angle,result  ##result is false means the joystick isn't deflected  beyond a certain threshold

def start_pointing():			
      angle,result = pointing_task(joystick)
      yield result == True ??
      some codes

viztask.schedule(start_pointing())
My question is, how to use the yield statement to pause the program until a user deflect the joystick beyond a certain degree (result == True) and if he/she does, execute the following codes.

Thanks a lot!
Reply With Quote