Browse Source

loading restored5

shuvit 6 years ago
parent
commit
a3e8c810b6
3 changed files with 706 additions and 615 deletions
  1. 531
    529
      Manager.py
  2. 106
    0
      npause.py
  3. 69
    86
      pause.py

+ 531
- 529
Manager.py View File

@@ -1,548 +1,550 @@
1
-#"""
2
-#Modified BGE Gameplay Recorder Version 2
3
-#originally written by Nicholas Anderson, aka Red Frost Games.
4
-#"""
1
+def main():
5 2
 
6
-#####Tweakables###############
7
-#Watch out! These numbers might bite!
8
-frame_rate = 60    #Set this to the framerate of your game.
9
-optimization = 1    #An integer, must be at least 1! Higher value will make a smaller saved file size. I do not reccomend setting it to anything other than 1 though.
10
-recording_cutoff = 7300 #3600   #Frames at which the oldest recorded frame will be deleted. 0 is no cutoff.
11
-recorder_state = 1   #This is the main state of the recorder object. State will be reverted to this value when the user breaks out of the playback.
12
-allow_playback_break = True   #Allow the player to resume playing from the position in the recording.
13
-#####Sensor names#############
14
-record_sensor = "Record"
15
-save_recording_sensor = "Save"
16
-load_recording_sensor = "Load"
17
-track_left_sensor = "Left"
18
-track_right_sensor = "Right"
19
-break_sensor = "Break"
20
-##############################
3
+    #"""
4
+    #Modified BGE Gameplay Recorder Version 2
5
+    #originally written by Nicholas Anderson, aka Red Frost Games.
6
+    #"""
21 7
 
22
-from bge import logic
23
-import Record
24
-import SortData
8
+    #####Tweakables###############
9
+    #Watch out! These numbers might bite!
10
+    frame_rate = 60    #Set this to the framerate of your game.
11
+    optimization = 1    #An integer, must be at least 1! Higher value will make a smaller saved file size. I do not reccomend setting it to anything other than 1 though.
12
+    recording_cutoff = 7300 #3600   #Frames at which the oldest recorded frame will be deleted. 0 is no cutoff.
13
+    recorder_state = 1   #This is the main state of the recorder object. State will be reverted to this value when the user breaks out of the playback.
14
+    allow_playback_break = True   #Allow the player to resume playing from the position in the recording.
15
+    #####Sensor names#############
16
+    record_sensor = "Record"
17
+    save_recording_sensor = "Save"
18
+    load_recording_sensor = "Load"
19
+    track_left_sensor = "Left"
20
+    track_right_sensor = "Right"
21
+    break_sensor = "Break"
22
+    ##############################
25 23
 
26
-cont = logic.getCurrentController()
27
-own = cont.owner
24
+    from bge import logic
25
+    import Record
26
+    import SortData
28 27
 
29
-cont.sensors[record_sensor].skippedTicks = optimization
30
-dict = logic.globalDict
28
+    cont = logic.getCurrentController()
29
+    own = cont.owner
31 30
 
32
-#dict['recorder_on'] = recorder_on
33
-recorder_on = dict.get('recorder_on')
34
-own['recorder_on'] = recorder_on
35
-#print("recorder on: ", recorder_on) 
31
+    cont.sensors[record_sensor].skippedTicks = optimization
32
+    dict = logic.globalDict
36 33
 
37
-if recorder_on == 1:
38
-    #----
39
-    scene = logic.getCurrentScene()
40
-    scene_list = logic.getSceneList()
41
-    camList = scene.cameras
42
-    followcam = camList["followcam"]
43
-    freecam = camList["freecam"]
44
-    skater = scene.objects["Char4"]
45
-    cube = scene.objects["control_cube.002"]
46
-    deck = scene.objects["deck"]
47
-    trucks = scene.objects["trucks"]
48
-    replay_cam_axis = own['replay_cam_axis']
49
-    cam = own.actuators['Camera']
50
-    #----
51
-    joybutsens = "joyBut"
52
-    #butt = cont.sensors[joybutsens]
53
-    #aXis = cont.sensors["joysticksens"]
54
-    #bk_but = 4
55
-    back_on = dict['bkBut']
56
-    #a_but = 0
57
-    a_on = dict['aBut']
58
-    #b_but = 1
59
-    b_on = dict['bBut']
60
-    #print(a on)
61
-    last_back = own['last_back_but']
62
-    #last_back = own['last_a_but']
63
-#    reduction = 400000
64
-#    axisTh = 0.03 
65
-#    lt = 4
66
-#    rt = 5
67
-#    lts_pr = 7
68
-#    rts_pr = 8
34
+    #dict['recorder_on'] = recorder_on
35
+    recorder_on = dict.get('recorder_on')
36
+    own['recorder_on'] = recorder_on
37
+    #print("recorder on: ", recorder_on) 
69 38
 
70
-#    lar_lts = 0
71
-#    uad_lts = 1
72
-#    lar_rts = 2 
73
-#    uad_rts = 3 
74
-    #lts_pr = 7
75
-    #rts_pr = 8
76
-#    lTrig = aXis.axisValues[lt] / reduction
77
-#    rTrig = aXis.axisValues[rt] / reduction
78
-#    lLR = aXis.axisValues[lar_lts] / reduction
79
-#    lUD = aXis.axisValues[uad_lts] / reduction
80
-#    rLR = aXis.axisValues[lar_rts] / reduction
81
-#    rUD = aXis.axisValues[uad_rts] / reduction
82
-#    ltsBut = butt.getButtonStatus(lts_pr)
83
-#    rtsBut = butt.getButtonStatus(rts_pr) 
84
-#        
85
-    lLR = dict['lLR']
86
-    lUD = dict['lUD']
87
-    rLR = dict['rLR']
88
-    rUD = dict['rUD']
89
-    lTrig = dict['lTrig']
90
-    rTrig = dict['rTrig']
91
-    aBut = dict['aBut']
92
-    bBut = dict['bBut']
93
-    xBut = dict['xBut']
94
-    yBut = dict['yBut']
95
-    lBump = dict['lBump']
96
-    rBump = dict['rBump']
97
-    bkBut = dict['bkBut']
98
-    stBut = dict['stBut']
99
-    xbBut = dict['xbBut']
100
-    ltsBut = dict['ltsBut']
101
-    rtsBut = dict['rtsBut']
102
-    ldPad = dict['ldPad']
103
-    rdPad = dict['rdPad']
104
-    udPad = dict['udPad']
105
-    ddPad = dict['ddPad']    
106
-        
107
-    
108
-       
109
-    #trigs results range 0 - .08
110
-    #print(lTrig, rTrig)
39
+    if recorder_on == 1:
40
+        #----
41
+        scene = logic.getCurrentScene()
42
+        scene_list = logic.getSceneList()
43
+        camList = scene.cameras
44
+        followcam = camList["followcam"]
45
+        freecam = camList["freecam"]
46
+        skater = scene.objects["Char4"]
47
+        cube = scene.objects["control_cube.002"]
48
+        deck = scene.objects["deck"]
49
+        trucks = scene.objects["trucks"]
50
+        replay_cam_axis = own['replay_cam_axis']
51
+        cam = own.actuators['Camera']
52
+        #----
53
+        joybutsens = "joyBut"
54
+        #butt = cont.sensors[joybutsens]
55
+        #aXis = cont.sensors["joysticksens"]
56
+        #bk_but = 4
57
+        back_on = dict['bkBut']
58
+        #a_but = 0
59
+        a_on = dict['aBut']
60
+        #b_but = 1
61
+        b_on = dict['bBut']
62
+        #print(a on)
63
+        last_back = own['last_back_but']
64
+        #last_back = own['last_a_but']
65
+    #    reduction = 400000
66
+    #    axisTh = 0.03 
67
+    #    lt = 4
68
+    #    rt = 5
69
+    #    lts_pr = 7
70
+    #    rts_pr = 8
111 71
 
