12345678910111213141516171819202122232425262728293031323334353637383940 |
- import bge
- from bge import logic
- cont = bge.logic.getCurrentController()
- own = cont.owner
-
- #constants
- STANCE_SENS = 0.05
- STANCE = own["stance"]
- jumpstance = own['jump_stance']
- grindpos = own['grindpos']
- # use game object axis
- local = True
- try:
- #stance detection
- if own['ground'] == True and (own['grindpos'] != 'reg_board' or own['grindOld'] == False) and own['invert_on'] == False:
- #print("detect stance")
- LVX = own.localLinearVelocity.x
- if LVX > STANCE_SENS:
- STANCE = 1
-
- if LVX < (-STANCE_SENS):
- STANCE = 0
- except:
- print("no stance")
- if jumpstance == 3:
- if own["grindOld"] == 0:
- own["stance"] = STANCE
- else:
- if grindpos == "reg_5050":
- own["stance"] = STANCE
- else:
- STANCE = jumpstance
- own["stance"] = STANCE
- dict = bge.logic.globalDict #Get the global dictionary
- dict['stance'] = STANCE #Store the new score
- #print(STANCE)
- #stance = dict.get('stance') #Get the current score or the number 0
- #print(LVX)
- #print(STANCE)
|