shuvit 11 months ago
parent
commit
ccd62625b6

+ 3
- 0
assets/foiliage_b.blend View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:41e28fb10464bc68bcac66ddee5e21ffc460fa9207706b108802910e130b96bb
3
+size 43079304

+ 3
- 0
assets/levels/mini/user2.blend View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:97270cdd70f1424750c52c51b3f0de032422160ad3a6ee7532830b4f2813dbb6
3
+size 1211092

+ 3
- 0
assets/levels/scratch/level.blend View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:59be75f7d28822ee6fd219d2f812c7411f69ccbd2679e1f3b67c71b3aa7396d5
3
+size 580320

+ 3
- 0
assets/levels/user2.blend View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:0536309cdac72fe106d4ca3b9a6f268d02831c90346df3de24d98991dc01339d
3
+size 1211092

+ 2
- 2
assets/materials/base_m_kit.blend View File

@@ -1,3 +1,3 @@
1 1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:312fc9b6c449f378acf47324d17c2270e5aabdf5ec22fb02f39beadf330a9607
3
-size 35615708
2
+oid sha256:c182c5eb0c2bd584a523fab0cd26dd30cb10a2b852eec3513da70bac981703df
3
+size 35791236

+ 3
- 0
assets/materials/textures/mountainslab01.png View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:cc9fed23a67d718e5c652f8526b172aadfaab07d4225e47e0d045cfca36b8196
3
+size 2133217

+ 3
- 0
assets/materials/textures/mountainslab01_n.png View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:b94ed76136f89259a2404282b30fbbabdb637ae6cad9ed3eed45ada974dbecd7
3
+size 3106803

+ 3
- 0
assets/materials/textures/pineforest03.png View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:fec904ada5445f0a1d970a29b6029206d0396b6d8c0b5fcd458739cc3b9c2803
3
+size 2613192

+ 3
- 0
assets/materials/textures/pineforest03_n.png View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:72e39a36c94b29279c26f86765645a3ed599f7b5b450ed470abed4d611394a2f
3
+size 2281480

+ 2
- 2
assets/ramps.blend View File

@@ -1,3 +1,3 @@
1 1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:ad2104b41387da0af0e55284115b7a356ec7b1e2c2bc467822b4dfe144d7fcfc
3
-size 44324752
2
+oid sha256:dac8bd740361ce271c1b6590f2a9127bd17b0e1e6320a8c457160678af7fffac
3
+size 44741748

+ 2
- 2
assets/user2.blend View File

@@ -1,3 +1,3 @@
1 1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:9f55ffabdb22c80211d3a4fceb4f1e549c0b265c63163c66eaa5bc5ad3fe4174
3
-size 542792
2
+oid sha256:71ee4f8556b82e3b8e0c7b7424152a63b31f0a1b43bf75bf64fe1e16684aea35
3
+size 579232

+ 4
- 3
config.ini View File

@@ -153,10 +153,11 @@ gravity = -10.5
153 153
 fall_height = 0.5
154 154
 
155 155
 walk_force = 15
156
-run_force = 40
157
-max_walk_vel = 4
158
-max_run_vel = 20
156
+run_force = 35
157
+max_walk_vel = 1.5
158
+max_run_vel = 5
159 159
 walk_turn_amt = .03
160
+walk_jump_force = 1300
160 161
 
161 162
 #controller mappings
162 163
 ########

+ 3
- 0
scripts/Startup.py View File

@@ -109,5 +109,8 @@ def main(cont):
109 109
     dict['temp_list'] = []
110 110
     dict['scene_inited'] = True
111 111
     dict['p1c'] = None
112
+
113
+    dict['joy_con'] = False
114
+    
112 115
     
113 116
 #main()

+ 130
- 63
scripts/StatesPlayer.py View File

@@ -48,8 +48,6 @@ class Startup(State):
48 48
         self.FSM.stateLife += 1
49 49
 
50 50
         if self.FSM.stateLife == 5:
51
-            #Startup.main(self.FSM.owner['cont'])
52
-
53 51
             self.FSM.ToTransition('toWalk')
54 52
         print('player FSM')
55 53
         
@@ -64,17 +62,23 @@ class Walk(State):
64 62
         
65 63
     def Enter(self):
66 64
         self.FSM.stateLife = 1
67
-
68 65
         o = self.FSM.owner.obj
69 66
         c = self.FSM.owner
67
+        o['getoffboard'] = False
68
+        o['getonboard'] = False
69
+
70 70
         if c.arm == None:
71
-            print(o.childrenRecursive)
71
+            
72 72
             c.arm = o.childrenRecursive['Char4']
73 73
 
74 74
         self.walk_weight = 1
75 75
         self.run_weight = 1
76
-        self.run_speed = 1.0
76
+        self.run_speed = 0.0
77 77
         self.turn_weight = 0
78
+        self.FSM.owner.walking = True
79
+        dict['walking'] = True
80
+        dict['walk'] = 1
81
+        print('fsm enter walk')
78 82
 
79 83
         super(Walk, self).Enter()        
80 84
         
@@ -82,82 +86,83 @@ class Walk(State):
82 86
         self.FSM.stateLife += 1
83 87
         o = self.FSM.owner.obj
84 88
         c = self.FSM.owner
85
-        #print('walking')
89
+        #print(o.worldPosition.z)
90
+        #print(o['getonboard'], 'dict onboard')
91
+        #print(dict['walk'], 'fsm walk walk')
86 92
         if self.FSM.stateLife == 2:
87 93
             if o['stance']:
88
-                o.applyRotation([0,0,3], True)
94
+                o.applyRotation([0,0,3.14], True)
89 95
                 o['stance'] = False
90
-                o['requestAction'] = 'fak_offboard' 
91
-                print('request fak offboard')            
92
-            else:
93
-                o['requestAction'] = 'reg_offboard'                 
94
-                print('request reg offboard') 
95
-        if self.FSM.stateLife > 5:
96
-            o['requestAction'] = 'reg_idle'                 
97
-
98
-        self.check_onboard()
99
-        self.check_jump()
100
-        self.check_exit()
101
-        ray = c.get_ground_ray()
102
-        moving = c.walk_movement()
103
-
104
-        self.idle_blend()
105
-        self.get_walk_weight()
106
-        
107
-
96
+        #         o['requestAction'] = 'fak_offboard' 
97
+        #         print('request fak offboard')            
98
+        #     else:
99
+        #         o['requestAction'] = 'reg_offboard'                 
100
+        #         print('request reg offboard') 
101
+        # if self.FSM.stateLife > 5:
102
+        #     o['requestAction'] = 'reg_idle'                 
103
+        ground_rays = c.get_ground_ray()
104
+        if ground_rays[0][0] != None:
105
+            dist = c.get_ground_dist(ground_rays)
106
+            c.set_walk_z(dist)
107
+            #print(dist, 'setting height')
108
+
109
+        if self.FSM.stateLife > 4:
110
+            self.check_onboard()
111
+            self.check_jump()
112
+
113
+            moving = c.walk_movement()
114
+            
115
+            self.get_walk_weight()
116
+            self.idle_blend()
117
+        else:
118
+            dict['walk'] = 1
108 119
 
109 120
 
110
-        #self.FSM.ToTransition('toLand')
111 121
     def check_onboard(self):
122
+
123
+        o = self.FSM.owner.obj
124
+        print(o['getonboard'], 'getonboard')
125
+
126
+
127
+
112 128
         if dict['walk'] == 0:
129
+            o['getonboard'] = True
113 130
             self.FSM.ToTransition('toRoll')
114
-        if dict['yBut'] == 1 and dict['last_yBut'] == 0:
115
-            print('do the onboard')
131
+            print('onboard', dict['walk'], o['getonboard'])
116 132
 
117
-    def check_jump(self):
118
-        o = self.FSM.owner.obj
119
-        #limit fall speed
120
-        if o.linearVelocity.z < -10:
121
-            o.linearVelocity.z = -10
122
-        if dict['xBut'] == True or dict['kb_space'] == 1: 
123
-            if dict['last_xBut'] == 0:
124
-                o['requestAction'] ='reg_jump'  
125
-                JUMPHEIGHT = 1100
126
-                force = [ 0.0, 0.0, JUMPHEIGHT]
127
-                # use local axis
128
-                local = False
129
-                # apply force -- limit jump speed
130
-                if o.linearVelocity.z < 10:
131
-                    o.applyForce(force, local)
132
-                    o.linearVelocity.z += 5
133 133
 
134
-    def check_exit(self):
135
-        pass
136
-        #own['walk'] == 1
137 134
 
138 135
 
139 136
 
137
+        if dict['yBut'] == 1 and dict['last_yBut'] == 0:
138
+            o['getonboard'] = True
139
+            self.FSM.ToTransition('toRoll')
140
+
141
+    def check_jump(self):
142
+        if dict['xBut'] == True or dict['kb_space'] == 1: 
143
+            if dict['last_xBut'] == 0:
144
+                self.FSM.ToTransition('toWalkJump')
140 145
 
141 146
     def idle_blend(self):
142 147
         arm = self.FSM.owner.arm
143
-        arm.playAction('reg_idle1', 1,120, layer=6, play_mode=1, speed=1, blendin=10)
148
+        arm.playAction('reg_idle1', 1,120, layer=1, play_mode=1, speed=1, blendin=10)
144 149
         if self.FSM.stateLife > 20:
145
-            frame = arm.getActionFrame(7) + .5 * self.run_speed
150
+            frame = arm.getActionFrame(2) + .5 * self.run_speed
146 151
             if frame > 30:
147 152
                 frame = 0
148
-            arm.stopAction(7)
149
-            arm.playAction('reg_nwalk2', 0,30, layer=7, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.walk_weight)
150
-            arm.setActionFrame(frame, 7)
153
+            arm.stopAction(2)
154
+            arm.playAction('reg_nwalk3', 0,30, layer=2, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.walk_weight)
155
+            arm.setActionFrame(frame, 2)
151 156
             #print(self.walk_weight, frame)
152 157
 
153 158
             
154 159
 
155
-            frame = arm.getActionFrame(8) + .5 * self.run_speed
160
+            frame = arm.getActionFrame(3) + .5 * self.run_speed
156 161
             if frame > 30:
157 162
                 frame = 0
158
-            arm.stopAction(8)
159
-            arm.playAction('reg_run.002', 0,30, layer=8, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.run_weight)
160
-            arm.setActionFrame(frame, 8)
163
+            arm.stopAction(3)
164
+            arm.playAction('reg_run.003', 0,30, layer=3, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.run_weight)
165
+            arm.setActionFrame(frame, 3)
161 166
             #print(frame, 'frame')
162 167
             #print(self.run_weight, frame)
163 168
             
@@ -181,7 +186,7 @@ class Walk(State):
181 186
         w = abs(o.linearVelocity.x)
182 187
         #wt = 3.5
183 188
         #yt = 8
184
-        wt = 1.1
189
+        wt = 1.7
185 190
         yt = 3
186 191
         out2 = 0