112
-    #if cont.sensors[record_sensor].positive:
113
-    if own["playback"] != True:    
114
-        Record.main(recording_cutoff)
115
-        
116
-    if cont.sensors[save_recording_sensor].positive:
117
-        SortData.writeData.saveAll()
118
-        
119
-    #if cont.sensors[load_recording_sensor].positive or (cube["sel"] == 1 and cube["last_sel"] == 0):
120
-    if own['back_state'] == 1 and back_on == 1 and last_back == 0:
121
-        cube["last_sel"] == 1
122
-        SortData.writeData.saveAll()
123
-        own["playback"] = True
124
-        own["playbackBroken"] = False
125
-        freecam.worldPosition = own.worldPosition
126
-        followcam.worldPosition = own.worldPosition
72
+    #    lar_lts = 0
73
+    #    uad_lts = 1
74
+    #    lar_rts = 2 
75
+    #    uad_rts = 3 
76
+        #lts_pr = 7
77
+        #rts_pr = 8
78
+    #    lTrig = aXis.axisValues[lt] / reduction
79
+    #    rTrig = aXis.axisValues[rt] / reduction
80
+    #    lLR = aXis.axisValues[lar_lts] / reduction
81
+    #    lUD = aXis.axisValues[uad_lts] / reduction
82
+    #    rLR = aXis.axisValues[lar_rts] / reduction
83
+    #    rUD = aXis.axisValues[uad_rts] / reduction
84
+    #    ltsBut = butt.getButtonStatus(lts_pr)
85
+    #    rtsBut = butt.getButtonStatus(rts_pr) 
86
+    #        
87
+        lLR = dict['lLR']
88
+        lUD = dict['lUD']
89
+        rLR = dict['rLR']
90
+        rUD = dict['rUD']
91
+        lTrig = dict['lTrig']
92
+        rTrig = dict['rTrig']
93
+        aBut = dict['aBut']
94
+        bBut = dict['bBut']
95
+        xBut = dict['xBut']
96
+        yBut = dict['yBut']
97
+        lBump = dict['lBump']
98
+        rBump = dict['rBump']
99
+        bkBut = dict['bkBut']
100
+        stBut = dict['stBut']
101
+        xbBut = dict['xbBut']
102
+        ltsBut = dict['ltsBut']
103
+        rtsBut = dict['rtsBut']
104
+        ldPad = dict['ldPad']
105
+        rdPad = dict['rdPad']
106
+        udPad = dict['udPad']
107
+        ddPad = dict['ddPad']    
108
+            
127 109
         
110
+           
111
+        #trigs results range 0 - .08
112
+        #print(lTrig, rTrig)
128 113
 
129
-    if own["playback"]:
130
-        Record.loadData()
131
-    #..................
132
-    if cont.sensors[track_left_sensor].positive:
133
-        own["objIndex"] -= 2
134
-        logic.setLogicTicRate(frame_rate*own["playbackSpeed"])
135
-        
136
-    if cont.sensors[track_right_sensor].positive:
137
-        own["objIndex"] += 2
138
-        logic.setLogicTicRate(frame_rate*own["playbackSpeed"])
114
+        #if cont.sensors[record_sensor].positive:
115
+        if own["playback"] != True:    
116
+            Record.main(recording_cutoff, cube)
117
+            
118
+        if cont.sensors[save_recording_sensor].positive:
119
+            SortData.writeData.saveAll()
120
+            
121
+        #if cont.sensors[load_recording_sensor].positive or (cube["sel"] == 1 and cube["last_sel"] == 0):
122
+        if own['back_state'] == 1 and back_on == 1 and last_back == 0:
123
+            cube["last_sel"] == 1
124
+            SortData.writeData.saveAll()
125
+            own["playback"] = True
126
+            own["playbackBroken"] = False
127
+            freecam.worldPosition = own.worldPosition
128
+            followcam.worldPosition = own.worldPosition
129
+            
139 130
 
140
-    if own["playback"] == True:    
141
-        if rTrig > .01 and rTrig < .02:
142
-            own["objIndex"] += 2
143
-            logic.setLogicTicRate(frame_rate*.5) 
144
-        if (rTrig >= .02 and rTrig < .06) or own['loop_play'] == 1:
145
-            own["objIndex"] += 2
146
-            logic.setLogicTicRate(frame_rate*1)
147
-            #print(own['objIndex'])
148
-        if rTrig >= .06 and rTrig < .09:
149
-            own["objIndex"] += 2
150
-            logic.setLogicTicRate(frame_rate*1.5) 
151
-        if lTrig > .01 and lTrig < .02:
131
+        if own["playback"]:
132
+            Record.loadData()
133
+        #..................
134
+        if cont.sensors[track_left_sensor].positive:
152 135
             own["objIndex"] -= 2
153
-            logic.setLogicTicRate(frame_rate*.5) 
154
-        if lTrig >= .02 and lTrig < .06:
155
-            own["objIndex"] -= 2
156
-            logic.setLogicTicRate(frame_rate*1)
157
-        if lTrig >= .06 and lTrig < .09:
158
-            if own['loop_play'] == 1:
159
-                own["objIndex"] -= 6
160
-                #logic.setLogicTicRate(frame_rate*1.5)
161
-            else:    
136
+            logic.setLogicTicRate(frame_rate*own["playbackSpeed"])
137
+            
138
+        if cont.sensors[track_right_sensor].positive:
139
+            own["objIndex"] += 2
140
+            logic.setLogicTicRate(frame_rate*own["playbackSpeed"])
141
+
142
+        if own["playback"] == True:    
143
+            if rTrig > .01 and rTrig < .02:
144
+                own["objIndex"] += 2
145
+                logic.setLogicTicRate(frame_rate*.5) 
146
+            if (rTrig >= .02 and rTrig < .06) or own['loop_play'] == 1:
147
+                own["objIndex"] += 2
148
+                logic.setLogicTicRate(frame_rate*1)
149
+                #print(own['objIndex'])
150
+            if rTrig >= .06 and rTrig < .09:
151
+                own["objIndex"] += 2
152
+                logic.setLogicTicRate(frame_rate*1.5) 
153
+            if lTrig > .01 and lTrig < .02:
162 154
                 own["objIndex"] -= 2
163
-                logic.setLogicTicRate(frame_rate*1.5)
164
-        if b_on == True:
165
-            print("bbut_on")
166
-            own['objIndex'] = 0
167
-            own['valueIndex'] = 0 
168
-            logic.setLogicTicRate(frame_rate*1)                       
155
+                logic.setLogicTicRate(frame_rate*.5) 
156
+            if lTrig >= .02 and lTrig < .06:
157
+                own["objIndex"] -= 2
158
+                logic.setLogicTicRate(frame_rate*1)
159
+            if lTrig >= .06 and lTrig < .09:
160
+                if own['loop_play'] == 1:
161
+                    own["objIndex"] -= 6
162
+                    #logic.setLogicTicRate(frame_rate*1.5)
163
+                else:    
164
+                    own["objIndex"] -= 2
165
+                    logic.setLogicTicRate(frame_rate*1.5)
166
+            if b_on == True:
167
+                print("bbut_on")
168
+                own['objIndex'] = 0
169
+                own['valueIndex'] = 0 
170
+                logic.setLogicTicRate(frame_rate*1)                       
169 171
 
170
-    #....................
171
-    if allow_playback_break:
172
+        #....................
173
+        if allow_playback_break:
172 174
 
