Browse Source

misc unknown changes

shuvit 5 years ago
parent
commit
b9ff409ba5

+ 15
- 56
scripts/Manager.py View File

@@ -4,12 +4,16 @@ def main():
4 4
     #Modified BGE Gameplay Recorder Version 2
5 5
     #originally written by Nicholas Anderson, aka Red Frost Games.
6 6
     #"""
7
-
7
+    from bge import logic
8
+    import Record
9
+    import SortData    
10
+    dict = logic.globalDict
8 11
     #####Tweakables###############
9 12
     #Watch out! These numbers might bite!
10 13
     frame_rate = 60    #Set this to the framerate of your game.
11 14
     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.
15
+    recording_cutoff = dict['replay_record_length']
16
+    #recording_cutoff = 7300 #3600   #Frames at which the oldest recorded frame will be deleted. 0 is no cutoff.
13 17
     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 18
     allow_playback_break = True   #Allow the player to resume playing from the position in the recording.
15 19
     #####Sensor names#############
@@ -21,15 +25,13 @@ def main():
21 25
     break_sensor = "Break"
22 26
     ##############################
23 27
 
24
-    from bge import logic
25
-    import Record
26
-    import SortData
28
+
27 29
 
28 30
     cont = logic.getCurrentController()
29 31
     own = cont.owner
30 32
 
31 33
     cont.sensors[record_sensor].skippedTicks = optimization
32
-    dict = logic.globalDict
34
+    
33 35
 
34 36
     #dict['recorder_on'] = recorder_on
35 37
     recorder_on = dict.get('recorder_on')
@@ -61,29 +63,7 @@ def main():
61 63
         b_on = dict['bBut']
62 64
         #print(a on)
63 65
         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
71
-
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
-    #        
66
+      
87 67
         lLR = dict['lLR']
88 68
         lUD = dict['lUD']
89 69
         rLR = dict['rLR']
@@ -115,10 +95,6 @@ def main():
115 95
             pause_state = 0
116 96
             last_pause = 0          
117 97
            
118
-        #trigs results range 0 - .08
119
-        #print(lTrig, rTrig)
120
-
121
-        #if cont.sensors[record_sensor].positive:
122 98
         if own["playback"] != True:    
123 99
             Record.main(recording_cutoff, cube)
124 100
             
@@ -152,7 +128,9 @@ def main():
152 128
             own["objIndex"] += 2
153 129
             logic.setLogicTicRate(frame_rate*own["playbackSpeed"])
154 130
 
155
-        if own["playback"] == True:    
131
+        if own["playback"] == True: 
132
+            #print("objIndex = ", own["lengthPos"],  own['objIndex'])   
133
+            
156 134
             if rTrig > .01 and rTrig < .02:
157 135
                 own["objIndex"] += 2
158 136
                 logic.setLogicTicRate(frame_rate*.5) 
@@ -188,26 +166,10 @@ def main():
188 166
             if own['back_state'] == 0 and back_on == 1 and last_back == 0:       
189 167
                 own["playbackBroken"] = True
190 168
                 own["playback"] = False
191
-                #print("break - add hud, remove stance (back_state == False)")
192
-                #cont.activate(own.actuators['add_hud'])
193
-                #cont.activate(own.actuators['remove_stance'])
194
-                #removescene = cont.actuators["remove_hud"]
195
-                #removescene.scene = "replay_HUD"
196
-                #addscene = cont.actuators["add_hud"]
197
-                #addscene.scene = "stance"
198
-                #cont.activate(addscene)        
199
-                #cont.activate(removescene)
169
+
200 170
             elif own["playbackBroken"] and back_on == 0:
201 171
                 Record.breakOut()
202
-                #cont.activate(own.actuators['remove_hud'])
203
-                #cont.activate(own.actuators['add_stance'])
204
-                #addscene = cont.actuators["add_hud"]
205
-                #addscene.scene = "replay_HUD"
206
-                #removescene = cont.actuators["remove_hud"]
207
-                #removescene.scene = "stance"
208
-                #cont.activate(addscene)
209
-                #cont.activate(removescene)
210
-                
172
+
211 173
                 logic.setLogicTicRate(frame_rate)
212 174
                 #set value index
213 175
                 own.state = recorder_state
@@ -218,10 +180,7 @@ def main():
218 180
                 cont.activate(own.actuators['replayCam'])
219 181
                 #print("unbreak")
220 182
                 own['loop_play'] = 0
221
-                #own['valueIndex'] = 0
222
-                #own["objIndex"] += 2
223
-                #logic.setLogicTicRate(frame_rate*1)
224
-                #own['objectIndex'] = 0
183
+
225 184
                 #print("valueIndex = ", own['valueIndex'])
226 185
         if back_on == 1 and own['back_but'] == 0:
227 186
             #print("change back state")

+ 7
- 4
scripts/Record.py View File

@@ -1,4 +1,5 @@
1 1
 #record
2
+import bge
2 3
 from bge import logic
3 4
 from mathutils import Vector
4 5
 from SortData import *
@@ -193,7 +194,7 @@ def loadData():
193 194
     
194 195
     #Function for loading the data from
195 196
     #the disk and setting it.
196
-    
197
+    dict = bge.logic.globalDict
197 198
     objIndex = own["objIndex"]
198 199
     own["valueIndex"] = objIndex + 1
199 200
     valueIndex = own["valueIndex"]