187 192
         if w < wt:
@@ -217,10 +222,14 @@ class Walk(State):
217 222
             self.run_speed = 1.3
218 223
         else:
219 224
             self.run_speed = .8
220
-        print(self.run_speed, '---', self.walk_weight, 'walk weight', self.run_weight, 'run weight')
225
+        #print(self.run_speed, '---', self.walk_weight, 'walk weight', self.run_weight, 'run weight')
221 226
 
222 227
     def Exit(self):
223
-        pass
228
+        self.FSM.owner.arm.stopAction(0)
229
+        self.FSM.owner.arm.stopAction(1)
230
+        self.FSM.owner.arm.stopAction(2)
231
+        self.FSM.owner.arm.stopAction(3)
232
+        dict['walk'] = 0
224 233
 
225 234
 
226 235
 #==================================== 
@@ -231,14 +240,35 @@ class WalkAir(State):
231 240
         
232 241
     def Enter(self):
233 242
         self.FSM.stateLife = 1
243
+        #arm = self.FSM.owner.arm
244
+        #arm.playAction('a_jump_t', 27, 27, layer=1, play_mode=0, speed=1, blendin=5)
234 245
         super(WalkAir, self).Enter()        
235 246
         
236 247
     def Execute(self):
237 248
         self.FSM.stateLife += 1
238 249
         #self.FSM.ToTransition('toLand')
250
+        arm = self.FSM.owner.arm
251
+        arm.playAction('a_jump_t', 23, 23, layer=3, play_mode=1, speed=1, blendin=5)
252
+        #if self.FSM.stateLife > 50:
253
+            #self.FSM.ToTransition('toWalk')
254
+        #limit fall speed
255
+        if self.FSM.owner.obj.linearVelocity.z < -10:
256
+            self.FSM.owner.obj.linearVelocity.z = -10
257
+        #ground_rays = self.FSM.owner.get_ground_ray()    
258
+        ground_rays = self.FSM.owner.get_ground_ray() 
259
+        if ground_rays[0][0] != None:
260
+
261
+            dist = self.FSM.owner.get_ground_dist(ground_rays)
262
+            if dist < .4:
263
+                self.FSM.ToTransition('toWalkLand')  
264
+
265
+        moving = self.FSM.owner.walk_movement()              
239 266
         
240 267
     def Exit(self):
241
-        pass
268
+        self.FSM.owner.arm.stopAction(0)
269
+        self.FSM.owner.arm.stopAction(1)
270
+        self.FSM.owner.arm.stopAction(2)
271
+        self.FSM.owner.arm.stopAction(3)
242 272
 
243 273
 #==================================== 
244 274
             
@@ -248,11 +278,27 @@ class WalkJump(State):
248 278
         
249 279
     def Enter(self):
250 280
         self.FSM.stateLife = 1
281
+
282
+        arm = self.FSM.owner.arm
283
+        arm.playAction('a_jump_t', 1, 23, layer=3, play_mode=0, speed=1, blendin=5)
284
+            
285
+
251 286
         super(WalkJump, self).Enter()        
252 287
         
253 288
     def Execute(self):
254 289
         self.FSM.stateLife += 1
255
-        #self.FSM.ToTransition('toLand')
290
+        arm = self.FSM.owner.arm
291
+        o = self.FSM.owner.obj
292
+
293
+        moving = self.FSM.owner.walk_movement()              
294
+
295
+        if self.FSM.stateLife == 10:
296
+                force = [ 0.0, 0.0, dict['walk_jump_force']]
297
+                if o.linearVelocity.z < 10:
298
+                     o.applyForce(force, True)
299
+
300
+        if self.FSM.stateLife > 27:
301
+            self.FSM.ToTransition('toWalkAir')
256 302
         
257 303
     def Exit(self):
258 304
         pass
@@ -265,12 +311,28 @@ class WalkLand(State):
265 311
         
266 312
     def Enter(self):
267 313
         self.FSM.stateLife = 1
314
+        self.FSM.owner.arm.playAction('a_jump_t', 23, 50, layer=5, play_mode=0, speed=1, blendin=5)
268 315
         super(WalkLand, self).Enter()        
269 316
         
270 317
     def Execute(self):
271 318
         self.FSM.stateLife += 1
272
-        #self.FSM.ToTransition('toLand')
319
+        self.FSM.owner.obj.linearVelocity.x *= .8
320
+        self.FSM.owner.obj.linearVelocity.y *= .8
321
+        # arm = self.FSM.owner.arm
273 322
         
323
+        # print('af', arm.getActionFrame(5))
324
+        # if arm.getActionFrame(5) > 30:
325
+        #     print('stopping land')
326
+        #     arm.stopAction(5)
327
+        #     arm.playAction('reg_idle1', 1,120, layer=1, play_mode=1, speed=1, blendin=2)
328
+        if self.FSM.stateLife > 8:
329
+            self.FSM.ToTransition('toWalk')
330
+
331
+        ground_rays = self.FSM.owner.get_ground_ray() 
332
+        if ground_rays[0][0] != None:
333
+            dist = self.FSM.owner.get_ground_dist(ground_rays)
334
+            self.FSM.owner.set_walk_z(dist)
335
+
274 336
     def Exit(self):
275 337
         pass
276 338
 
@@ -334,12 +396,17 @@ class Roll(State):
334 396
         
335 397
     def Enter(self):
336 398
         self.FSM.stateLife = 1
399
+        self.FSM.owner.walking = False
400
+        dict['walking'] = False
337 401
         super(Roll, self).Enter()        
338 402
         
339 403
     def Execute(self):