173
-        if own['back_state'] == 0 and back_on == 1 and last_back == 0:       
174
-            own["playbackBroken"] = True
175
-            own["playback"] = False
176
-            #print("break - add hud, remove stance (back_state == False)")
177
-            #cont.activate(own.actuators['add_hud'])
178
-            #cont.activate(own.actuators['remove_stance'])
179
-            #removescene = cont.actuators["remove_hud"]
180
-            #removescene.scene = "replay_HUD"
181
-            #addscene = cont.actuators["add_hud"]
182
-            #addscene.scene = "stance"
183
-            #cont.activate(addscene)        
184
-            #cont.activate(removescene)
185
-        elif own["playbackBroken"] and back_on == 0:
186
-            Record.breakOut()
187
-            #cont.activate(own.actuators['remove_hud'])
188
-            #cont.activate(own.actuators['add_stance'])
189
-            #addscene = cont.actuators["add_hud"]
190
-            #addscene.scene = "replay_HUD"
191
-            #removescene = cont.actuators["remove_hud"]
192
-            #removescene.scene = "stance"
193
-            #cont.activate(addscene)
194
-            #cont.activate(removescene)
195
-            
196
-            logic.setLogicTicRate(frame_rate)
197
-            #set value index
198
-            own.state = recorder_state
199
-            own["playbackBroken"] = False
200
-            skater.stopAction(9999)
201
-            deck.stopAction(9999)
202
-            trucks.stopAction(9999)
203
-            cont.activate(own.actuators['replayCam'])
204
-            print("unbreak")
205
-            own['loop_play'] = 0
206
-            #own['valueIndex'] = 0
207
-            #own["objIndex"] += 2
208
-            #logic.setLogicTicRate(frame_rate*1)
209
-            #own['objectIndex'] = 0
210
-            #print("valueIndex = ", own['valueIndex'])
211
-    if back_on == 1 and own['back_but'] == 0:
212
-        print("change back state")
213
-        if own['back_state'] == True:
214
-            own['back_state'] = False
215
-        #elif own['back_state'] == False:
216
-        else:
217
-            own['back_state'] = True
218
-###
219
-    if own['last_playback'] != own['playback']:
220
-        if own['last_playback'] == True:
221
-            cont.activate(own.actuators['remove_hud'])
222
-            cont.activate(own.actuators['add_stance']) 
223
-            own['camnum'] = 0
224
-            cam = camList["Camera.003"]
225
-            scene.active_camera = cam                        
226
-            print("turning replay off", own['playback'])
175
+            if own['back_state'] == 0 and back_on == 1 and last_back == 0:       
176
+                own["playbackBroken"] = True
177
+                own["playback"] = False
178
+                #print("break - add hud, remove stance (back_state == False)")
179
+                #cont.activate(own.actuators['add_hud'])
180
+                #cont.activate(own.actuators['remove_stance'])
181
+                #removescene = cont.actuators["remove_hud"]
182
+                #removescene.scene = "replay_HUD"
183
+                #addscene = cont.actuators["add_hud"]
184
+                #addscene.scene = "stance"
185
+                #cont.activate(addscene)        
186
+                #cont.activate(removescene)
187
+            elif own["playbackBroken"] and back_on == 0:
188
+                Record.breakOut()
189
+                #cont.activate(own.actuators['remove_hud'])
190
+                #cont.activate(own.actuators['add_stance'])
191
+                #addscene = cont.actuators["add_hud"]
192
+                #addscene.scene = "replay_HUD"
193
+                #removescene = cont.actuators["remove_hud"]
194
+                #removescene.scene = "stance"
195
+                #cont.activate(addscene)
196
+                #cont.activate(removescene)
197
+                
198
+                logic.setLogicTicRate(frame_rate)
199
+                #set value index
200
+                own.state = recorder_state
201
+                own["playbackBroken"] = False
202
+                skater.stopAction(9999)
203
+                deck.stopAction(9999)
204
+                trucks.stopAction(9999)
205
+                cont.activate(own.actuators['replayCam'])
206
+                print("unbreak")
207
+                own['loop_play'] = 0
208
+                #own['valueIndex'] = 0
209
+                #own["objIndex"] += 2
210
+                #logic.setLogicTicRate(frame_rate*1)
211
+                #own['objectIndex'] = 0
212
+                #print("valueIndex = ", own['valueIndex'])
213
+        if back_on == 1 and own['back_but'] == 0:
214
+            print("change back state")
215
+            if own['back_state'] == True:
216
+                own['back_state'] = False
217
+            #elif own['back_state'] == False:
218
+            else:
219
+                own['back_state'] = True
220
+    ###
221
+        if own['last_playback'] != own['playback']:
222
+            if own['last_playback'] == True:
223
+                cont.activate(own.actuators['remove_hud'])
224
+                cont.activate(own.actuators['add_stance']) 
225
+                own['camnum'] = 0
226
+                cam = camList["Camera.003"]
227
+                scene.active_camera = cam                        
228
+                print("turning replay off", own['playback'])
229
+                
230
+              
231
+            if own['last_playback'] == False:
232
+                print("turning replay on", own['playback'])
233
+                cont.activate(own.actuators['add_hud'])
234
+                cont.activate(own.actuators['remove_stance'])
235
+                own['objIndex'] = 0
236
+                own['valueIndex'] = 3
237
+                logic.setLogicTicRate(frame_rate*1)               
238
+                 
239
+                             
240
+    ####
241
+        if a_on == 1 and own['a_but'] == False:
242
+            if own['loop_play'] == 1:
243
+                own['loop_play'] = 0
244
+            else:
245
+                own['loop_play'] = 1            
246
+        if rLR > .05 and own["playback"]:
247
+            act = cont.actuators["replayCam"]
248
+            if rLR > .07:
249
+                act.dLoc = [ .06, 0.0, 0.0]
250
+            else:
251
+                act.dLoc = [ .03, 0.0, 0.0]
252
+            #cont.deactivate(own.actuators['Camera'])
253
+            cont.activate(own.actuators['replayCam']) 
254
+            #print("move") 
255
+        elif rLR < -.05 and own["playback"]:
256
+            act = cont.actuators["replayCam"]
257
+            if rLR < -.07:
258
+                act.dLoc = [ -.06, 0.0, 0.0]
259
+            else:    
260
+                act.dLoc = [ -.03, 0.0, 0.0]
261
+            #cont.deactivate(own.actuators['Camera'])
262
+            #act.damping = 6
263
+            cont.activate(own.actuators['replayCam']) 
264
+            #print("move")         
265
+        else:  
266
+            #pass      
267
+            cont.deactivate(own.actuators['replayCam'])
268
+            #cont.activate(own.actuators['Camera'])
269
+        #print("back state: ", own['back_state'], "last_back_but: ", own['last_back_but'], "back_but :", own['back_but'])  
270
+        #integer
271
+        # 
272
+        #0 = +X axis
273
+        # 
274
+        #1 = +Y axis
275
+        # 
276
+        #2 = +Z axis
277
+        # 
278
+        #3 = -X axis
279
+        # 
280
+        #4 = -Y axis
281
+        # 
282
+        #5 = -Z axis
283
+    #    if rLR > .05 and own["playback"]:
284
+    #        if own['last_rtsBut'] == True and rtsBut == False:
285
+    #            if replay_cam_axis == 0:
286
+    #               replay_cam_axis = 1
287
+    #            elif replay_cam_axis == 1:
288
+    #                replay_cam_axis = 3
289
+    #            elif replay_cam_axis == 3 :
290
+    #                replay_cam_axis = 4
291
+    #            elif replay_cam_axis == 4:
292
+    #                replay_cam_axis = 0 
293
+    #        cam.axis = replay_cam_axis
294
+    #        cont.activate(cam)
295
+    #        print("set replay_cam_axis: ", replay_cam_axis)
296
+    #        own['replay_cam_axis'] = replay_cam_axis
297
+        if own['last_ltsBut'] == True and ltsBut == False and own['playback']:
298
+            # get camera named SecurityCam
299
+            if own['camnum'] == 1:
300
+                own['camnum'] = 2
301
+            elif own['camnum'] == 0:
302
+                own['camnum'] = 1 
303
+            elif own['camnum'] == 2:
304
+                own['camnum'] = 0    
305
+        if own['last_rtsBut'] == True and rtsBut == False and own['playback']:
306
+            # get camera named SecurityCam
307
+            if "replay_HUD" in scene_list:
308
+                cont.activate(own.actuators['remove_hud'])
309
+            else:
310
+                cont.activate(own.actuators['add_hud'])
311
+        if own['camnum'] == 1 and own['playback']:
227 312
             