@@ -236,13 +237,15 @@ def loadData():
236 237
     
237 238
     #-----Position-----#
238 239
     own["lengthPos"] = readData.getLengthPos()
240
+    dict['replay_loop_end'] = own['lengthPos']
241
+    print('setting replay end', dict['replay_loop_end'])
239 242
     lengthPos = own["lengthPos"] 
240 243
     
241 244
     if lengthPos:
242 245
         
243 246
         if objIndex > lengthPos-1:
244
-            own["objIndex"] = 0
245
-        if objIndex < 0:
247
+            own["objIndex"] = dict['replay_loop_start']
248
+        if objIndex < dict['replay_loop_start']:
246 249
             own["objIndex"] = lengthPos-2
247 250
 
248 251
         name, position = readData.returnPosition(objIndex, valueIndex)
@@ -395,7 +398,7 @@ def loadData():
395 398
                         deck.playAction(deckanim, DAF,DAF, layer=9999, play_mode=1, speed=1)
396 399
                         trucks.playAction(deckanim, DAF,DAF, layer=9999, play_mode=1, speed=1)
397 400
                     else:
398
-                        print('play a_reg')  
401
+                        #print('play a_reg')  
399 402
                         deck.playAction(deckanim, DAF,DAF, layer=9999, play_mode=1, speed=1)
400 403
                         trucks.playAction('a_reg', DAF,DAF, layer=9999, play_mode=1, speed=1)                          
401 404
                 #print("Playing: ", deckanim, PAF)

+ 7
- 1
scripts/Startup.py View File

@@ -148,6 +148,12 @@ def main():
148 148
     dict['cur_ccH_targetHeight'] = .3
149 149
     dict['music_start'] = False  
150 150
     dict['npause'] = False
151
-    dict['playback'] = False  
151
+    dict['playback'] = False 
152
+    dict['sunx'] = 1.0
153
+    dict['suny'] = 1.0
154
+    dict['sunz'] = 1.0 
155
+    dict['replay_loop_start'] = 0
156
+    dict['replay_loop_end'] = 0
157
+    dict['replay_record_length'] = 7300
152 158
     
153 159
 main()

+ 372
- 0
scripts/actionsFSM.py View File

