Shuvit game master repo. http://shuvit.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

stance.py 809B

12345678910111213141516171819202122232425262728
  1. import bge
  2. from bge import logic
  3. def main(cont):
  4. own = cont.owner
  5. STANCE_SENS = 0.05
  6. STANCE = own["stance"]
  7. jumpstance = own['jump_stance']
  8. grindpos = own['grindpos']
  9. # use game object axis
  10. local = True
  11. try:
  12. #stance detection
  13. if own['ground'] == True and (own['grindpos'] != 'reg_board' or own['grindOld'] == False) and own['invert_on'] == False:
  14. #print("detect stance")
  15. LVX = own.localLinearVelocity.x
  16. if LVX > STANCE_SENS:
  17. STANCE = 1
  18. if LVX < (-STANCE_SENS):
  19. STANCE = 0
  20. except:
  21. print("no stance")
  22. own["stance"] = STANCE
  23. dict = bge.logic.globalDict #Get the global dictionary
  24. dict['stance'] = STANCE #Store the new score