340 404
         self.FSM.stateLife += 1
341
-        if dict['walk'] == 1:
405
+        if dict['walk'] == 1 or self.FSM.owner.obj['getoffboard'] == True:
406
+            dict['walk'] = 1
407
+            self.FSM.owner.obj['getoffboard'] = True
342 408
             self.FSM.ToTransition('toWalk')
409
+            print('fsm to walk')
343 410
         print('rolling')
344 411
         #self.FSM.ToTransition('toLand')
345 412
         

+ 208
- 205
scripts/actionPlayer.py View File

@@ -278,213 +278,216 @@ def check_land(rA, aState, own):
278 278
 	return aState	
279 279
 
280 280
 def main(cont):
281
-	own = cont.owner
282 281
 	dict = bge.logic.globalDict
283
-	pass
284
-	
285
-# 	#initial state
286
-# 	if 'aState' not in own:
287
-# 		own['aState'] = 'reg_idle'
288
-# 		own['l_aState'] = None
289
-# 		own['stateTimer'] = 0
290
-# 		own['eaState'] = FSM.EaFSM(own)
291
-# 		own['EaRequest'] = None
292
-	
293
-# 	aState = own['aState']
294
-# 	rA = own['requestAction']
295
-# 	timer = own['stateTimer']
296
-# 	newState = own['aState']
297
-# 	aState = check_land(rA, aState, own)
298
-# 	newState = aState
299
-# 	og_state = own['aState']
300
-# 	#print(aState)
301
-# 	if aState in state_a:
302
-
303
-# 		action = getattr(actionsFSMlist, aState)
304
-# 		if own['stateTimer'] < getattr(action, 'intro_frames'):	
305
-# 			intro = getattr(action, 'intro')
306
-# 			actionPlayer(getattr(actionsFSMlist, intro))	
307
-# 		else:
308
-# 			actionPlayer(action)
309
-# 		newState = check_exit(aState, rA, timer, action)
310
-			
282
+	if not dict['walking']:
283
+		own = cont.owner
284
+		
285
+
311 286
 
312
-# 	elif aState in state_b:
313
-# 		action = getattr(actionsFSMlist, aState)
314
-# 		actionPlayer(action)
315
-# 		if own['stateTimer'] > getattr(action, 'fef'):
316
-# 			newState = check_exit(aState, rA, timer, action)
317
-
318
-
319
-# ###################################
320
-
321
-# 	check_state = 'reg_sit'
322
-# 	if aState == check_state:
323
-# 		action = getattr(actionsFSMlist, check_state)
324
-# 		#if own['stateTimer'] < 19:
325
-# 		if own['stateTimer'] < getattr(action, 'intro_frames'):	
326
-# 			actionPlayer(getattr(actionsFSMlist, 'intro'))
327
-# 		else:
328
-# 			actionPlayer(action)
329
-# 		newState = check_exit(aState, rA, timer, actionsFSMlist.reg_sit)
330
-
331
-# 	#-----------------------
332
-# 	check_state = 'reg_walk'
333
-# 	if aState == check_state:
334
-# 		action = getattr(actionsFSMlist, check_state)
335
-# 		if own['l_aState'] == 'reg_walkFast':
336
-# 			frame = get_frame(actionsFSMlist.reg_walkFast)
337
-# 			actionPlayer(action)
338
-# 			set_frame(actionsFSMlist.reg_walk, frame)
339
-# 		else:	
340
-# 			frame = actionPlayer(action)
287
+		#initial state
288
+		if 'aState' not in own:
289
+			own['aState'] = 'reg_idle'
290
+			own['l_aState'] = None
291
+			own['stateTimer'] = 0
292
+			own['eaState'] = FSM.EaFSM(own)
293
+			own['EaRequest'] = None
341 294
 		