228
-          
229
-        if own['last_playback'] == False:
230
-            print("turning replay on", own['playback'])
231
-            cont.activate(own.actuators['add_hud'])
232
-            cont.activate(own.actuators['remove_stance'])
233
-            own['objIndex'] = 0
234
-            own['valueIndex'] = 3
235
-            logic.setLogicTicRate(frame_rate*1)               
236
-             
237
-                         
238
-####
239
-    if a_on == 1 and own['a_but'] == False:
240
-        if own['loop_play'] == 1:
241
-            own['loop_play'] = 0
242
-        else:
243
-            own['loop_play'] = 1            
244
-    if rLR > .05 and own["playback"]:
245
-        act = cont.actuators["replayCam"]
246
-        if rLR > .07:
247
-            act.dLoc = [ .06, 0.0, 0.0]
248
-        else:
249
-            act.dLoc = [ .03, 0.0, 0.0]
250
-        #cont.deactivate(own.actuators['Camera'])
251
-        cont.activate(own.actuators['replayCam']) 
252
-        #print("move") 
253
-    elif rLR < -.05 and own["playback"]:
254
-        act = cont.actuators["replayCam"]
255
-        if rLR < -.07:
256
-            act.dLoc = [ -.06, 0.0, 0.0]
257
-        else:    
258
-            act.dLoc = [ -.03, 0.0, 0.0]
259
-        #cont.deactivate(own.actuators['Camera'])
260
-        #act.damping = 6
261
-        cont.activate(own.actuators['replayCam']) 
262
-        #print("move")         
263
-    else:  
264
-        #pass      
265
-        cont.deactivate(own.actuators['replayCam'])
266
-        #cont.activate(own.actuators['Camera'])
267
-    #print("back state: ", own['back_state'], "last_back_but: ", own['last_back_but'], "back_but :", own['back_but'])  
268
-    #integer
269
-    # 
270
-    #0 = +X axis
271
-    # 
272
-    #1 = +Y axis
273
-    # 
274
-    #2 = +Z axis
275
-    # 
276
-    #3 = -X axis
277
-    # 
278
-    #4 = -Y axis
279
-    # 
280
-    #5 = -Z axis
281
-#    if rLR > .05 and own["playback"]:
282
-#        if own['last_rtsBut'] == True and rtsBut == False:
283
-#            if replay_cam_axis == 0:
284
-#               replay_cam_axis = 1
285
-#            elif replay_cam_axis == 1:
286
-#                replay_cam_axis = 3
287
-#            elif replay_cam_axis == 3 :
288
-#                replay_cam_axis = 4
289
-#            elif replay_cam_axis == 4:
290
-#                replay_cam_axis = 0 
291
-#        cam.axis = replay_cam_axis
292
-#        cont.activate(cam)
293
-#        print("set replay_cam_axis: ", replay_cam_axis)
294
-#        own['replay_cam_axis'] = replay_cam_axis
295
-    if own['last_ltsBut'] == True and ltsBut == False and own['playback']:
296
-        # get camera named SecurityCam
297
-        if own['camnum'] == 1:
298
-            own['camnum'] = 2
299
-        elif own['camnum'] == 0:
300
-            own['camnum'] = 1 
301
-        elif own['camnum'] == 2:
302
-            own['camnum'] = 0    
303
-    if own['last_rtsBut'] == True and rtsBut == False and own['playback']:
304
-        # get camera named SecurityCam
305
-        if "replay_HUD" in scene_list:
306
-            cont.activate(own.actuators['remove_hud'])
307
-        else:
308
-            cont.activate(own.actuators['add_hud'])
309
-    if own['camnum'] == 1 and own['playback']:
310
-        
311
-        scene.active_camera = followcam 
312
-        #################
313
-        camspeed1 = .04 #.015
314
-        camspeed2 = .1 #.055
315
-        camrot1 = .02 #.005
316
-        camrot2 = .04 #.02
317
-        #up
318
-        if lUD < -0.080:
319
-            followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
320
-            cont.activate(followcam.actuators["up"])
321
-            #print("fastup")
322
-        else:
323
-            cont.deactivate(followcam.actuators["up"])    
324
-#            #down    
325
-        if lUD > .080:
326
-            followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
327
-            cont.activate(followcam.actuators["down"])
328
-        else:
329
-            cont.deactivate(followcam.actuators["down"])                    
330
-#            #left
331
-        if lLR < -0.080:
332
-            followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]                
333
-            cont.activate(followcam.actuators["left"])
334
-        else:
335
-            cont.deactivate(followcam.actuators["left"])                    
336
-#            #right
337
-        if lLR > 0.080:         
338
-            followcam.actuators["right"].dLoc = [camspeed2, 0, 0]                
339
-            cont.activate(followcam.actuators["right"])
340
-        else:
341
-            cont.deactivate(followcam.actuators["right"])  
342
-        #up
343
-        if rUD < -0.080:
344
-            followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
345
-            cont.activate(followcam.actuators["rotup"])
346
-            #print("uppppppppppppppppppppppppppp")
347
-        else:
348
-            cont.deactivate(followcam.actuators["rotup"])    
349
-#            #down    
350
-        if rUD > .080:
351
-            followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]                
352
-            cont.activate(followcam.actuators["rotdown"])
353
-        else:
354
-            cont.deactivate(followcam.actuators["rotdown"])                    
355
-#            #left
356
-        if rLR < -0.080:
357
-            followcam.actuators["rotleft"].dRot = [0, 0, camrot2]                
358
-            cont.activate(followcam.actuators["rotleft"])
359
-        else:
360
-            cont.deactivate(followcam.actuators["rotleft"])                    
361
-#            #right
362
-        if rLR > 0.080:         
363
-            followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
364
-            cont.activate(followcam.actuators["rotright"])
365
-        else:
366
-            cont.deactivate(followcam.actuators["rotright"]) 
313
+            scene.active_camera = followcam 
314
+            #################
315
+            camspeed1 = .04 #.015
316
+            camspeed2 = .1 #.055
317
+            camrot1 = .02 #.005
318
+            camrot2 = .04 #.02
319
+            #up
320
+            if lUD < -0.080:
321
+                followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
322
+                cont.activate(followcam.actuators["up"])
323
+                #print("fastup")
324
+            else:
325
+                cont.deactivate(followcam.actuators["up"])    
326
+    #            #down    
327
+            if lUD > .080:
328
+                followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
329
+                cont.activate(followcam.actuators["down"])
330
+            else:
331
+                cont.deactivate(followcam.actuators["down"])                    
332
+    #            #left
333
+            if lLR < -0.080:
334
+                followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]                
335
+                cont.activate(followcam.actuators["left"])
336
+            else:
337
+                cont.deactivate(followcam.actuators["left"])                    
338
+    #            #right
339
+            if lLR > 0.080:         
340
+                followcam.actuators["right"].dLoc = [camspeed2, 0, 0]                
341
+                cont.activate(followcam.actuators["right"])
342
+            else:
343
+                cont.deactivate(followcam.actuators["right"])  
344
+            #up
345
+            if rUD < -0.080:
346
+                followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
347
+                cont.activate(followcam.actuators["rotup"])
348
+                #print("uppppppppppppppppppppppppppp")
349
+            else:
350
+                cont.deactivate(followcam.actuators["rotup"])    
351
+    #            #down    
352
+            if rUD > .080:
353
+                followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]                
354
+                cont.activate(followcam.actuators["rotdown"])
355
+            else:
356
+                cont.deactivate(followcam.actuators["rotdown"])                    
357
+    #            #left
358
+            if rLR < -0.080:
359
+                followcam.actuators["rotleft"].dRot = [0, 0, camrot2]                
360
+                cont.activate(followcam.actuators["rotleft"])
361
+            else:
362
+                cont.deactivate(followcam.actuators["rotleft"])                    
363
+    #            #right
364
+            if rLR > 0.080:         
365
+                followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
366
+                cont.activate(followcam.actuators["rotright"])
367
+            else:
368
+                cont.deactivate(followcam.actuators["rotright"]) 
367 369
 