@@ -0,0 +1,372 @@
1
+import bge
2
+from random import randint
3
+import actionsFSMlist
4
+
5
+MAIN_LAYER = 10
6
+TRANS_LAYER = 12
7
+
8
+def getOwn():
9
+	cont = bge.logic.getCurrentController()
10
+	own = cont.owner
11
+	return own
12
+
13
+def transPlaying():
14
+	scene = bge.logic.getCurrentScene()
15
+	skater = scene.objects['Char4']
16
+	if skater.isPlayingAction(TRANS_LAYER):
17
+		return True
18
+	else:
19
+		return False	
20
+
21
+def stopTrans():
22
+	scene = bge.logic.getCurrentScene()
23
+	skater = scene.objects['Char4']
24
+	if skater.isPlayingAction(TRANS_LAYER):
25
+		skater.stopAction(TRANS_LAYER)	
26
+
27
+def getCurFrame():
28
+	scene = bge.logic.getCurrentScene()
29
+	skater = scene.objects['Char4']
30
+	if skater.isPlayingAction(TRANS_LAYER):
31
+		num = round(skater.getActionFrame(TRANS_LAYER), 3)
32
+		print('playing frame ', num)
33
+		return num
34
+	else:
35
+		return None	
36
+
37
+def interupt_request():
38
+	cont = bge.logic.getCurrentController()
39
+	own = cont.owner
40
+	print(own['requestAction'])
41
+	if own['requestAction'] in actionsFSMlist.reg_fliplist or own['requestAction'] in actionsFSMlist.fak_fliplist:
42
+		print('flip is true')
43
+		return True
44
+		
45
+	else:
46
+		return False						
47
+
48
+def actionPlayer(ac, FSM):
49
+	scene = bge.logic.getCurrentScene()
50
+	skater = scene.objects['Char4']
51
+	deck = scene.objects['deck']
52
+	trucks = scene.objects['trucks']
53
+	name = ac.FSM.action.s_action
54
+	start = ac.FSM.action.s_se[0]
55
+	end = ac.FSM.action.s_se[1]
56
+	layer = ac.FSM.action.layer
57
+	mode = ac.FSM.action.mode
58
+	speed = ac.FSM.action.speed
59
+	
60
+	skater.playAction(name, start,end, layer=layer, play_mode=mode, speed=speed)
61
+	
62
+def transEndPlayer(ac, FSM):
63
+
64
+	scene = bge.logic.getCurrentScene()
65
+	skater = scene.objects['Char4']
66
+	deck = scene.objects['deck']
67
+	trucks = scene.objects['trucks']
68
+	name = ac.FSM.action.s_action
69
+	end = ac.FSM.action.s_se[1]
70
+	
71
+	skater.playAction(name, end,end, layer=TRANS_LAYER, play_mode=1, speed=1)	
72
+
73
+#====================================
74
+class Transition(object):
75
+	def __init__(self, toState):
76
+		self.toState = toState
77
+	def Execute(self):
78
+		print('Transitioning ...', self.toState)
79
+
80
+#====================================   
81
+#====================================
82
+#====================================   
83
+#====================================
84
+#====================================   
85
+#====================================
86
+
87
+State = type("State", (object,), {})
88
+
89
+class State(object):
90
+	def __init__(self, FSM):
91
+		self.FSM = FSM
92
+		self.timer = 0
93
+		self.startTime = 0
94
+
95
+	def Enter(self):
96
+		self.timer = randint(0,5)
97
+		self.startTime = 0
98
+	def Execute(self):
99
+		print('Executing')
100
+	def Exit(self):
101
+		print('Exiting')
102
+
103
+#====================================
104
+#====================================		
105
+		
106
+class reg_roll(State):
107
+	def __init__(self,FSM):
108
+		super(reg_roll, self).__init__(FSM) 
109
+		
110
+	def Enter(self):
111
+		print('entering: ', type(self).__name__)
112
+		self.FSM.action = getattr(actionsFSMlist, type(self).__name__) 
113
+		super(reg_roll, self).Enter()
114
+		
115
+	def Execute(self):
116
+		print('executing: ', type(self).__name__)
117
+		self.FSM.stateLife += 1
118
+		actionPlayer(self, FSM)
119
+		own = getOwn()
120
+		if own['requestAction'] == 'reg_opos':
121
+			self.FSM.ToTransition('toreg_roll_to_opos') 
122
+		if own['requestAction'] == 'reg_turnLeft':
123
+			self.FSM.ToTransition('toreg_roll_to_left') 			  
124
+
125
+	def Exit(self):
126
+		print('exiting: ', type(self).__name__)
127
+
128
+
129
+class reg_opos(State):
130
+	def __init__(self,FSM):
131
+		super(reg_opos, self).__init__(FSM)    
132
+		
133
+	def Enter(self):
134
+		print('entering: ', type(self).__name__)
135
+		self.FSM.action = getattr(actionsFSMlist, type(self).__name__) 
136
+		super(reg_opos, self).Enter()
137
+		
138
+	def Execute(self):
139
+		print('executing: ', type(self).__name__)
140
+		self.FSM.stateLife += 1
141
+		dict = bge.logic.globalDict
142
+		actionPlayer(self, FSM)
143
+		own = getOwn()
144
+		if own['requestAction'] != 'reg_opos':      
145
+			self.FSM.ToTransition(self.FSM.action.parentTrans)
146
+	def Exit(self):
147
+		print('exiting: ', type(self).__name__)
148
+
149
+class reg_left(State):
150
+	def __init__(self,FSM):
151
+		super(reg_left, self).__init__(FSM)    
152
+		
153
+	def Enter(self):
154
+		print('entering: ', type(self).__name__)
155
+		self.FSM.action = getattr(actionsFSMlist, type(self).__name__) 
156
+		super(reg_left, self).Enter()
157
+		
158
+	def Execute(self):
159
+		print('executing: ', type(self).__name__)
160
+		self.FSM.stateLife += 1
161
+		actionPlayer(self, FSM)
162
+		own = getOwn()
163
+		if own['requestAction'] != self.FSM.action.requestAction:	
164
+			self.FSM.ToTransition(self.FSM.action.parentTrans) 
165
+			print('initing left')       
166
+	
167
+	def Exit(self):
168
+		print('exiting: ', type(self).__name__)	
169
+	
170
+#====================================
171
+#====================================
172
+
173
+class reg_roll_to_opos(State):
174
+	def __init__(self,FSM):
175
+		super(reg_roll_to_opos, self).__init__(FSM)    
176
+		
177
+	def Enter(self):
178
+		print('entering: ', type(self).__name__)
179
+		self.FSM.action = getattr(actionsFSMlist, type(self).__name__) 
180
+		super(reg_roll_to_opos, self).Enter()
181
+		
182
+	def Execute(self):
183
+		print('executing: ', type(self).__name__)
184
+		dict = bge.logic.globalDict
185
+		self.FSM.stateLife += 1
186
+		own = getOwn()
187
+		if own['requestAction'] == 'reg_roll':
188
+			print('requesting early out')
189
+			self.FSM.ToTransition('toreg_opos_to_roll')
190
+		if transPlaying() == False and self.FSM.stateLife > 2:		
191
+			self.FSM.ToTransition(self.FSM.action.parentTrans)
192
+			transEndPlayer(self, FSM)
193
+		else:
194
+			actionPlayer(self, FSM)
195
+
196
+	def Exit(self):
197
+		print('exiting: ', type(self).__name__)
198
+
199
+class reg_opos_to_roll(State):
200
+	def __init__(self,FSM):
201
+		super(reg_opos_to_roll, self).__init__(FSM) 
202
+		
203
+	def Enter(self):
204
+		print('entering: ', type(self).__name__)
205
+		self.FSM.action = getattr(actionsFSMlist, type(self).__name__) 
206
+		super(reg_opos_to_roll, self).Enter()
207
+
208
+		old_state = self.FSM.prevState
209
+		if getCurFrame() != None:	
210
+			print('do the things', old_state.FSM.currentFrame, getCurFrame())
211
+			self.FSM.action.s_se[0] = getCurFrame()
212
+		
213
+	def Execute(self):
214
+		print('executing: ', type(self).__name__)
215
+		self.FSM.stateLife += 1
216
+		if transPlaying() == False and self.FSM.stateLife > 2:		
217
+			self.FSM.ToTransition('toreg_roll')
218
+			transEndPlayer(self, FSM)
219
+		else:
220
+			actionPlayer(self, FSM)	        
221
+	
222
+	def Exit(self):
223
+		print('exiting: ', type(self).__name__)	
224
+					   
225
+class reg_roll_to_left(State):
226
+	def __init__(self,FSM):
227
+		super(reg_roll_to_left, self).__init__(FSM) 
228
+		
229
+	def Enter(self):
230
+		print('entering: ', type(self).__name__)
231
+		self.FSM.action = getattr(actionsFSMlist, type(self).__name__) 
232
+		super(reg_roll_to_left, self).Enter()
233
+
234
+		old_state = self.FSM.prevState
235
+		if getCurFrame() != None:	
236
+			print('current frame is', getCurFrame())
237
+			self.FSM.action.s_se[0] = getCurFrame()
238
+		
239
+	def Execute(self):
240
+		print('executing: ', type(self).__name__)
241
+		dict = bge.logic.globalDict
242
+		self.FSM.stateLife += 1
243
+		own = getOwn()
244
+		if own['requestAction'] == 'reg_roll':
245
+			self.FSM.ToTransition('toreg_left_to_roll')
246
+		if transPlaying() == False and self.FSM.stateLife > 2:		
247
+			self.FSM.ToTransition('toreg_left')
248
+			transEndPlayer(self, FSM)
249
+		else:
250
+			actionPlayer(self, FSM)        
251
+	
252
+	def Exit(self):
253
+		print('exiting: ', type(self).__name__)	
254
+
255
+class reg_left_to_roll(State):
256
+	def __init__(self,FSM):
257
+		super(reg_left_to_roll, self).__init__(FSM) 
258
+		
259
+	def Enter(self):
260
+		print('entering: ', type(self).__name__)
261
+		self.FSM.action = getattr(actionsFSMlist, type(self).__name__) 
262
+		super(reg_left_to_roll, self).Enter()
263
+
264
+		old_state = self.FSM.prevState
265
+		if getCurFrame() != None:	
266
+			print('do the things', old_state.FSM.currentFrame, getCurFrame())
267
+			self.FSM.action.s_se[0] = getCurFrame()
268
+		
269
+	def Execute(self):
270
+		print('executing: ', type(self).__name__)
271
+		dict = bge.logic.globalDict
272
+		self.FSM.stateLife += 1
273
+		if transPlaying() == False and self.FSM.stateLife > 2:		
274
+			self.FSM.ToTransition('toreg_roll')
275
+			transEndPlayer(self, FSM)
276
+		else:
277
+			actionPlayer(self, FSM)	        
278
+	
279
+	def Exit(self):
280
+		print('exiting: ', type(self).__name__)		
281
+					 
282
+#===================================
283
+#====================================						
284
+
285
+class FSM(object):
286
+	def __init__ (self, character):
287
+
288
+		try:
289
+			self.char = self.char
290
+
291
+		except:	
292
+
293
+			self.char = character
294
+			self.states = {}
295
+			self.transitions = {}
296
+			self.curState = None
297
+			self.prevState = None
298
+			self.stateLife = 0
299
+			self.currentFrame = 0.0
300
+			self.name = ''
301
+			  
302
+			self.action = []
303
+
304
+			print('always init')
305
+	def AddTransition(self, transName, transition):
306
+		self.transitions[transName] = transition
307
+	
308
+	def AddState(self, stateName, state):
309
+		self.states[stateName] = state        
310
+		
311
+	def SetState(self, stateName):
312
+		self.prevState = self.curState
313
+		self.curState = self.states[stateName]
314
+		
315
+	def ToTransition(self, toTrans):
316
+		self.trans = self.transitions[toTrans]
317
+		
318
+	def Execute(self):
319
+		if (self.trans):
320
+			self.curState.Exit()
321
+			self.trans.Execute()
322
+			self.SetState(self.trans.toState)
323
+			self.curState.Enter()
324
+			self.trans = None        
325
+		self.curState.Execute()    
326
+				
327
+#====================================
328
+Char = type("Char",(object,),{})
329
+
330
+class StateMachine(Char):
331
+	def __init__(self):
332
+		self.FSM = FSM(self)
333
+		
334
+		##STATES
335
+		self.FSM.AddState('reg_roll', reg_roll(self.FSM))
336
+		self.FSM.AddState('reg_opos', reg_opos(self.FSM))
337
+		self.FSM.AddState('reg_roll_to_opos', reg_roll_to_opos(self.FSM))
338
+		self.FSM.AddState('reg_opos_to_roll', reg_opos_to_roll(self.FSM))
339
+		self.FSM.AddState('reg_left', reg_left(self.FSM))
340
+		self.FSM.AddState('reg_left_to_roll', reg_left_to_roll(self.FSM))
341
+		self.FSM.AddState('reg_roll_to_left', reg_roll_to_left(self.FSM))
342
+
343
+		#TRANSITIONS
344
+		self.FSM.AddTransition('toreg_roll', Transition('reg_roll'))
345
+		self.FSM.AddTransition('toreg_opos', Transition('reg_opos'))
346
+		self.FSM.AddTransition('toreg_roll_to_opos', Transition('reg_roll_to_opos'))
347
+		self.FSM.AddTransition('toreg_opos_to_roll', Transition('reg_opos_to_roll'))
348
+		self.FSM.AddTransition('toreg_left', Transition('reg_left'))
349
+		self.FSM.AddTransition('toreg_left_to_roll', Transition('reg_left_to_roll'))
350
+		self.FSM.AddTransition('toreg_roll_to_left', Transition('reg_roll_to_left'))
351
+
352
+		if self.FSM.curState == None:
353
+			self.FSM.SetState('reg_roll')
354
+			self.FSM.ToTransition('toreg_roll')
355
+			print('      -= Initializing Action Player State Machine =-')
356
+	
357
+	def Execute(self):
358
+		self.FSM.Execute()    
359
+#====================================     
360
+r = StateMachine()
361
+def main(cont):
362
+	own = cont.owner   
363
+	if 'inited' not in own:
364
+		own['inited'] = True
365
+		own['frame'] = 0
366
+		own['state'] = 'On'
367
+		print('initing')
368
+
369
+	r.Execute()    
370
+	own['frame'] += 1
371
+	if interupt_request():
372
+		print('interupt request')

