12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import bge
- from bge import logic
- cont = bge.logic.getCurrentController()
- own = cont.owner
-
-
- #scene = bge.logic.getCurrentScene()
- #control_bottom = scene.objects['control_bottom']
- #grindTouch = control_bottom.sensors['grindCol_bottom']
- #edge = 0
- #try:
- # if 'edge' in grindTouch.hitObject:
- # print('Edge')
- # edge = 1
- #except:
- # pass
-
- #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)
|