368
-#*********************************************                
370
+    #*********************************************                
371
+                
372
+            if lUD > -0.080 and lUD < -0.030:
373
+                followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
374
+                cont.activate(followcam.actuators["up"])
375
+                #print(lUD)
376
+            else:
377
+                cont.deactivate(followcam.actuators["up"])    
378
+    #            #down    
379
+            if lUD < .080 and lUD > .03:
380
+                followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]                
381
+                cont.activate(followcam.actuators["down"])
382
+            else:
383
+                cont.deactivate(followcam.actuators["down"])                    
384
+    #            #left
385
+            if lLR > -0.080 and lLR < -0.030:
386
+                followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]                
387
+                cont.activate(followcam.actuators["left"])
388
+            else:
389
+                cont.deactivate(followcam.actuators["left"])                    
390
+    #            #right
391
+            if lLR < .080 and lLR > .03:       
392
+                followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
393
+                cont.activate(followcam.actuators["right"])
394
+            else:
395
+                cont.deactivate(followcam.actuators["right"])  
396
+            #up
397
+            if rUD > -0.080 and rUD < -0.030:
398
+                followcam.actuators["rotup"].dRot = [camrot1, 0, 0]                
399
+                cont.activate(followcam.actuators["rotup"])
400
+            else:
401
+                cont.deactivate(followcam.actuators["rotup"])    
402
+    #            #down    
403
+            if rUD < .080 and rUD > .03:
404
+                followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]                
405
+                cont.activate(followcam.actuators["rotdown"])
406
+            else:
407
+                cont.deactivate(followcam.actuators["rotdown"])                    
408
+    #            #left
409
+            if rLR > -0.080 and rLR < -0.030:
410
+                followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
411
+                cont.activate(followcam.actuators["rotleft"])
412
+            else:
413
+                cont.deactivate(followcam.actuators["rotleft"])                    
414
+    #            #right
415
+            if rLR < .080 and rLR > .03:         
416
+                followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
417
+                cont.activate(followcam.actuators["rotright"])
418
+            else:
419
+                cont.deactivate(followcam.actuators["rotright"])          
369 420
             
370
-        if lUD > -0.080 and lUD < -0.030:
371
-            followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
372
-            cont.activate(followcam.actuators["up"])
373
-            #print(lUD)
374
-        else:
375
-            cont.deactivate(followcam.actuators["up"])    
376
-#            #down    
377
-        if lUD < .080 and lUD > .03:
378
-            followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]                
379
-            cont.activate(followcam.actuators["down"])
380
-        else:
381
-            cont.deactivate(followcam.actuators["down"])                    
382
-#            #left
383
-        if lLR > -0.080 and lLR < -0.030:
384
-            followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]                
385
-            cont.activate(followcam.actuators["left"])
386
-        else:
387
-            cont.deactivate(followcam.actuators["left"])                    
388
-#            #right
389
-        if lLR < .080 and lLR > .03:       
390
-            followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
391
-            cont.activate(followcam.actuators["right"])
392
-        else:
393
-            cont.deactivate(followcam.actuators["right"])  
394
-        #up
395
-        if rUD > -0.080 and rUD < -0.030:
396
-            followcam.actuators["rotup"].dRot = [camrot1, 0, 0]                
397
-            cont.activate(followcam.actuators["rotup"])
398
-        else:
399
-            cont.deactivate(followcam.actuators["rotup"])    
400
-#            #down    
401
-        if rUD < .080 and rUD > .03:
402
-            followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]                
403
-            cont.activate(followcam.actuators["rotdown"])
404
-        else:
405
-            cont.deactivate(followcam.actuators["rotdown"])                    
406
-#            #left
407
-        if rLR > -0.080 and rLR < -0.030:
408
-            followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
409
-            cont.activate(followcam.actuators["rotleft"])
410
-        else:
411
-            cont.deactivate(followcam.actuators["rotleft"])                    
412
-#            #right
413
-        if rLR < .080 and rLR > .03:         
414
-            followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
415
-            cont.activate(followcam.actuators["rotright"])
416
-        else:
417
-            cont.deactivate(followcam.actuators["rotright"])          
418
-        
419
-        #################
420
-        
421
-    if own['camnum'] == 2 and own['playback']:
422
-        
423
-        scene.active_camera = freecam
424
-        
425
-        #act = freecam.actuators[
426
-        camspeed1 = .015
427
-        camspeed2 = .055
428
-        camrot1 = .005
429
-        camrot2 = .02
430
-        #up
431
-        if lUD < -0.080:
432
-            freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
433
-            cont.activate(freecam.actuators["up"])
434
-            #print("fastup")
435
-        else:
436
-            cont.deactivate(freecam.actuators["up"])    
437
-#            #down    
438
-        if lUD > .080:
439
-            freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
440
-            cont.activate(freecam.actuators["down"])
441
-        else:
442
-            cont.deactivate(freecam.actuators["down"])                    
443
-#            #left
444
-        if lLR < -0.080:
445
-            freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]                
446
-            cont.activate(freecam.actuators["left"])
447
-        else:
448
-            cont.deactivate(freecam.actuators["left"])                    
449
-#            #right
450
-        if lLR > 0.080:         
451
-            freecam.actuators["right"].dLoc = [camspeed2, 0, 0]                
452
-            cont.activate(freecam.actuators["right"])
453
-        else:
454
-            cont.deactivate(freecam.actuators["right"])  
455
-        #up
456
-        if rUD < -0.080:
457
-            freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
458
-            cont.activate(freecam.actuators["rotup"])
459
-        else:
460
-            cont.deactivate(freecam.actuators["rotup"])    
461
-#            #down    
462
-        if rUD > .080:
463
-            freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]                
464
-            cont.activate(freecam.actuators["rotdown"])
465
-        else:
466
-            cont.deactivate(freecam.actuators["rotdown"])                    
467
-#            #left
468
-        if rLR < -0.080:
469
-            freecam.actuators["rotleft"].dRot = [0, 0, camrot2]                
470
-            cont.activate(freecam.actuators["rotleft"])
471
-        else:
472
-            cont.deactivate(freecam.actuators["rotleft"])                    
473
-#            #right
474
-        if rLR > 0.080:         
475
-            freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
476
-            cont.activate(freecam.actuators["rotright"])
477
-        else:
478
-            cont.deactivate(freecam.actuators["rotright"]) 
479
-
480
-#*********************************************                
421
+            #################
422
+            
423
+        if own['camnum'] == 2 and own['playback']:
481 424
             