+ 131
- 0
scripts/actionsFSMlist.py View File

@@ -0,0 +1,131 @@
1
+TRANS_LAYER = 12
2
+MAIN_LAYER = 10
3
+
4
+reg_fliplist = ['reg_ollie', 'reg_nollie', 'reg_nollie', 'reg_kickflip', 'reg_varial_kickflip', 'reg_nollie_varial_kickflip', 'reg_nollie_varial_heelflip', 'fak_nollie_varial_heelflip', 'reg_varial_heelflip', 'reg_nollie_kickflip',  'reg_heelflip', 'reg_nollie_heelflip', 'reg_shuvit', 'reg_shuvit360', 'reg_fsshuvit360', 'reg_nollie_shuvit', 'fak_nollie_shuvit', 'reg_fsshuvit', 'fak_fsshuvit',  'reg_nollie_fsshuvit', 'reg_nollie_shuvit360', 'reg_nollie_fsshuvit', 'reg_brfoot', 'reg_frfoot', 'reg_blfoot', 'reg_flfoot', 'reg_inward_heelflip', 'reg_hardflip', 'reg_nollie_inward_heelflip', 'reg_nollie_hardflip', 'reg_offboard', 'reg_nollie_fsshuvit_360'] 
5
+fak_fliplist = ['fak_ollie', 'fak_nollie', 'fak_nollie', 'fak_kickflip', 'fak_varial_kickflip', 'fak_nollie_varial_kickflip', 'fak_nollie_varial_heelflip', 'fak_nollie_varial_heelflip', 'fak_varial_heelflip', 'fak_nollie_kickflip',  'fak_heelflip','fak_nollie_heelflip', 'fak_shuvit', 'fak_shuvit360', 'fak_fsshuvit360', 'fak_nollie_shuvit', 'fak_nollie_shuvit', 'fak_fsshuvit', 'fak_fsshuvit',  'fak_nollie_fsshuvit', 'fak_nollie_shuvit360', 'fak_nollie_fsshuvit', 'fak_brfoot', 'fak_frfoot', 'fak_blfoot', 'fak_flfoot', 'fak_inward_heelflip', 'fak_hardflip', 'fak_nollie_inward_heelflip', 'fak_nollie_hardflip', 'fak_offboard', 'fak_nollie_fsshuvit_360']     
6
+
7
+
8
+class a_class:
9
+    pass
10
+#------------------------------
11
+reg_roll = a_class()
12
+reg_roll.name = 'reg_roll'
13
+reg_roll.parent = []
14
+#reg_roll.siblings['fak_roll']
15
+reg_roll.s_action = 'nreg'
16
+reg_roll.s_se = [1, 60]
17
+reg_roll.d_action = 'a_reg'
18
+reg_roll.d_se = [0, 10]
19
+reg_roll.t_action = 'a_reg'
20
+reg_roll.t_se = [0, 10]
21
+reg_roll.stateLife = 1
22
+reg_roll.layer = MAIN_LAYER
23
+reg_roll.speed = 1
24
+reg_roll.mode = 0
25
+#------------------------------
26
+reg_opos = a_class()
27
+reg_opos.name = 'reg_opos'
28
+reg_opos.parent = ['reg_roll']
29
+reg_opos.parentTrans = 'toreg_opos_to_roll'
30
+reg_opos.requestAction = 'reg_opos'
31
+#reg_roll.siblings['']
32
+reg_opos.s_action = 'nopos'
33
+reg_opos.s_se = [1, 40]
34
+reg_opos.d_action = 'a_reg'
35
+reg_opos.d_se = [0, 10]
36
+reg_opos.t_action = 'a_reg'
37
+reg_opos.t_se = [0, 10]
38
+reg_opos.stateLife = 1
39
+reg_opos.layer = MAIN_LAYER
40
+reg_opos.speed = 1
41
+reg_opos.mode = 0
42
+#------------------------------
43
+reg_left = a_class()
44
+reg_left.name = 'reg_left'
45
+reg_left.parent = ['reg_roll']
46
+reg_left.parentTrans = 'toreg_left_to_roll'
47
+reg_left.requestAction = 'reg_turnLeft'
48
+reg_left.s_action = 'nreg_left'
49
+reg_left.s_se = [10, 10]
50
+reg_left.d_action = 'a_reg_left'
51
+reg_left.d_se = [0, 10]
52
+reg_left.t_action = 'a_reg'
53
+reg_left.t_se = [0, 10]
54
+reg_left.stateLife = 1
55
+reg_left.layer = MAIN_LAYER
56
+reg_left.speed = 1
57
+reg_left.mode = 0
58
+#------------------------------
59
+reg_roll_to_opos = a_class()
60
+reg_roll_to_opos.name = 'reg_roll_to_opos'
61
+reg_roll_to_opos.parent = ['reg_roll']
62
+reg_roll_to_opos.parentTrans = 'toreg_opos'
63
+reg_roll_to_opos.s_action = 'noposin'
64
+reg_roll_to_opos.s_se = [1, 20]
65
+reg_roll_to_opos.d_action = 'a_reg'
66
+reg_roll_to_opos.d_se = [0, 10]
67
+reg_roll_to_opos.t_action = 'a_reg'
68
+reg_roll_to_opos.t_se = [0, 10]
69
+reg_roll_to_opos.stateLife = 1
70
+reg_roll_to_opos.layer = TRANS_LAYER
71
+reg_roll_to_opos.speed = 1
72
+reg_roll_to_opos.mode = 0
73
+#------------------------------
74
+reg_opos_to_roll = a_class()
75
+reg_opos_to_roll.name = 'reg_opos_to_roll'
76
+reg_opos_to_roll.parent = ['reg_roll']
77
+reg_opos_to_roll.s_action = 'noposin'
78
+reg_opos_to_roll.s_se = [20, 1]
79
+reg_opos_to_roll.d_action = 'a_reg'
80
+reg_opos_to_roll.d_se = [0, 10]
81
+reg_opos_to_roll.t_action = 'a_reg'
82
+reg_opos_to_roll.t_se = [0, 10]
83
+reg_opos_to_roll.stateLife = 1
84
+reg_opos_to_roll.layer = TRANS_LAYER
85
+reg_opos_to_roll.speed = 1
86
+reg_opos_to_roll.mode = 0
87
+#------------------------------
88
+reg_roll_to_left = a_class()
89
+reg_roll_to_left.name = 'reg_roll_to_left'
90
+reg_roll_to_left.parent = ['reg_roll']
91
+reg_roll_to_left.s_action = 'nreg_left'
92
+reg_roll_to_left.s_se = [1, 10]
93
+reg_roll_to_left.d_action = 'a_reg'
94
+reg_roll_to_left.d_se = [0, 10]
95
+reg_roll_to_left.t_action = 'a_reg'
96
+reg_roll_to_left.t_se = [0, 10]
97
+reg_roll_to_left.stateLife = 1
98
+reg_roll_to_left.layer = TRANS_LAYER
99
+reg_roll_to_left.speed = .5
100
+reg_roll_to_left.mode = 0
101
+#------------------------------
102
+reg_left_to_roll = a_class()
103
+reg_left_to_roll.name = 'reg_left_to_roll'
104
+reg_left_to_roll.parent = ['reg_roll']
105
+reg_left_to_roll.s_action = 'nreg_left'
106
+reg_left_to_roll.s_se = [10, 1]
107
+reg_left_to_roll.d_action = 'a_reg'
108
+reg_left_to_roll.d_se = [0, 10]
109
+reg_left_to_roll.t_action = 'a_reg'
110
+reg_left_to_roll.t_se = [0, 10]
111
+reg_left_to_roll.stateLife = 1
112
+reg_left_to_roll.layer = TRANS_LAYER
113
+reg_left_to_roll.speed = .5
114
+reg_left_to_roll.mode = 0
115
+#------------------------------
116
+reg_left_to_roll = a_class()
117
+reg_left_to_roll.name = 'reg_ollie'
118
+reg_left_to_roll.parent = ['reg_roll']
119
+reg_left_to_roll.s_action = 'reg_ollie'
120
+reg_left_to_roll.s_se = [1, 20]
121
+reg_left_to_roll.d_action = 'a_reg_ollie'
122
+reg_left_to_roll.d_se = [1, 20]
123
+reg_left_to_roll.t_action = 't_reg_ollie'
124
+reg_left_to_roll.t_se = [1, 20]
125
+reg_left_to_roll.stateLife = 1
126
+reg_left_to_roll.layer = TRANS_LAYER
127
+reg_left_to_roll.speed = .5
128
+reg_left_to_roll.mode = 0
129
+#------------------------------
130
+
131
+#reg_ollie

