123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- import bge
-
-
- def main():
-
- cont = bge.logic.getCurrentController()
- scene = bge.logic.getCurrentScene()
- own = cont.owner
- dict = bge.logic.globalDict
-
- skater = scene.objects["Char4"]
- deck = scene.objects["deck"]
- trucks = scene.objects["trucks"]
-
- try:
- pause_state = dict['npause']
- last_pause = dict['last_npause']
- except:
- dict['npause'] = 0
- dict['last_npause'] = 0
- pause_state = 0
- last_pause = 0
-
-
- def printplaying():
- splaying_layers = "S: "
- playing_layers = "D: "
- tplaying_layers = "T: "
- for x in range(1000):
- if skater.isPlayingAction(x):
- #if trucks.isPlayingAction(x):
- #if skater.isPlayingAction(x):
- splaying_layers += str(x)
- splaying_layers += " "
- if deck.isPlayingAction(x):
- #if trucks.isPlayingAction(x):
- #if skater.isPlayingAction(x):
- playing_layers += str(x)
- playing_layers += " "
- if trucks.isPlayingAction(x):
- #if trucks.isPlayingAction(x):
- #if skater.isPlayingAction(x):
- tplaying_layers += str(x)
- tplaying_layers += " "
- print(splaying_layers, playing_layers, tplaying_layers)
-
-
- #switch pause state
- if dict['stBut'] == True and dict['last_stBut'] == False:
- if pause_state == 0:
- pause_state = 1
- else:
- pause_state = 0
- dict['npause'] = pause_state
-
- #enter pause
- if pause_state == 1 and last_pause == 0:
- own.suspendDynamics()
- own['pre_pause_linvel'] = [own['linvelx'], own['linVely'], 0]
- own.setLinearVelocity([0,0,0],1)
- cont.activate(cont.actuators['empty'])
- cont.activate(cont.actuators['add_overlay'])
- printplaying()
-
- if pause_state == 1:
- layer = 450
- if skater.isPlayingAction(layer):
- skater.stopAction(layer)
- if deck.isPlayingAction(layer):
- deck.stopAction(layer)
- if trucks.isPlayingAction(layer):
- trucks.stopAction(layer)
- layer = 460
- if skater.isPlayingAction(layer):
- skater.stopAction(layer)
- if deck.isPlayingAction(layer):
- deck.stopAction(layer)
- if trucks.isPlayingAction(layer):
- trucks.stopAction(layer)
- layer = 470
- if skater.isPlayingAction(layer):
- skater.stopAction(layer)
- if deck.isPlayingAction(layer):
- deck.stopAction(layer)
- if trucks.isPlayingAction(layer):
- trucks.stopAction(layer)
-
-
-
-
- #exit pause
- if pause_state == 0 and last_pause == 1:
- #print("unpause")
- own.restoreDynamics()
- #own.setlinearVelocity([0,0,0],1]
- cont.activate(cont.actuators['roll'])
- #print("pre_pause_linvel = ", own['pre_pause_linvel'])
- try:
- own.setLinearVelocity(own['pre_pause_linvel'], 1)
- except:
- pass
- cont.activate(cont.actuators['remove_overlay'])
- #print(pause_state)
- dict['last_npause'] = pause_state
-
- main()
|