342
-# 		newState = check_exit(aState, rA, timer, action)
343
-
344
-# 	#-----------------------
345
-# 	check_state = 'reg_walkFast'
346
-# 	if aState == check_state:
347
-# 		action = getattr(actionsFSMlist, check_state)
348
-# 		newState = check_exit(aState, rA, timer, actionsFSMlist.reg_walkFast)
349
-
350
-# 		if own['l_aState'] == 'reg_walk':
351
-# 			frame = get_frame(actionsFSMlist.reg_walk)
352
-# 			actionPlayer(action)
353
-# 			set_frame(actionsFSMlist.reg_walkFast, frame)
354
-
355
-# 		else:
356
-# 			actionPlayer(action)
357
-
358
-# 	check_state = 'reg_push'
359
-# 	if aState == check_state:
360
-# 		action = getattr(actionsFSMlist, check_state)
361
-# 		actionPlayer(action)
362
-# 		if own['stateTimer'] > 70:
363
-# 			newState = 'reg_roll'
364
-
365
-# 	check_state = 'reg_push_goof'
366
-# 	if aState == check_state:
367
-# 		action = getattr(actionsFSMlist, check_state)
368
-# 		actionPlayer(action)
369
-# 		if own['stateTimer'] > 70:
370
-# 			newState = 'reg_roll'			
371
-	
372
-# 	check_state = 'reg_powerslide'
373
-# 	if aState == check_state:
374
-# 		action = getattr(actionsFSMlist, check_state)
375
-# 		# if own['stateTimer'] < 20:
376
-# 		# 	actionPlayer(actionsFSMlist.reg_powerslide_in)
377
-# 		if own['stateTimer'] < getattr(action, 'intro_frames'):	
378
-# 			intro = getattr(action, 'intro')
379
-# 			actionPlayer(getattr(actionsFSMlist, intro))	
380
-# 		else:
381
-# 			actionPlayer(action)
382
-# 		newState = check_exit(aState, rA, timer, actionsFSMlist.reg_powerslide)
383
-
384
-# 	check_state = 'reg_fs_powerslide'
385
-# 	if aState == check_state:
386
-# 		action = getattr(actionsFSMlist, check_state)
387
-# 		# if own['stateTimer'] < 20:
388
-# 		# 	actionPlayer(actionsFSMlist.reg_fs_powerslide_in)
389
-# 		if own['stateTimer'] < getattr(action, 'intro_frames'):	
390
-# 			intro = getattr(action, 'intro')
391
-# 			actionPlayer(getattr(actionsFSMlist, intro))	
392
-# 		else:
393
-# 			actionPlayer(action)
394
-# 		newState = check_exit(aState, rA, timer, actionsFSMlist.reg_fs_powerslide)				
395
-
396
-
397
-
398
-# 	check_state = 'fak_sit'
399
-# 	if aState == check_state:
400
-# 		action = getattr(actionsFSMlist, check_state)
401
-# 		#if own['stateTimer'] < 19:
402
-# 		if own['stateTimer'] < getattr(action, 'intro_frames'):	
403
-# 			actionPlayer(getattr(actionsFSMlist, 'intro'))
404
-# 		else:
405
-# 			actionPlayer(action)
406
-# 		newState = check_exit(aState, rA, timer, actionsFSMlist.fak_sit)
407
-
408
-# 	#-----------------------
409
-# 	check_state = 'fak_walk'
410
-# 	if aState == check_state:
411
-# 		action = getattr(actionsFSMlist, check_state)
412
-# 		if own['l_aState'] == 'fak_walkFast':
413
-# 			frame = get_frame(actionsFSMlist.fak_walkFast)
414
-# 			actionPlayer(action)
415
-# 			set_frame(actionsFSMlist.fak_walk, frame)
416
-# 		else:	
417
-# 			frame = actionPlayer(action)
295
+		aState = own['aState']
296
+		rA = own['requestAction']
297
+		timer = own['stateTimer']
298
+		newState = own['aState']
299
+		aState = check_land(rA, aState, own)
300
+		newState = aState
301
+		og_state = own['aState']
302
+		#print(aState)
303
+		if aState in state_a:
304
+
305
+			action = getattr(actionsFSMlist, aState)
306
+			if own['stateTimer'] < getattr(action, 'intro_frames'):	
307
+				intro = getattr(action, 'intro')
308
+				actionPlayer(getattr(actionsFSMlist, intro))	
309
+			else:
310
+				actionPlayer(action)
311
+			newState = check_exit(aState, rA, timer, action)
312
+				
313
+
314
+		elif aState in state_b:
315
+			action = getattr(actionsFSMlist, aState)
316
+			actionPlayer(action)
317
+			if own['stateTimer'] > getattr(action, 'fef'):
318
+				newState = check_exit(aState, rA, timer, action)
319
+
320
+
321
+	###################################
322
+
323
+		check_state = 'reg_sit'
324
+		if aState == check_state:
325
+			action = getattr(actionsFSMlist, check_state)
326
+			#if own['stateTimer'] < 19:
327
+			if own['stateTimer'] < getattr(action, 'intro_frames'):	
328
+				actionPlayer(getattr(actionsFSMlist, 'intro'))
329
+			else:
330
+				actionPlayer(action)
331
+			newState = check_exit(aState, rA, timer, actionsFSMlist.reg_sit)
332
+
333
+		#-----------------------
334
+		check_state = 'reg_walk'
335
+		if aState == check_state:
336
+			action = getattr(actionsFSMlist, check_state)
337
+			if own['l_aState'] == 'reg_walkFast':
338
+				frame = get_frame(actionsFSMlist.reg_walkFast)
339
+				actionPlayer(action)
340
+				set_frame(actionsFSMlist.reg_walk, frame)
341
+			else:	
342
+				frame = actionPlayer(action)
343
+			
344
+			newState = check_exit(aState, rA, timer, action)
345
+
346
+		#-----------------------
347
+		check_state = 'reg_walkFast'
348
+		if aState == check_state:
349
+			action = getattr(actionsFSMlist, check_state)
350
+			newState = check_exit(aState, rA, timer, actionsFSMlist.reg_walkFast)
351
+
352
+			if own['l_aState'] == 'reg_walk':
353
+				frame = get_frame(actionsFSMlist.reg_walk)
354
+				actionPlayer(action)
355
+				set_frame(actionsFSMlist.reg_walkFast, frame)
356
+
357
+			else:
358
+				actionPlayer(action)
359
+
360
+		check_state = 'reg_push'
361
+		if aState == check_state:
362
+			action = getattr(actionsFSMlist, check_state)
363
+			actionPlayer(action)
364
+			if own['stateTimer'] > 70:
365
+				newState = 'reg_roll'
366
+
367
+		check_state = 'reg_push_goof'
368
+		if aState == check_state:
369
+			action = getattr(actionsFSMlist, check_state)
370
+			actionPlayer(action)
371
+			if own['stateTimer'] > 70:
372
+				newState = 'reg_roll'			
418 373
 		