+ 29
- 7
scripts/camera.py View File

@@ -3,9 +3,10 @@ import bge
3 3
 import mathutils
4 4
 from mathutils import *
5 5
 scene = bge.logic.getCurrentScene()
6
-cont = bge.logic.getCurrentController()
7
-own = cont.owner
8
-def main():
6
+#cont = bge.logic.getCurrentController()
7
+#own = cont.owner
8
+def main(cont):
9
+    own = cont.owner
9 10
     dict = bge.logic.globalDict 
10 11
     camempty = scene.objects['camEmpty.001']
11 12
     controlcube = scene.objects['control_cube.002']
@@ -70,6 +71,7 @@ def main():
70 71
     #if 1 == 1:
71 72
     #if own['playback'] == False:
72 73
     if controlcube['driving'] == False:
74
+        LAST_GRIND = False
73 75
         if down.triggered == True and LAST_GRIND == False and walk == 0:
74 76
             hitPosition = down.hitPosition
75 77
             distance = own.getDistanceTo(hitPosition)
@@ -137,20 +139,38 @@ def main():
137 139
         obj = cont.owner
138 140
         cube = controlcube
139 141
         to = cube
142
+        #print(to.worldPosition)
143
+        to2 = to.worldPosition
144
+        pos = [to.worldPosition.x, to.worldPosition.y, to.worldPosition.z]
145
+        
146
+        pos[2] = pos[2] - .2
147
+        #print(pos)
148
+
140 149
         from2 = obj