482
-        if lUD > -0.080 and lUD < -0.030:
483
-            freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
484
-            cont.activate(freecam.actuators["up"])
485
-            #print(lUD)
486
-        else:
487
-            cont.deactivate(freecam.actuators["up"])    
488
-#            #down    
489
-        if lUD < .080 and lUD > .03:
490
-            freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]                
491
-            cont.activate(freecam.actuators["down"])
492
-        else:
493
-            cont.deactivate(freecam.actuators["down"])                    
494
-#            #left
495
-        if lLR > -0.080 and lLR < -0.030:
496
-            freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]                
497
-            cont.activate(freecam.actuators["left"])
498
-        else:
499
-            cont.deactivate(freecam.actuators["left"])                    
500
-#            #right
501
-        if lLR < .080 and lLR > .03:       
502
-            freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
503
-            cont.activate(freecam.actuators["right"])
504
-        else:
505
-            cont.deactivate(freecam.actuators["right"])  
506
-        #up
507
-        if rUD > -0.080 and rUD < -0.030:
508
-            freecam.actuators["rotup"].dRot = [camrot1, 0, 0]                
509
-            cont.activate(freecam.actuators["rotup"])
510
-        else:
511
-            cont.deactivate(freecam.actuators["rotup"])    
512
-#            #down    
513
-        if rUD < .080 and rUD > .03:
514
-            freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]                
515
-            cont.activate(freecam.actuators["rotdown"])
516
-        else:
517
-            cont.deactivate(freecam.actuators["rotdown"])                    
518
-#            #left
519
-        if rLR > -0.080 and rLR < -0.030:
520
-            freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
521
-            cont.activate(freecam.actuators["rotleft"])
522
-        else:
523
-            cont.deactivate(freecam.actuators["rotleft"])                    
524
-#            #right
525
-        if rLR < .080 and rLR > .03:         
526
-            freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
527
-            cont.activate(freecam.actuators["rotright"])
528
-        else:
529
-            cont.deactivate(freecam.actuators["rotright"])        
530
-########################################                 
531
-    if own['camnum'] == 0:
532
-        cam = camList["Camera.003"]
533
-        scene.active_camera = cam          
534
-    valueIndex = own['valueIndex']
535
-    n = (valueIndex / recording_cutoff) * 1000
536
-    n = int(round(n))
537
-    #n = 10
538
-    #print("n: ", n, "--", valueIndex, recording_cutoff)
539
-    #dict = logic.globalDict #Get the global dictionary
540
-    dict['playhead'] = n 
541
-      
542
-    own['last_back_but'] = own['back_but']           
543
-    own['back_but'] = back_on
544
-    own['last_a_but'] = own['a_but']           
545
-    own['a_but'] = a_on
546
-    own['last_ltsBut'] = ltsBut
547
-    own['last_rtsBut'] = rtsBut
548
-    own['last_playback'] = own['playback']
425
+            scene.active_camera = freecam
426
+            
427
+            #act = freecam.actuators[
428
+            camspeed1 = .015
429
+            camspeed2 = .055
430
+            camrot1 = .005
431
+            camrot2 = .02
432
+            #up
433
+            if lUD < -0.080:
434
+                freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
435
+                cont.activate(freecam.actuators["up"])
436
+                #print("fastup")
437
+            else:
438
+                cont.deactivate(freecam.actuators["up"])    
439
+    #            #down    
440
+            if lUD > .080:
441
+                freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
442
+                cont.activate(freecam.actuators["down"])
443
+            else:
444
+                cont.deactivate(freecam.actuators["down"])                    
445
+    #            #left
446
+            if lLR < -0.080:
447
+                freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]                
448
+                cont.activate(freecam.actuators["left"])
449
+            else:
450
+                cont.deactivate(freecam.actuators["left"])                    
451
+    #            #right
452
+            if lLR > 0.080:         
453
+                freecam.actuators["right"].dLoc = [camspeed2, 0, 0]                
454
+                cont.activate(freecam.actuators["right"])
455
+            else:
456
+                cont.deactivate(freecam.actuators["right"])  
457
+            #up
458
+            if rUD < -0.080:
459
+                freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
460
+                cont.activate(freecam.actuators["rotup"])
461
+            else:
462
+                cont.deactivate(freecam.actuators["rotup"])    
463
+    #            #down    
464
+            if rUD > .080:
465
+                freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]                
466
+                cont.activate(freecam.actuators["rotdown"])
467
+            else:
468
+                cont.deactivate(freecam.actuators["rotdown"])                    
469
+    #            #left
470
+            if rLR < -0.080:
471
+                freecam.actuators["rotleft"].dRot = [0, 0, camrot2]                
472
+                cont.activate(freecam.actuators["rotleft"])
473
+            else:
474
+                cont.deactivate(freecam.actuators["rotleft"])                    
475
+    #            #right
476
+            if rLR > 0.080:         
477
+                freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
478
+                cont.activate(freecam.actuators["rotright"])
479
+            else:
480
+                cont.deactivate(freecam.actuators["rotright"]) 
481
+
482
+    #*********************************************                
483
+                
484
+            if lUD > -0.080 and lUD < -0.030:
485
+                freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
486
+                cont.activate(freecam.actuators["up"])
487
+                #print(lUD)
488
+            else:
489
+                cont.deactivate(freecam.actuators["up"])    
490
+    #            #down    
491
+            if lUD < .080 and lUD > .03:
492
+                freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]                
493
+                cont.activate(freecam.actuators["down"])
494
+            else:
495
+                cont.deactivate(freecam.actuators["down"])                    
496
+    #            #left
497
+            if lLR > -0.080 and lLR < -0.030:
498
+                freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]                
499
+                cont.activate(freecam.actuators["left"])
500
+            else:
501
+                cont.deactivate(freecam.actuators["left"])                    
502
+    #            #right
503
+            if lLR < .080 and lLR > .03:       
504
+                freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
505
+                cont.activate(freecam.actuators["right"])
506
+            else:
507
+                cont.deactivate(freecam.actuators["right"])  
508
+            #up
509
+            if rUD > -0.080 and rUD < -0.030:
510
+                freecam.actuators["rotup"].dRot = [camrot1, 0, 0]                
511
+                cont.activate(freecam.actuators["rotup"])
512
+            else:
513
+                cont.deactivate(freecam.actuators["rotup"])    
514
+    #            #down    
515
+            if rUD < .080 and rUD > .03:
516
+                freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]                
517
+                cont.activate(freecam.actuators["rotdown"])
518
+            else:
519
+                cont.deactivate(freecam.actuators["rotdown"])                    
520
+    #            #left
521
+            if rLR > -0.080 and rLR < -0.030:
522
+                freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
523
+                cont.activate(freecam.actuators["rotleft"])
524
+            else:
525
+                cont.deactivate(freecam.actuators["rotleft"])                    
526
+    #            #right
527
+            if rLR < .080 and rLR > .03:         
528
+                freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
529
+                cont.activate(freecam.actuators["rotright"])
530
+            else:
531
+                cont.deactivate(freecam.actuators["rotright"])        
532
+    ########################################                 
533
+        if own['camnum'] == 0:
534
+            cam = camList["Camera.003"]
535
+            scene.active_camera = cam          
536
+        valueIndex = own['valueIndex']
537
+        n = (valueIndex / recording_cutoff) * 1000
538
+        n = int(round(n))
539
+        #n = 10
540
+        #print("n: ", n, "--", valueIndex, recording_cutoff)
541
+        #dict = logic.globalDict #Get the global dictionary
542
+        dict['playhead'] = n 
543
+          
544
+        own['last_back_but'] = own['back_but']           
545
+        own['back_but'] = back_on
546
+        own['last_a_but'] = own['a_but']           
547
+        own['a_but'] = a_on
548
+        own['last_ltsBut'] = ltsBut
549
+        own['last_rtsBut'] = rtsBut
550
+        own['last_playback'] = own['playback']

+ 106
- 0
npause.py View File