419
-# 		newState = check_exit(aState, rA, timer, action)
420
-
421
-# 	#-----------------------
422
-# 	check_state = 'fak_walkFast'
423
-# 	if aState == check_state:
424
-# 		action = getattr(actionsFSMlist, check_state)
425
-# 		newState = check_exit(aState, rA, timer, actionsFSMlist.fak_walkFast)
426
-
427
-# 		if own['l_aState'] == 'fak_walk':
428
-# 			frame = get_frame(actionsFSMlist.fak_walk)
429
-# 			actionPlayer(action)
430
-# 			set_frame(actionsFSMlist.fak_walkFast, frame)
431
-
432
-# 		else:
433
-# 			actionPlayer(action)
434
-
435
-
436
-# 	check_state = 'fak_push'
437
-# 	if aState == check_state:
438
-# 		action = getattr(actionsFSMlist, check_state)
439
-# 		actionPlayer(action)
440
-# 		if own['stateTimer'] > 70:
441
-# 			newState = 'fak_roll'
442
-
443
-# 	check_state = 'fak_push_goof'
444
-# 	if aState == check_state:
445
-# 		action = getattr(actionsFSMlist, check_state)
446
-# 		actionPlayer(action)
447
-# 		if own['stateTimer'] > 70:
448
-# 			newState = 'fak_roll'			
449
-	
450
-# 	check_state = 'fak_powerslide'
451
-# 	if aState == check_state:
452
-# 		action = getattr(actionsFSMlist, check_state)
453
-# 		# if own['stateTimer'] < 20:
454
-# 		# 	actionPlayer(actionsFSMlist.fak_powerslide_in)
455
-# 		if own['stateTimer'] < getattr(action, 'intro_frames'):	
456
-# 			intro = getattr(action, 'intro')
457
-# 			actionPlayer(getattr(actionsFSMlist, intro))	
458
-# 		else:
459
-# 			actionPlayer(action)
460
-# 		newState = check_exit(aState, rA, timer, actionsFSMlist.fak_powerslide)
461
-
462
-# 	check_state = 'fak_fs_powerslide'
463
-# 	if aState == check_state:
464
-# 		action = getattr(actionsFSMlist, check_state)
465
-# 		# if own['stateTimer'] < 20:
466
-# 		# 	actionPlayer(actionsFSMlist.fak_fs_powerslide_in)
467
-# 		if own['stateTimer'] < getattr(action, 'intro_frames'):	
468
-# 			intro = getattr(action, 'intro')
469
-# 			actionPlayer(getattr(actionsFSMlist, intro))	
470
-# 		else:
471
-# 			actionPlayer(action)
472
-# 		newState = check_exit(aState, rA, timer, actionsFSMlist.fak_fs_powerslide)				
473
-
474
-
475
-# 	#-----------------------
476
-# 	print(own['aState'], newState, rA)
477
-# 	#print()
478
-# 	if newState != '':
479
-# 		own['aState'] = newState 
480
-# 	own['l_aState'] = og_state
481
-# 	own['l_actionState'] = og_state
482
-# 	state_timer(own)
483
-# 	skater = dict['p1']
484
-	
485
-# 	if own['requestAction'] == 'reg_roll' and own['rotz'] < .985:
486
-# 		frame = int(own['rotz'] * 70) 
487
-# 	else:
488
-# 		skater.stopAction(5)	
374
+		check_state = 'reg_powerslide'
375
+		if aState == check_state:
376
+			action = getattr(actionsFSMlist, check_state)
377
+			# if own['stateTimer'] < 20:
378
+			# 	actionPlayer(actionsFSMlist.reg_powerslide_in)
379
+			if own['stateTimer'] < getattr(action, 'intro_frames'):	
380
+				intro = getattr(action, 'intro')
381
+				actionPlayer(getattr(actionsFSMlist, intro))	
382
+			else:
383
+				actionPlayer(action)
384
+			newState = check_exit(aState, rA, timer, actionsFSMlist.reg_powerslide)
385
+
386
+		check_state = 'reg_fs_powerslide'
387
+		if aState == check_state:
388
+			action = getattr(actionsFSMlist, check_state)
389
+			# if own['stateTimer'] < 20:
390
+			# 	actionPlayer(actionsFSMlist.reg_fs_powerslide_in)
391
+			if own['stateTimer'] < getattr(action, 'intro_frames'):	
392
+				intro = getattr(action, 'intro')
393
+				actionPlayer(getattr(actionsFSMlist, intro))	
394
+			else:
395
+				actionPlayer(action)
396
+			newState = check_exit(aState, rA, timer, actionsFSMlist.reg_fs_powerslide)				
397
+
398
+
399
+
400
+		check_state = 'fak_sit'
401
+		if aState == check_state:
402
+			action = getattr(actionsFSMlist, check_state)
403
+			#if own['stateTimer'] < 19:
404
+			if own['stateTimer'] < getattr(action, 'intro_frames'):	
405
+				actionPlayer(getattr(actionsFSMlist, 'intro'))
406
+			else:
407
+				actionPlayer(action)
408
+			newState = check_exit(aState, rA, timer, actionsFSMlist.fak_sit)
409
+
410
+		#-----------------------
411
+		check_state = 'fak_walk'
412
+		if aState == check_state:
413
+			action = getattr(actionsFSMlist, check_state)
414
+			if own['l_aState'] == 'fak_walkFast':
415
+				frame = get_frame(actionsFSMlist.fak_walkFast)
416
+				actionPlayer(action)
417
+				set_frame(actionsFSMlist.fak_walk, frame)
418
+			else:	
419
+				frame = actionPlayer(action)
420
+			
421
+			newState = check_exit(aState, rA, timer, action)
422
+
423
+		#-----------------------
424
+		check_state = 'fak_walkFast'
425
+		if aState == check_state:
426
+			action = getattr(actionsFSMlist, check_state)
427
+			newState = check_exit(aState, rA, timer, actionsFSMlist.fak_walkFast)
428
+
429
+			if own['l_aState'] == 'fak_walk':
430
+				frame = get_frame(actionsFSMlist.fak_walk)
431
+				actionPlayer(action)
432
+				set_frame(actionsFSMlist.fak_walkFast, frame)
433
+
434
+			else:
435
+				actionPlayer(action)
436
+
437
+
438
+		check_state = 'fak_push'
439
+		if aState == check_state:
440
+			action = getattr(actionsFSMlist, check_state)
441
+			actionPlayer(action)
442
+			if own['stateTimer'] > 70:
443
+				newState = 'fak_roll'
444
+
445
+		check_state = 'fak_push_goof'
446
+		if aState == check_state:
447
+			action = getattr(actionsFSMlist, check_state)
448
+			actionPlayer(action)
449
+			if own['stateTimer'] > 70:
450
+				newState = 'fak_roll'			
451
+		
452
+		check_state = 'fak_powerslide'
453
+		if aState == check_state:
454
+			action = getattr(actionsFSMlist, check_state)
455
+			# if own['stateTimer'] < 20:
456
+			# 	actionPlayer(actionsFSMlist.fak_powerslide_in)
457
+			if own['stateTimer'] < getattr(action, 'intro_frames'):	
458
+				intro = getattr(action, 'intro')
459
+				actionPlayer(getattr(actionsFSMlist, intro))	
460
+			else:
461
+				actionPlayer(action)
462
+			newState = check_exit(aState, rA, timer, actionsFSMlist.fak_powerslide)
463
+
464
+		check_state = 'fak_fs_powerslide'
465
+		if aState == check_state:
466
+			action = getattr(actionsFSMlist, check_state)
467
+			# if own['stateTimer'] < 20:
468
+			# 	actionPlayer(actionsFSMlist.fak_fs_powerslide_in)
469
+			if own['stateTimer'] < getattr(action, 'intro_frames'):	
470
+				intro = getattr(action, 'intro')
471
+				actionPlayer(getattr(actionsFSMlist, intro))	
472
+			else:
473
+				actionPlayer(action)
474
+			newState = check_exit(aState, rA, timer, actionsFSMlist.fak_fs_powerslide)				
475
+
476
+
477
+		#-----------------------
478
+		#print(own['aState'], newState, rA)
479
+		#print()
480
+		if newState != '':
481
+			own['aState'] = newState 
482
+		own['l_aState'] = og_state
483
+		own['l_actionState'] = og_state
484
+		state_timer(own)
485
+		skater = dict['p1']
486
+		
487
+		if own['requestAction'] == 'reg_roll' and own['rotz'] < .985:
488
+			frame = int(own['rotz'] * 70) 
489
+		else:
490
+			skater.stopAction(5)	
489 491
 