150
+        #print(from2)
151
+        from3 = [from2.worldPosition.x, from2.worldPosition.y, from2.worldPosition.z]
152
+        from3[2] = from3[2] - .2
141 153
         distance = 0.0
142 154
         property = ""
143 155
         face = 1
144 156
         xray = 0
145 157
         poly = 0
146
-        hit = obj.rayCast( to, from2, distance, property, face, xray, poly)
158
+        hit = obj.rayCast( pos, from3, distance, property, face, xray, poly)
159
+        #bge.render.drawLine(pos,from3, [1,0,0])
147 160
         control = "control_cube.002"
148 161
         hitobj = hit[0]
149 162
         hitobj = str(hitobj)
150 163
         if hitobj != control and walk == 0:
164
+            
151 165
             cam.damping = .0 
152
-            if cam.height < 3:
166
+            if cam.height < 2:
153 167
                 cam.height = cam_height + .1
168
+                cam.max = cam.max - .2
169
+                #print('small move')
170
+            elif cam.height >= 2 and cam.height < 4:
171
+                cam.height = cam_height + .05
172
+                cam.max = cam.max - .05                
173
+                #print('big move')
154 174
     
155 175
     if dict['menu_idle_timer'] > 300:
156 176
         move_len = 2048
@@ -259,7 +279,9 @@ def main():
259 279
                 dict['cur_ccH_targetHeight'] = dict['cam_walk_height']