@@ -0,0 +1,106 @@
1
+import bge
2
+
3
+
4
+def main():
5
+
6
+    cont = bge.logic.getCurrentController()
7
+    scene = bge.logic.getCurrentScene()
8
+    own = cont.owner
9
+    dict = bge.logic.globalDict 
10
+    
11
+    skater = scene.objects["Char4"]
12
+    deck = scene.objects["deck"]
13
+    trucks = scene.objects["trucks"]
14
+    
15
+    try:
16
+        pause_state = dict['npause']
17
+        last_pause = dict['last_npause']
18
+    except:
19
+        dict['npause'] = 0
20
+        dict['last_npause'] = 0
21
+        pause_state = 0
22
+        last_pause = 0
23
+
24
+
25
+    def printplaying():
26
+        splaying_layers = "S: "
27
+        playing_layers = "D: "
28
+        tplaying_layers = "T: "
29
+        for x in range(1000):
30
+            if skater.isPlayingAction(x):
31
+            #if trucks.isPlayingAction(x):
32
+            #if skater.isPlayingAction(x):                        
33
+                splaying_layers += str(x)
34
+                splaying_layers += " "        
35
+            if deck.isPlayingAction(x):
36
+            #if trucks.isPlayingAction(x):
37
+            #if skater.isPlayingAction(x):                        
38
+                playing_layers += str(x)
39
+                playing_layers += " "
40
+            if trucks.isPlayingAction(x):
41
+            #if trucks.isPlayingAction(x):
42
+            #if skater.isPlayingAction(x):                        
43
+                tplaying_layers += str(x)
44
+                tplaying_layers += " "            
45
+        print(splaying_layers, playing_layers, tplaying_layers)
46
+
47
+    
48
+    #switch pause state
49
+    if dict['stBut'] == True and dict['last_stBut'] == False:
50
+        if pause_state == 0:
51
+            pause_state = 1
52
+        else:
53
+            pause_state = 0    
54
+        dict['npause'] = pause_state
55
+    
56
+    #enter pause    
57
+    if pause_state == 1 and last_pause == 0:
58
+        own.suspendDynamics()
59
+        own['pre_pause_linvel'] = [own['linvelx'], own['linVely'], 0]
60
+        own.setLinearVelocity([0,0,0],1)  
61
+        cont.activate(cont.actuators['empty'])
62
+        cont.activate(cont.actuators['add_overlay']) 
63
+        printplaying()
64
+
65
+    if pause_state == 1:        
66
+        layer = 450
67
+        if skater.isPlayingAction(layer):
68
+            skater.stopAction(layer)
69
+        if deck.isPlayingAction(layer):    
70
+            deck.stopAction(layer)
71
+        if trucks.isPlayingAction(layer):    
72
+            trucks.stopAction(layer)
73
+        layer = 460
74
+        if skater.isPlayingAction(layer):
75
+            skater.stopAction(layer)
76
+        if deck.isPlayingAction(layer):    
77
+            deck.stopAction(layer)
78
+        if trucks.isPlayingAction(layer):    
79
+            trucks.stopAction(layer)
80
+        layer = 470
81
+        if skater.isPlayingAction(layer):
82
+            skater.stopAction(layer)
83
+        if deck.isPlayingAction(layer):    
84
+            deck.stopAction(layer)
85
+        if trucks.isPlayingAction(layer):    
86
+            trucks.stopAction(layer)
87
+                                                            
88
+        
89
+        
90
+        
91
+    #exit pause     
92
+    if pause_state == 0 and last_pause == 1:
93
+        #print("unpause")
94
+        own.restoreDynamics()
95
+        #own.setlinearVelocity([0,0,0],1] 
96
+        cont.activate(cont.actuators['roll'])
97
+        #print("pre_pause_linvel = ", own['pre_pause_linvel'])
98
+        try:
99
+            own.setLinearVelocity(own['pre_pause_linvel'], 1) 
100
+        except:
101
+            pass    
102
+        cont.activate(cont.actuators['remove_overlay'])           
103
+    #print(pause_state)
104
+    dict['last_npause'] = pause_state
105
+    
106
+main()

+ 69
- 86
pause.py View File

@@ -1,73 +1,30 @@
1 1
 import bge
2 2
 cont = bge.logic.getCurrentController()
3 3
 own = cont.owner
4
+dict = bge.logic.globalDict
4 5
 
6
+lLR = dict['lLR']
7
+lUD = dict['lUD']
8
+rLR = dict['rLR']
9
+rUD = dict['rUD']
10
+lTrig = dict['lTrig']
11
+rTrig = dict['rTrig']
12
+aBut = dict['aBut']
13
+bBut = dict['bBut']
14
+xBut = dict['xBut']
15
+yBut = dict['yBut']
16
+lBump = dict['lBump']
17
+rBump = dict['rBump']
18
+bkBut = dict['bkBut']
19
+stBut = dict['stBut']
20
+xbBut = dict['xbBut']
21
+ltsBut = dict['ltsBut']
22
+rtsBut = dict['rtsBut']
23
+ldPad = dict['ldPad']
24
+rdPad = dict['rdPad']
25
+udPad = dict['udPad']
26
+ddPad = dict['ddPad']
5 27
 
6
-os = 'Windows'
7
-from sys import platform
8
-if platform != "win32":
9
- os = 'Linux'
10
-def onWindows():
11
- return os == 'Windows'
12
-
13
-reduction = 400000
14
-axisTh = 0.03 
15
-
16
-#Sensor logic bricks connected to the python Controller  
17
-aXis = cont.sensors["sControla"]
18
-bUtt = cont.sensors["sControlb"]
19
-
20
-onW = onWindows()
21
-
22
-# windows stuff
23
-lar_lts = 0
24
-uad_lts = 1
25
-lt = 4 if onW else 2
26
-lar_rts = 2 if onW else 3
27
-uad_rts = 3 if onW else 4
28
-rt = 5
29
-
30
-# These are the numerical values associated with the buttons on the Xbox Controller 
31
-# Called with - SensorName.getButtonStatus(buttonnumber) - 
32
-# A joystick sensor logic brick (with the 'Button' Event Type; 'All Events' selected; and 'Tap' enabled) must be connected to the Python Controller logic brick to call these buttons 
33
-
34
-a_but = 0 if onW else 0
35
-b_but = 1 if onW else 1
36
-x_but = 2 if onW else 2
37
-y_but = 3 if onW else 3
38
-l_bump = 9 if onW else 4
39
-r_bump = 10 if onW else 5
40
-bk_but = 4 if onW else 6
41
-st_but = 6 if onW else 7
42
-xb_but = 5 if onW else 8
43
-lts_pr = 7 if onW else 9
44
-rts_pr = 8 if onW else 10
45
-l_dp = 13 if onW else 11
46
-r_dp = 14 if onW else 12
47
-u_dp = 11 if onW else 13
48
-d_dp = 12 if onW else 14
49
-
50
-lLR = aXis.axisValues[lar_lts] / reduction
51
-lUD = aXis.axisValues[uad_lts] / reduction
52
-rLR = aXis.axisValues[lar_rts] / reduction
53
-rUD = aXis.axisValues[uad_rts] / reduction
54
-lTrig = aXis.axisValues[lt] / reduction
55
-rTrig = aXis.axisValues[rt] / reduction
56
-aBut = bUtt.getButtonStatus(a_but)
57
-bBut = bUtt.getButtonStatus(b_but)
58
-xBut = bUtt.getButtonStatus(x_but)
59
-yBut = bUtt.getButtonStatus(y_but)
60
-lBump = bUtt.getButtonStatus(l_bump)
61
-rBump = bUtt.getButtonStatus(r_bump)
62
-bkBut = bUtt.getButtonStatus(bk_but)
63
-stBut = bUtt.getButtonStatus(st_but)
64
-xbBut = bUtt.getButtonStatus(xb_but)
65
-ltsBut = bUtt.getButtonStatus(lts_pr)
66
-rtsBut = bUtt.getButtonStatus(rts_pr)
67
-ldPad = bUtt.getButtonStatus(l_dp)
68
-rdPad = bUtt.getButtonStatus(r_dp)
69
-udPad = bUtt.getButtonStatus(u_dp)
70
-ddPad = bUtt.getButtonStatus(d_dp)
71 28
 #print(lUD)
72 29
 axis_sens = .06
73 30
 #print(aBut)
@@ -196,7 +153,7 @@ def main():
196 153
                 active_level_select = 0
197 154
             if active_level_select == -1:    
