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 870B

1234567891011121314151617181920212223242526272829
  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. #if own['ground'] == True and (own['grindOld'] == False) and own['invert_on'] == False:
  15. #print("detect stance")
  16. LVX = own.localLinearVelocity.x
  17. if LVX > STANCE_SENS:
  18. STANCE = 1
  19. if LVX < (-STANCE_SENS):
  20. STANCE = 0
  21. except:
  22. print("no stance")
  23. own["stance"] = STANCE
  24. dict = bge.logic.globalDict
  25. dict['stance'] = STANCE