490
-# 	#own['eaState'].Execute()
492
+		#own['eaState'].Execute()
493
+		#print(dict['walking'], 'walk')

+ 1
- 1
scripts/actionsFSMlist.py View File

@@ -2542,7 +2542,7 @@ fak_offboard = a_class(
2542 2542
 	#exits
2543 2543
 	['reg_idle', 'fak_idle', 'fak_walkFast', 'fak_walk', 'fak_onboard'],
2544 2544
 	#force exit, frame
2545
-	'reg_idle3', 24,
2545
+	'reg_idle', 24,
2546 2546
 	#opposite
2547 2547
 	None)
2548 2548
 

+ 7
- 3
scripts/controller2.py View File

@@ -3387,9 +3387,12 @@ def main():
3387 3387
     def getoffboard():
3388 3388
         lasty = own['lasty']
3389 3389
         getoffboard = own['getoffboard']
3390
-        if getoffboard == 1 and own['fall'] == False:
3391
-            own['getoffboard'] = 0
3392
-        if (yBut == False and lasty == True) or dict['kb_q'] == 3:
3390
+        # if getoffboard == 1 and own['fall'] == False:
3391
+        #     own['getoffboard'] = 0
3392
+        # if (yBut == False and lasty == True) or dict['kb_q'] == 3:
3393
+        #     own['getoffboard'] = 1
3394
+
3395
+        if (yBut == True and lasty == False) or dict['kb_q'] == 3:
3393 3396
             own['getoffboard'] = 1
3394 3397
 
3395 3398
     def switchcam():
@@ -4319,3 +4322,4 @@ def main():
4319 4322
     elif own['actionState'] in ['fak_backside_grab_out', 'fak_frontside_grab_out', 'fak_frontside_nose_grab_out', 'fak_frontside_tail_grab_out', 'fak_backside_nose_grab_out', 'fak_backside_tail_grab_out', 'fak_walk_air_out', 'fak_air-walk_air', 'fak_judo_out', 'fak_frigid_out', 'fak_fsonefoot_out', 'fak_onefoot_out'] and own['requestAction'] in  ['reg_land', 'fak_land']:
4320 4323
         own['requestAction'] = 'fak_land'   
4321 4324
 
4325
+    print(dict['walk'], 'controller walk')

+ 71
- 13
scripts/player.py View File

@@ -10,6 +10,7 @@ class Player:
10 10
 		self.obj = cont.owner
11 11
 		self.FSM = FSM.PlayerFSM(self)
12 12
 		self.walking = True
13
+		dict['walking'] = True
13 14
 		#print(self.obj.childrenRecursive)
14 15
 		#self.arm = self.obj.childrenRecursive['Char4']
15 16
 		self.arm = None
@@ -19,35 +20,92 @@ class Player:
19 20
 
20 21
 	def get_ground_ray(self):