260 280
                 
261 281
         cam.min = dict['cam_walk_min'] 
262
-        cam.max = dict['cam_walk_max']        
282
+        cam.max = dict['cam_walk_max'] 
283
+
284
+        #print('walk cam')       
263 285
         #ccH_targetHeight = .9
264 286
     else:  
265 287
 
@@ -360,4 +382,4 @@ def main():
360 382
         pass    
361 383
     
362 384
                     
363
-main()
385
+#main()

+ 21
- 2
scripts/co_ActionState.py View File

@@ -1,5 +1,5 @@
1 1
 import bge
2
-
2
+import actionsFSM
3 3
 
4 4
 def main():
5 5
 
@@ -880,7 +880,24 @@ def main():
880 880
         if l_actionState == 'fak-reg_roll' and requestAction in ['fak_pump_right', 'fak_pump_left']:
881 881
             requestAction = 'fak_pump'
882 882
         if l_actionState == 'reg-fak_roll' and requestAction in ['reg_pump_right', 'reg_pump_left']:
883
-            requestAction = 'reg_pump'            
883
+            requestAction = 'reg_pump'  
884
+
885
+        if l_actionState == 'reg_air-roll' and requestAction == 'reg_5050' and actionTimer > 5:
886
+            requestAction = 'reg_5050'
887
+            #print('doing the thing')
888
+        tl = ['reg_turnLeft', 'reg_turnRight', 'reg_turnLeft_out', 'reg_turnRight_out']    
889
+        if l_actionState in tl and requestAction not in tl:
890
+            requestAction = 'reg_roll' 
891
+            #print('doing the other thing') 
892
+
893
+        if l_actionState == 'reg_air-roll' and requestAction != 'reg_air-roll':
894
+            requestAction = 'reg_roll'      
895
+            #print('doing the third thing')
896
+
897
+        if l_actionState == 'reg_roll' and requestAction == 'reg_5050':
898
+            requestAction = 'reg_air'
899
+            #print('doing the 4th thing')    
900
+
884 901
                                                                                   
885 902
 #---------------------------------------------------                                                                                  
886 903
                                                                                   
@@ -4848,5 +4865,7 @@ def main():
4848 4865
     own['l_actionState'] = actionState
4849 4866
     own['l_requestAction'] = requestAction
4850 4867
     own['queueAction'] = queueAction
4868
+
4869
+    #actionsFSM.main(cont)
4851 4870
     
4852 4871
 main()

+ 1
- 1
scripts/colors.py View File

@@ -52,7 +52,7 @@ def main():
52 52
     #print(dict['shirt_color'])
53 53
     scol = [dict['shirt_color_r'], dict['shirt_color_g'], dict['shirt_color_b'], 1]
54 54
     deckC = [dict['deck_color_r'], dict['deck_color_g'], dict['deck_color_b'], 1]
55
-    print(scol)
55
+    #print(scol)
56 56
     shirt.color = scol
57 57
     deck.color = deckC
58 58
     throw_deck.color = deckC

+ 45
- 20
scripts/controller2.py View File

@@ -1583,6 +1583,8 @@ def main():
1583 1583
                     own.applyRotation( rotation, True) 
1584 1584
                     
1585 1585
     def air():
1586
+        if r_ground.triggered == False and own['airup'] == 1:
1587
+            own.alignAxisToVect(gray.hitNormal, 2, .03)
1586 1588
         if r_ground.triggered == False and own['airup'] == 0:
1587 1589
              
1588 1590
             distance = own.getDistanceTo(gray.hitPosition)
@@ -4353,22 +4355,39 @@ def main():
4353 4355
     own["last_sel"] = own["sel"]
4354 4356
     own["sel"] = bkBut  
4355 4357
 