198 155
                 active_level_select = 0
199
-        print(active_level_select)                        
156
+        #print(active_level_select)                        
200 157
             #move down
201 158
             #play down
202 159
         if active_level_select == 0:
@@ -216,8 +173,9 @@ def main():
216 173
         if active_level_select == 7:
217 174
             level_text.text = "Waiting Room"                           
218 175
         if active_level_select == 8:
219
-            level_text.text = "8 (n/a)"                                                                      
176
+            level_text.text = "Garage 18"                                                                      
220 177
         own["active_level_select"] = active_level_select 
178
+        load_timer = 100
221 179
 #indoor
222 180
         if aBut == False and active_level_select == 0 and lasta == 1:
223 181
             level_text.text = ""
@@ -226,47 +184,59 @@ def main():
226 184
             main_empty["level"] = "lot"
227 185
             own["level"] = level
228 186
             Settings.writeSettings()
229
-            print("not")
187
+            #print("not")
230 188
             Settings.readSettings()
231
-            cont.activate(own.actuators['restart'])
189
+            #cont.activate(own.actuators['restart'])
190
+            dict['reload_timer'] = 250
191
+            dict['overlay_fadein'] = 1
232 192
             #Settings.loadlevel() 
193
+            dict['load_timer'] = load_timer
233 194
         else: 
234 195
             
235 196
             cont.deactivate(own.actuators['restart']) 
236 197
 #woodbowl               
237 198
         if aBut == False and active_level_select == 1 and lasta == 1:
238 199
             level_text.text = ""
239
-            cont.activate(own.actuators['loading']) 
200
+            #cont.activate(own.actuators['loading']) 
240 201
             level = "mini_scene"
241 202
             main_empty["level"] = "mini_scene"
242 203
             own["level"] = level
243 204
             Settings.writeSettings()
244 205
             Settings.readSettings()
245
-            cont.activate(own.actuators['restart']) 
206
+            #cont.activate(own.actuators['restart']) 
207
+            dict['reload_timer'] = 250
208
+            dict['overlay_fadein'] = 1
246 209
             #Settings.loadlevel()
210
+            dict['load_timer'] = load_timer
247 211
         else: cont.deactivate(own.actuators['restart']) 
248 212
 #mini        
249 213
         if aBut == False and active_level_select == 2 and lasta == 1:
250 214
             level_text.text = ""
251
-            cont.activate(own.actuators['loading']) 
215
+            #cont.activate(own.actuators['loading']) 
252 216
             level = "warehouse"
253 217
             main_empty["level"] = "warehouse"
254 218
             own["level"] = level
255 219
             Settings.writeSettings()
256 220
             Settings.readSettings()
257
-            cont.activate(own.actuators['restart']) 
221
+            #cont.activate(own.actuators['restart']) 
222
+            dict['reload_timer'] = 250
223
+            dict['overlay_fadein'] = 1
258 224
             #Settings.loadlevel()
225
+            dict['load_timer'] = load_timer
259 226
         else: cont.deactivate(own.actuators['restart'])
260 227
 #level3        
261 228
         if aBut == False and active_level_select == 3 and lasta == 1:
262 229
             level_text.text = ""
263
-            level = "level3"
230
+            level = "city2"
264 231
             main_empty["level"] = "city2"
265 232
             own["level"] = level
266 233
             Settings.writeSettings()
267 234
             Settings.readSettings()
268
-            cont.activate(own.actuators['restart']) 
235
+            #cont.activate(own.actuators['restart']) 
236
+            dict['reload_timer'] = 250
237
+            dict['overlay_fadein'] = 1
269 238
             #Settings.loadlevel()
239
+            dict['load_timer'] = load_timer
270 240
         else: cont.deactivate(own.actuators['restart']) 
271 241
 #hubbas rail        
272 242
         if aBut == False and active_level_select == 4 and lasta == 1:
@@ -276,19 +246,25 @@ def main():
276 246
             own["level"] = level
277 247
             Settings.writeSettings()
278 248
             Settings.readSettings()
279
-            cont.activate(own.actuators['restart']) 
249
+            #cont.activate(own.actuators['restart']) 
250
+            dict['reload_timer'] = 250
251
+            dict['overlay_fadein'] = 1
280 252
             #Settings.loadlevel()
253
+            dict['load_timer'] = load_timer
281 254
         else: cont.deactivate(own.actuators['restart']) 
282 255
 #training        
283 256
         if aBut == False and active_level_select == 5 and lasta == 1:
284 257
             level_text.text = ""
285
-            level = "level3"
258
+            level = "spine"
286 259
             main_empty["level"] = "spine"
287 260
             own["level"] = level
288 261
             Settings.writeSettings()
289 262
             Settings.readSettings()
290
-            cont.activate(own.actuators['restart']) 
263
+            #cont.activate(own.actuators['restart']) 
264
+            dict['reload_timer'] = 250
265
+            dict['overlay_fadein'] = 1
291 266
             #Settings.loadlevel()
267
+            dict['load_timer'] = load_timer
292 268
         else: cont.deactivate(own.actuators['restart'])  
293 269
         if aBut == False and active_level_select == 6 and lasta == 1:
294 270
             level_text.text = ""
@@ -297,8 +273,11 @@ def main():
297 273
             own["level"] = level
298 274
             Settings.writeSettings()
299 275
             Settings.readSettings()
300
-            cont.activate(own.actuators['restart']) 
276
+            #cont.activate(own.actuators['restart']) 
277
+            dict['reload_timer'] = 250
278
+            dict['overlay_fadein'] = 1
301 279
             #Settings.loadlevel()
280
+            dict['load_timer'] = load_timer
302 281
         else: cont.deactivate(own.actuators['restart']) 
303 282
         if aBut == False and active_level_select == 7 and lasta == 1:
304 283
             level_text.text = ""
@@ -307,18 +286,24 @@ def main():
307 286
             own["level"] = level
308 287
             Settings.writeSettings()
309 288
             Settings.readSettings()
310
-            cont.activate(own.actuators['restart']) 
289
+            #cont.activate(own.actuators['restart']) 
290
+            dict['reload_timer'] = 250
291
+            dict['overlay_fadein'] = 1
311 292
             #Settings.loadlevel()
293
+            dict['load_timer'] = load_timer
312 294
         else: cont.deactivate(own.actuators['restart']) 
313 295
         if aBut == False and active_level_select == 8 and lasta == 1:
314 296
             level_text.text = ""
315
-            level = "level3"
316
-            main_empty["level"] = "spine"
297
+            level = "garage18"
298
+            main_empty["level"] = "garage18"
317 299
             own["level"] = level
318 300
             Settings.writeSettings()
319 301
             Settings.readSettings()
320
-            cont.activate(own.actuators['restart']) 
302
+            #cont.activate(own.actuators['restart']) 
321 303
             #Settings.loadlevel()
304
+            dict['load_timer'] = load_timer
305
+            dict['reload_timer'] = 250
306
+            dict['overlay_fadein'] = 1
322 307
         else: cont.deactivate(own.actuators['restart'])                                               
323 308
     else:
324 309
         own["active_level_select"] = -1 
@@ -331,7 +316,7 @@ def main():
331 316
     if bBut == 1:
332 317
         cont.activate(own.actuators['sBack']) 
333 318
         #cont.activate(own.actuators['exit']) 
334
-        print("bbut")
319
+        #print("bbut")
335 320
     #go to level submenu        
336 321
     if aBut == True and pstate == 2:
337 322
         cont.activate(own.actuators['sEnter']) 
@@ -377,8 +362,6 @@ def main():
377 362
             cc.actuators["sroll"].volume = .0001
378 363
             #cc.deactivate(own.actuators["sroll"])
379 364
             cc.actuators["sroll"].stopSound()            
380
-
381
-
382 365
  
383 366
     #print(pstate) 
384 367
     own["lastup"] = up

Loading…
Cancel
Save