21 22
 
23
+		v = self.obj.worldOrientation.col[0]
24
+		tv = v.normalized()
25
+
22 26
 		axis = 2
23
-		distance = -2
24
-		start = self.obj.worldPosition
27
+		distance = -5
28
+		start = self.obj.worldPosition.copy()
29
+		#front_start = start - 0.30 * tvfront_start = start - 0.30 * tv
30
+		back_start = start + 0.15 * tv
31
+		start.z += .1
25 32
 		end = Vector.copy(self.obj.worldPosition + (self.obj.worldOrientation.col[axis] * distance))
26 33
 		
27
-		ray = self.obj.rayCast(end, start, 0, 'ground', 1, 0, 0)
34
+		ray = self.obj.rayCast(end, back_start, 0, 'ground', 1, 0, 0)
35
+
36
+		v = self.obj.linearVelocity.copy()
37
+
38
+		v = self.obj.worldOrientation.col[0]
39
+		tv = v.normalized()
40
+		front_start = start - 0.30 * tv
41
+		start.z += .1
42
+		front_end = Vector(front_start + (self.obj.worldOrientation.col[axis] * distance))
43
+		frontray = self.obj.rayCast(front_end, front_start, 0, 'ground', 1, 1, 0, 53247)
44
+
45
+		bge.render.drawLine(front_start, front_end, [1,0,0])
28 46
 		#print(ray)
29
-		return ray
47
+		return [ray, frontray]
30 48
 
31 49
 	def get_ground_dist(self, groundray):
32
-		pass
50
+		gr = groundray[0]
51
+		fgr = groundray[1]
52
+		#when player is on the ground, dist is .25
53
+		d = None
54
+		
55
+		if gr[0] != None:
56
+
57
+			p_z = self.obj.worldPosition.z
58
+			g_z = gr[1].z
59
+
60
+			distance_to_ground = p_z - g_z
61
+
62
+			p2 = None
63
+			if fgr[0] != None:
64
+				p2 = p_z - fgr[1].z 
65
+
66
+				if p2 < distance_to_ground:
67
+					#front to ground is bigger than back to ground
68
+					#val = p2 - distance_to_ground
69
+					#val *= .1
70
+					print(fgr[0], 'ray hit obj')
71
+					distance_to_ground = p2
72
+
73
+			return distance_to_ground
74
+
75
+	def set_walk_z(self, dist):
76
+		if dist < .6:
77
+			target_dist = .3
78
+			#z_targ = self.obj.worldPosition.z + (target_dist - dist)
79
+			self.obj.worldPosition.z += (target_dist - dist)
80
+			self.obj.linearVelocity.z = 0
33 81
 
34 82
 	def walk_movement(self):
35 83
 		
36 84
 		moving = False
37 85
 		o = self.obj
38 86
 		
87
+
88
+		o.linearVelocity.y *= .9
89
+		o.linearVelocity.x *= .95
90
+
39 91
 		if dict['kb_w'] == 2 or dict['lUD'] < -.05:
40 92
 			#walk_blend(self)
41 93
 
42
-			if o.linearVelocity.x < dict['max_walk_vel']:
43
-				o.applyForce([-dict['walk_force'], 0, 0], True)
44
-
45
-			if (dict['kb_lsh'] == 2 or dict['aBut'] == 1) and o.linearVelocity.y < dict['max_run_vel']:
94
+			#run
95
+			if (dict['kb_lsh'] == 2 or dict['aBut'] == 1) and o.linearVelocity.x > -dict['max_run_vel']:
46 96
 				#self.run_speed = 1.5
47
-				o.applyForce([-dict['run_force'], 0, 0], True)
97
+				#o.applyForce([-dict['run_force'], 0, 0], True)
98
+				o.linearVelocity.x -= .2
99
+
100
+			#walk
101
+			elif o.linearVelocity.x > -dict['max_walk_vel']:
102
+				#o.applyForce([-dict['walk_force'], 0, 0], True)
103
+				o.linearVelocity.x -= .1
104
+
48 105
 
49 106
 		if dict['kb_s'] == 2 or dict['lUD'] > .06:
50
-			o.applyForce([10, 0, 0], True)
107
+			#o.applyForce([10, 0, 0], True)
108
+			o.linearVelocity.x -= 1
51 109
 			#print('w')
52 110
 
53 111
 		if dict['kb_a'] == 2 or dict['lLR'] < -.03:
@@ -58,8 +116,8 @@ class Player:
58 116
 			o.applyRotation([0, 0, -dict['walk_turn_amt']], True)
59 117
 
60 118
 
61
-		o.linearVelocity.y *= .9
62
-		o.linearVelocity.x *= .95
119
+
120
+		#print('linvel', o.linearVelocity)
63 121
 
64 122
 		return moving
65 123
 

+ 5
- 2
scripts/walk.py View File

@@ -8,8 +8,11 @@ import random
8 8
 import math
9 9
 
10 10
 def main(cont):
11
-    
12
-    pass
11
+    pass    
12
+
13
+#---------------------------------------------------
14
+
15
+
13 16
 
14 17
     # scene = bge.logic.getCurrentScene()
15 18
     # objList = scene.objects

+ 2
- 2
shuvit.blend View File

@@ -1,3 +1,3 @@
1 1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:ad743d8c1c2c71894b3b31559eb3f807d300c8e9d8503f1ec78b7dc6c107b422
3
-size 130002152
2
+oid sha256:8ff6a17a5eb21ea481bc3cda4b94b326bbc186b271d726331066ba550059de59
3
+size 128961440

Loading…
Cancel
Save