4356
-    if r_ground.triggered and own["jump_timer"] < 20 and own['rotz'] > .65:
4357
-        force2 = [0.0, 0, dict['antibounce']]
4358
-        #own.applyForce(force2, True)
4359
-
4360
-        gdist = ((own.worldPosition.z - r_ground.hitPosition[2]))  
4361
-        #print(gdist)
4362
-        if gdist < .2875 and gdist > .1:
4363
-            #move = 2.875 - gdist
4364
-            move = (.2875 - gdist)*.33
4365
-            #move = (own.worldPosition.z + gdist)
4366
-            if move > 0:
4367
-                own.worldPosition.z = own.worldPosition.z + move
4368
-            else:
4369
-                own.worldPosition.z = own.worldPosition.z - move    
4370
-            own.linearVelocity.z = 0
4371
-           
4358
+    if r_ground.triggered and own["jump_timer"] < 20:
4359
+        #if own['rotz'] > .65:
4360
+        #if own['rotz'] > .15: 
4361
+        if 1 == 1:    
4362
+            force2 = [0.0, 0, dict['antibounce']]
4363
+            #own.applyForce(force2, True)
4364
+
4365
+            gdist = ((own.worldPosition.z - r_ground.hitPosition[2]))  
4366
+            #print(gdist)
4367
+            if gdist < .2875 and gdist > .1:
4368
+                #move = 2.875 - gdist
4369
+                move = (.2875 - gdist)*.33
4370
+                #move = (own.worldPosition.z + gdist)
4371
+                if move > 0:
4372
+                    own.worldPosition.z = own.worldPosition.z + move
4373
+                else:
4374
+                    own.worldPosition.z = own.worldPosition.z - move    
4375
+                own.linearVelocity.z = 0
4376
+        else:
4377
+            gdist = ((own.worldPosition.z - r_ground.hitPosition[2]))  
4378
+            #print(gdist)
4379
+            if gdist < .2875 and gdist > .1:
4380
+                #move = 2.875 - gdist
4381
+                #move = (.2875 - gdist)*.33
4382
+                move = (.2875 - gdist)*.4
4383
+                #move = (own.worldPosition.z + gdist)
4384
+                if move > 0:
4385
+                    own.worldPosition.z = own.worldPosition.z + move
4386
+                else:
4387
+                    own.worldPosition.z = own.worldPosition.z - move    
4388
+                own.linearVelocity.z = 0            
4389
+                
4390
+    
4372 4391
 
4373 4392
     Axis = 2 
4374 4393
     Distance = -10
@@ -4386,14 +4405,20 @@ def main():
4386 4405
         if localHitDist < .287:
4387 4406
             own.localPosition[2] += (.287 - localHitDist)
4388 4407
             if localRay[2] != [0,0,-1] and grindHit == 0:
4389
-                own.alignAxisToVect(localRay[2], 2, .5)
4408
+                own.alignAxisToVect(localRay[2], 2, .75)
4390 4409
                 #print('moving local')
4391 4410
 
4392
-
4393
-    #rend = bge.render
4411
+    # if own['LAST_GRIND'] == False and touched:
4412
+    #     print('touching but not grinding')
4413
+    #     if STANCE == 0:
4414
+    #         own.applyMovement([-.05, 0, .01], True)
4415
+    #     else:
4416
+    #         own.applyMovement([.05, 0, .01], True)    
4417
+    # #rend = bge.render
4394 4418
     #rend.drawLine(Start, End, [1,0,0,1])
4395 4419
     #print(own['rotz'])
4396 4420
 
4421
+
4397 4422
     if own.linearVelocity.x > 10:
4398 4423
         own.linearVelocity.x = 10
4399 4424
     if (grindDar == False and r_ground.triggered and own['grindTouch'] == False) or own['jump_timer'] > 40:
@@ -4401,4 +4426,4 @@ def main():
4401 4426
     
4402 4427
     dict['walk'] = 0  
4403 4428
 
4404
-    print(own["LAST_GRIND"])
4429
+    #print(own["LAST_GRIND"])

+ 47
- 16
scripts/menuV3.py
File diff suppressed because it is too large
View File


+ 13
- 1
scripts/scene_init.py View File

@@ -122,7 +122,19 @@ def main():
122 122
     else:
123 123
         print('not starting music', dict['music_player'])        
124 124
         
125
-    scene.world.envLightEnergy = dict['ambient_strength']   
125
+    
126
+
127
+    for x in scene.objects:
128
+        if 'hemi' in x:
129
+            if 'down' in x:
130
+                x.energy = dict['ambient_strength']
131
+            else:
132
+                x.energy = dict['ambient_strength'] * .7    
133
+
134
+
135
+
136
+    #scene.world.envLightEnergy = dict['ambient_strength']   
137
+    scene.world.envLightEnergy = 0
126 138
     
127 139
     cam['BC_BRIGHTNESS'] = dict['BC_BRIGHTNESS'] 
128 140
     cam['BC_CONTRAST'] = dict['BC_CONTRAST']

+ 0
- 1
scripts/walk.py View File

@@ -11,7 +11,6 @@ def main(cont):
11 11
     
12 12
     scene = bge.logic.getCurrentScene()
13 13
     objList = scene.objects
14
-
15 14
     cont = GameLogic.getCurrentController() 
16 15
     obj = bge.logic.getCurrentScene().objects
17 16
     char = bge.constraints.getCharacter

Loading…
Cancel
Save