shuvit 3 years ago
parent
commit
bb2e725630

+ 2
- 2
assets/levels/scratch/level.blend View File

1
 version https://git-lfs.github.com/spec/v1
1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:59be75f7d28822ee6fd219d2f812c7411f69ccbd2679e1f3b67c71b3aa7396d5
3
-size 580320
2
+oid sha256:80da2750251e443d10fe87c4831cbd303754d9a8f43b0cd447faca8b2a184956
3
+size 21404212

+ 2
- 2
assets/ramps.blend View File

1
 version https://git-lfs.github.com/spec/v1
1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:5395502faddbee5158b7c9ffd14807408fbb2a6b14b148db93ef53ea011a4a9b
3
-size 48154268
2
+oid sha256:7f0ca585c24b56ca66641f6ebeec9b3525f19f757b6857a8c1ac9fb957421066
3
+size 80413544

+ 2
- 2
assets/user2.blend View File

1
 version https://git-lfs.github.com/spec/v1
1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:ab1b42cf5d4aee552dc3f4f15e5e04b0c16882a41ce75c79726a9dceb04b1463
3
-size 662960
2
+oid sha256:591f877f598327200b89c9518b9ba7e8aaefe0f5b69957836fbf0044cb26b5e5
3
+size 3442504

+ 7
- 7
config.ini View File

33
 
33
 
34
 #camera 
34
 #camera 
35
 #######
35
 #######
36
-cam_height = -0.1
36
+cam_height = -0.3
37
 focal_length = 12
37
 focal_length = 12
38
 cam_min = 2.0
38
 cam_min = 2.0
39
 cam_max = 4.4
39
 cam_max = 4.4
54
 
54
 
55
 shirt_logo = 2
55
 shirt_logo = 2
56
 
56
 
57
-shirt_color_r = 0.4
58
-shirt_color_g = 0.03
59
-shirt_color_b = 0.03
57
+shirt_color_r = 0
58
+shirt_color_g = 0
59
+shirt_color_b = 0
60
 
60
 
61
-shoe_color_r = 0.31
62
-shoe_color_g = 0.23
63
-shoe_color_b = 0
61
+shoe_color_r = 0.69
62
+shoe_color_g = 0.69
63
+shoe_color_b = 0.67
64
 #-----------------
64
 #-----------------
65
 
65
 
66
 #deck settings
66
 #deck settings

+ 5
- 0
scripts/FSM.py View File

28
         self.stateLife = 0
28
         self.stateLife = 0
29
         self.owner = owner
29
         self.owner = owner
30
         self.name = None
30
         self.name = None
31
+        self.last_state_notes = None
31
         
32
         
32
     def AddTransition(self, transName, transition):
33
     def AddTransition(self, transName, transition):
33
         self.transitions[transName] = transition
34
         self.transitions[transName] = transition
103
         'WalkHang',
104
         'WalkHang',
104
         'WalkClimb',
105
         'WalkClimb',
105
         'WalkHurdle',
106
         'WalkHurdle',
107
+        'WalkOnboard',
108
+        'AirOnboard',
109
+        'Offboard', 
110
+        'Dropin',
106
         'Roll',
111
         'Roll',
107
         'Ragdoll']
112
         'Ragdoll']
108
         
113
         

+ 230
- 50
scripts/StatesPlayer.py View File

1
 import bge
1
 import bge
2
 dict = bge.logic.globalDict
2
 dict = bge.logic.globalDict
3
+import sound_man
3
 #====================================     
4
 #====================================     
4
 
5
 
5
 State = type("State", (object,), {})
6
 State = type("State", (object,), {})
89
         #print(o.worldPosition.z)
90
         #print(o.worldPosition.z)
90
         #print(o['getonboard'], 'dict onboard')
91
         #print(o['getonboard'], 'dict onboard')
91
         #print(dict['walk'], 'fsm walk walk')
92
         #print(dict['walk'], 'fsm walk walk')
92
-        if self.FSM.stateLife == 2:
93
-            if o['stance']:
94
-                o.applyRotation([0,0,3.14], True)
95
-                o['stance'] = False
93
+        # if self.FSM.stateLife == 2:
94
+        #     if o['stance']:
95
+        #         o.applyRotation([0,0,3.14], True)
96
+        #         o['stance'] = False
96
         #         o['requestAction'] = 'fak_offboard' 
97
         #         o['requestAction'] = 'fak_offboard' 
97
         #         print('request fak offboard')            
98
         #         print('request fak offboard')            
98
         #     else:
99
         #     else:
112
             dist = c.get_ground_dist(ground_rays)
113
             dist = c.get_ground_dist(ground_rays)
113
             if dist > .7:
114
             if dist > .7:
114
                 self.FSM.ToTransition('toWalkAir')
115
                 self.FSM.ToTransition('toWalkAir')
115
-                print('---falling')
116
+                #print('---falling')
116
             else:
117
             else:
117
                 c.set_walk_z(dist)
118
                 c.set_walk_z(dist)
118
             #print(dist, 'setting height')
119
             #print(dist, 'setting height')
134
         o = self.FSM.owner.obj
135
         o = self.FSM.owner.obj
135
         #print(o['getonboard'], 'getonboard')
136
         #print(o['getonboard'], 'getonboard')
136
 
137
 
137
-
138
-
138
+        
139
         if dict['walk'] == 0:
139
         if dict['walk'] == 0:
140
             o['getonboard'] = True
140
             o['getonboard'] = True
141
-            self.FSM.ToTransition('toRoll')
141
+            #self.FSM.ToTransition('toRoll')
142
+            self.FSM.ToTransition('toWalkOnboard')
142
             #print('onboard', dict['walk'], o['getonboard'])
143
             #print('onboard', dict['walk'], o['getonboard'])
144
+        if dict['yBut'] == 1 and dict['last_yBut'] == 0:
145
+        
146
+            
147
+            dropin = self.check_dropin()
148
+            print('-----dropin', dropin)
149
+            if dropin == None:
150
+                o['getonboard'] = True
143
 
151
 
152
+                self.FSM.ToTransition('toWalkOnboard')
153
+            else:
154
+                self.FSM.owner.dropin_obj = dropin
155
+                self.FSM.ToTransition('toDropin')
144
 
156
 
145
 
157
 
146
 
158
 
147
-
148
-        if dict['yBut'] == 1 and dict['last_yBut'] == 0:
149
-            o['getonboard'] = True
150
-            self.FSM.ToTransition('toRoll')
159
+    def check_dropin(self):
160
+        dr = None
161
+        ground_rays = self.FSM.owner.get_dropin_rays()
162
+        for x in ground_rays:
163
+            if x[0] != None:
164
+                #print(x[0], '---checked')
165
+                if 'coping' in x[0]:
166
+                    print('dropin collided')
167
+                    dr = x
168
+        return dr
151
 
169
 
152
     def check_jump(self):
170
     def check_jump(self):
153
         if dict['xBut'] == True or dict['kb_space'] == 1: 
171
         if dict['xBut'] == True or dict['kb_space'] == 1: 
154
             if dict['last_xBut'] == 0:
172
             if dict['last_xBut'] == 0:
155
                 self.FSM.ToTransition('toWalkJump')
173
                 self.FSM.ToTransition('toWalkJump')
174
+                
156
 
175
 
157
     def idle_blend(self):
176
     def idle_blend(self):
158
         arm = self.FSM.owner.arm
177
         arm = self.FSM.owner.arm
197
         #     #tw = self.turn_weight
216
         #     #tw = self.turn_weight
198
         #     arm.stopAction(4)
217
         #     arm.stopAction(4)
199
         #     arm.playAction('bwalk_left', 1,60, layer=4, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=tw)
218
         #     arm.playAction('bwalk_left', 1,60, layer=4, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=tw)
200
-
219
+            #print('walk_weight', self.walk_weight)
220
+            if self.walk_weight < .8:
221
+                if frame > 15:
222
+                    if self.FSM.owner.step == False:
223
+                        self.FSM.owner.step = True
224
+                        
225
+                        if frame < 23:
226
+                            print('step left')
227
+                            dict['camera']['sndmgr'].queue_sound(['s_l_1', self.FSM.owner.obj, dict['camera']])
228
+                else:
229
+                    if self.FSM.owner.step == True:
230
+                        self.FSM.owner.step = False
231
+                        if frame < 8:
232
+                            dict['camera']['sndmgr'].queue_sound(['s_r_1', self.FSM.owner.obj, dict['camera']])
233
+                            print('step right')
234
+                    
235
+            # if frame > 15 and self.FSM.owner.step:
236
+            #     self.FSM.owner.step = True
237
+            #     print('step left')
238
+            # if frame < 15 and not self.FSM.owner.step:
239
+            #     self.FSM.owner.step = False
240
+            #     print('step right')
241
+            #print('frame', frame)
201
 
242
 
202
     def get_walk_weight(self):
243
     def get_walk_weight(self):
203
         #print(self.FSM.owner.linearVelocity.y) 
244
         #print(self.FSM.owner.linearVelocity.y) 
282
         ground_rays = self.FSM.owner.get_ground_ray() 
323
         ground_rays = self.FSM.owner.get_ground_ray() 
283
 
324
 
284
         self.FSM.owner.check_throw()
325
         self.FSM.owner.check_throw()
326
+        self.check_onboard()
327
+        self.FSM.owner.align_walk_z()
285
         if ground_rays[0][0] != None:
328
         if ground_rays[0][0] != None:
286
             dist = self.FSM.owner.get_ground_dist(ground_rays)
329
             dist = self.FSM.owner.get_ground_dist(ground_rays)
287
             if dist < .4:
330
             if dist < .4:
300
                         self.FSM.owner.obj.worldPosition.z = hang_ray[1].z - 1
343
                         self.FSM.owner.obj.worldPosition.z = hang_ray[1].z - 1
301
                         self.FSM.ToTransition('toWalkHang')
344
                         self.FSM.ToTransition('toWalkHang')
302
         
345
         
346
+    def check_onboard(self):
347
+        o = self.FSM.owner.obj
348
+        # if dict['walk'] == 0:
349
+        #     o['getonboard'] = True
350
+        #     self.FSM.ToTransition('toWalkOnboard')
351
+        if dict['yBut'] == 1 and dict['last_yBut'] == 0:
352
+            o['getonboard'] = True
353
+            #self.FSM.ToTransition('toWalkOnboard')
354
+            self.FSM.ToTransition('toAirOnboard')
355
+
303
     def Exit(self):
356
     def Exit(self):
304
         self.FSM.owner.arm.stopAction(0)
357
         self.FSM.owner.arm.stopAction(0)
305
         self.FSM.owner.arm.stopAction(1)
358
         self.FSM.owner.arm.stopAction(1)
318
         
371
         
319
     def Enter(self):
372
     def Enter(self):
320
         self.FSM.stateLife = 1
373
         self.FSM.stateLife = 1
321
-
374
+        dict['camera']['sndmgr'].queue_sound(['walk_grunt', self.FSM.owner.obj, dict['camera']])
322
         arm = self.FSM.owner.arm
375
         arm = self.FSM.owner.arm
323
         deck = self.FSM.owner.deck_arm
376
         deck = self.FSM.owner.deck_arm
324
         #arm.playAction('a_jump_t', 1, 23, layer=3, play_mode=0, speed=1, blendin=5)
377
         #arm.playAction('a_jump_t', 1, 23, layer=3, play_mode=0, speed=1, blendin=5)
334
         o = self.FSM.owner.obj
387
         o = self.FSM.owner.obj
335
 
388
 
336
         moving = self.FSM.owner.walk_movement()              
389
         moving = self.FSM.owner.walk_movement()              
337
-
390
+        self.check_onboard()
338
         if self.FSM.stateLife == 10:
391
         if self.FSM.stateLife == 10:
339
                 force = [ 0.0, 0.0, dict['walk_jump_force']]
392
                 force = [ 0.0, 0.0, dict['walk_jump_force']]
340
                 if o.linearVelocity.z < 10:
393
                 if o.linearVelocity.z < 10:
342
 
395
 
343
         if self.FSM.stateLife > 27:
396
         if self.FSM.stateLife > 27:
344
             self.FSM.ToTransition('toWalkAir')
397
             self.FSM.ToTransition('toWalkAir')
398
+
399
+    def check_onboard(self):
400
+        o = self.FSM.owner.obj
401
+        # if dict['walk'] == 0:
402
+        #     o['getonboard'] = True
403
+        #     self.FSM.ToTransition('toWalkOnboard')
404
+        if dict['yBut'] == 1 and dict['last_yBut'] == 0:
405
+            o['getonboard'] = True
406
+            self.FSM.ToTransition('toAirOnboard')            
345
         
407
         
346
     def Exit(self):
408
     def Exit(self):
347
         pass
409
         pass
357
         #self.FSM.owner.arm.playAction('a_jump_t', 23, 50, layer=5, play_mode=0, speed=1, blendin=5)
419
         #self.FSM.owner.arm.playAction('a_jump_t', 23, 50, layer=5, play_mode=0, speed=1, blendin=5)
358
         self.FSM.owner.arm.playAction('c_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
420
         self.FSM.owner.arm.playAction('c_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
359
         self.FSM.owner.deck_arm.playAction('b_walk_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
421
         self.FSM.owner.deck_arm.playAction('b_walk_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
422
+        dict['camera']['sndmgr'].queue_sound(['walk_land', self.FSM.owner.obj, dict['camera']])
360
         #c_land
423
         #c_land
361
         super(WalkLand, self).Enter()        
424
         super(WalkLand, self).Enter()        
362
         
425
         
392
         self.FSM.stateLife = 1
455
         self.FSM.stateLife = 1
393
         self.FSM.owner.arm.playAction('c_braced_hang', 0, 36, layer=2, play_mode=0, speed=1, blendin=10)
456
         self.FSM.owner.arm.playAction('c_braced_hang', 0, 36, layer=2, play_mode=0, speed=1, blendin=10)
394
         self.moveable = False
457
         self.moveable = False
458
+        dict['camera']['sndmgr'].queue_sound(['walk_hang', self.FSM.owner.obj, dict['camera']])
459
+        self.FSM.owner.drop_deck()
395
         #self.FSM.owner.arm.playAction('c_braced_hang', 36, 50, layer=1, play_mode=1, speed=1, blendin=10)
460
         #self.FSM.owner.arm.playAction('c_braced_hang', 36, 50, layer=1, play_mode=1, speed=1, blendin=10)
396
         super(WalkHang, self).Enter()        
461
         super(WalkHang, self).Enter()        
397
         
462
         
426
 
491
 
427
         if hang_ray[0] != None:
492
         if hang_ray[0] != None:
428
             hr_dist = self.FSM.owner.get_hang_dist(hang_ray)
493
             hr_dist = self.FSM.owner.get_hang_dist(hang_ray)
429
-            print(hr_dist, 'hang dist')
494
+            #print(hr_dist, 'hang dist')
430
             if hr_dist < .5:
495
             if hr_dist < .5:
431
                 self.FSM.owner.obj.linearVelocity = [0,0,0]
496
                 self.FSM.owner.obj.linearVelocity = [0,0,0]
432
                 self.FSM.owner.obj.worldPosition.z = hang_ray[1].z  - 1
497
                 self.FSM.owner.obj.worldPosition.z = hang_ray[1].z  - 1
433
             if hang_align_ray[0] != None:
498
             if hang_align_ray[0] != None:
434
-                print(hang_align_ray[0])
499
+                #print(hang_align_ray[0])
435
                 v = hang_align_ray[2]
500
                 v = hang_align_ray[2]
436
                 self.FSM.owner.obj.alignAxisToVect(v, 0, .5)    
501
                 self.FSM.owner.obj.alignAxisToVect(v, 0, .5)    
437
         else:
502
         else:
452
     def Enter(self):
517
     def Enter(self):
453
         self.FSM.stateLife = 1
518
         self.FSM.stateLife = 1
454
         self.FSM.owner.arm.playAction('c_wallclimb', 1, 50, layer=3, play_mode=0, speed=1, blendin=10)
519
         self.FSM.owner.arm.playAction('c_wallclimb', 1, 50, layer=3, play_mode=0, speed=1, blendin=10)
520
+        dict['camera']['sndmgr'].queue_sound(['walk_climb', self.FSM.owner.obj, dict['camera']])
455
         super(WalkClimb, self).Enter()        
521
         super(WalkClimb, self).Enter()        
456
         
522
         
457
     def Execute(self):
523
     def Execute(self):
489
 #==================================== 
555
 #==================================== 
490
 
556
 
491
             
557
             
492
-class Example(State):
558
+class WalkOnboard(State):
493
     def __init__(self,FSM):
559
     def __init__(self,FSM):
494
-        super(Example, self).__init__(FSM)    
560
+        super(WalkOnboard, self).__init__(FSM)    
495
         
561
         
496
     def Enter(self):
562
     def Enter(self):
497
         self.FSM.stateLife = 1
563
         self.FSM.stateLife = 1
498
-        super(Example, self).Enter()        
564
+        self.FSM.owner.walking = False
565
+        self.FSM.owner.obj['getonboard'] = False
566
+        if self.FSM.owner.throw_deck != None:
567
+            self.FSM.owner.throw_deck.endObject()
568
+            self.FSM.owner.throw_deck = None
569
+            self.FSM.owner.show_deck()
570
+        dict['walking'] = False
571
+        self.FSM.owner.obj['walking'] = False
572
+        self.FSM.owner.obj['requestAction'] = 'reg_onboard'
573
+        self.FSM.owner.obj['getoffboard'] == False
574
+        self.FSM.owner.obj.applyForce([-300, 0, 0], True)
575
+        print('walkonboard entered')
576
+        super(WalkOnboard, self).Enter()        
499
         
577
         
500
     def Execute(self):
578
     def Execute(self):
501
         self.FSM.stateLife += 1
579
         self.FSM.stateLife += 1
502
-        #self.FSM.ToTransition('toExample')
580
+        self.FSM.ToTransition('toRoll')
503
         
581
         
504
     def Exit(self):
582
     def Exit(self):
505
         pass
583
         pass
506
 
584
 
507
 #==================================== 
585
 #==================================== 
508
 
586
 
587
+
509
             
588
             
510
-class Example(State):
589
+class AirOnboard(State):
511
     def __init__(self,FSM):
590
     def __init__(self,FSM):
512
-        super(Example, self).__init__(FSM)    
591
+        super(AirOnboard, self).__init__(FSM)    
513
         
592
         
514
     def Enter(self):
593
     def Enter(self):
515
         self.FSM.stateLife = 1
594
         self.FSM.stateLife = 1
516
-        super(Example, self).Enter()        
517
-        
518
-    def Execute(self):
519
-        self.FSM.stateLife += 1
520
-        #self.FSM.ToTransition('toExample')
521
-        
522
-    def Exit(self):
523
-        pass
595
+        self.FSM.owner.walking = False
596
+        self.FSM.owner.obj['getonboard'] = False
597
+        if self.FSM.owner.throw_deck != None:
598
+            self.FSM.owner.throw_deck.endObject()
599
+            self.FSM.owner.throw_deck = None
600
+            self.FSM.owner.show_deck()
601
+        dict['walking'] = False
602
+        self.FSM.owner.obj['walking'] = False
603
+        #self.FSM.owner.obj['requestAction'] = 'reg_onboard'
524
 
604
 
525
-#==================================== 
605
+        self.FSM.owner.arm.playAction('c_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
606
+        self.FSM.owner.deck_arm.playAction('b_walk_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
526
 
607
 
527
-            
528
-class Example(State):
529
-    def __init__(self,FSM):
530
-        super(Example, self).__init__(FSM)    
531
-        
532
-    def Enter(self):
533
-        self.FSM.stateLife = 1
534
-        super(Example, self).Enter()        
608
+        self.FSM.owner.obj['getoffboard'] == False
609
+        self.FSM.owner.obj.applyForce([-300, 0, 0], True)
610
+        print('air entered')
611
+        super(AirOnboard, self).Enter()        
535
         
612
         
536
     def Execute(self):
613
     def Execute(self):
537
         self.FSM.stateLife += 1
614
         self.FSM.stateLife += 1
538
-        #self.FSM.ToTransition('toExample')
615
+        print('@@@@@@@@@@@@@@@@@@@@@@@@@@@air ob')
616
+        self.FSM.ToTransition('toRoll')
539
         
617
         
540
     def Exit(self):
618
     def Exit(self):
541
         pass
619
         pass
548
         
626
         
549
     def Enter(self):
627
     def Enter(self):
550
         self.FSM.stateLife = 1
628
         self.FSM.stateLife = 1
551
-        self.FSM.owner.walking = False
552
-        self.FSM.owner.obj['getonboard'] = False
553
-        dict['walking'] = False
629
+        # self.FSM.owner.obj['getoffboard'] == False
630
+        # dict['walk'] = 0
631
+        print('roll entered')
554
         super(Roll, self).Enter()        
632
         super(Roll, self).Enter()        
555
         
633
         
556
     def Execute(self):
634
     def Execute(self):
558
         if dict['walk'] == 1 or self.FSM.owner.obj['getoffboard'] == True:
636
         if dict['walk'] == 1 or self.FSM.owner.obj['getoffboard'] == True:
559
             dict['walk'] = 1
637
             dict['walk'] = 1
560
             self.FSM.owner.obj['getoffboard'] = True
638
             self.FSM.owner.obj['getoffboard'] = True
561
-            self.FSM.ToTransition('toWalk')
562
-            print('fsm to walk')
639
+            #self.FSM.ToTransition('toWalk')
640
+            self.FSM.ToTransition('toOffboard')
641
+            print('fsm to walk', dict['walk'], self.FSM.owner.obj['getoffboard'])
563
         if self.FSM.owner.obj['fall'] == True:
642
         if self.FSM.owner.obj['fall'] == True:
564
             self.FSM.ToTransition('toRagdoll')    
643
             self.FSM.ToTransition('toRagdoll')    
565
-        print('rolling')
644
+        #print('rolling')
566
         #self.FSM.ToTransition('toLand')
645
         #self.FSM.ToTransition('toLand')
567
         
646
         
568
     def Exit(self):
647
     def Exit(self):
570
 
649
 
571
 #==================================== 
650
 #==================================== 
572
 
651
 
652
+class Offboard(State):
653
+    def __init__(self,FSM):
654
+        super(Offboard, self).__init__(FSM)    
655
+        
656
+    def Enter(self):
657
+        self.FSM.stateLife = 1
658
+        
659
+        o = self.FSM.owner.obj
660
+        if o['stance']:
661
+            o.applyRotation([0,0,3.14], True)
662
+            o['stance'] = False
663
+            self.FSM.owner.arm.playAction('fak_noffboard', 0,24, layer=2, play_mode=0, speed=1, blendin=0)
664
+            self.FSM.owner.deck_arm.playAction('b_reg_offboard', 0,30, layer=2, play_mode=0, speed=1, blendin=0)
665
+        else:
666
+            self.FSM.owner.arm.playAction('reg_noffboard', 0,40, layer=2, play_mode=0, speed=1, blendin=0)
667
+            self.FSM.owner.deck_arm.playAction('b_reg_offboard', 0,40, layer=2, play_mode=0, speed=1, blendin=0)
668
+        print('fsm getting off board')
669
+        super(Offboard, self).Enter()        
670
+        
671
+    def Execute(self):
672
+        self.FSM.stateLife += 1
673
+        
674
+        self.FSM.ToTransition('toWalk')
675
+        
676
+    def Exit(self):
677
+        pass
678
+#==================================== 
679
+
573
 class Ragdoll(State):
680
 class Ragdoll(State):
574
     def __init__(self,FSM):
681
     def __init__(self,FSM):
575
         super(Ragdoll, self).__init__(FSM)    
682
         super(Ragdoll, self).__init__(FSM)    
576
         
683
         
577
     def Enter(self):
684
     def Enter(self):
578
         self.FSM.stateLife = 1
685
         self.FSM.stateLife = 1
686
+        self.FSM.owner.obj['ragdoll_active'] = True
687
+        self.FSM.owner.drop_deck()
688
+        print('ragdoll_player_fsm entered')
579
         super(Ragdoll, self).Enter()        
689
         super(Ragdoll, self).Enter()        
580
         
690
         
581
     def Execute(self):
691
     def Execute(self):
584
         if dict['yBut'] == 1:
694
         if dict['yBut'] == 1:
585
             self.FSM.owner.obj['fall'] = False
695
             self.FSM.owner.obj['fall'] = False
586
             self.FSM.owner.cont.activate(self.FSM.owner.cont.actuators['walk'])
696
             self.FSM.owner.cont.activate(self.FSM.owner.cont.actuators['walk'])
587
-            self.FSM.ToTransition('toWalk')
697
+            #self.FSM.ToTransition('toWalk')
698
+            self.FSM.ToTransition('toOffboard')
699
+        self.FSM.owner.move_walk_cam()
700
+    def Exit(self):
701
+        print('ragdoll_player_fsm exited')
702
+        self.FSM.owner.obj['ragdoll_active'] = False
703
+        #pass                                
704
+
705
+#==================================== 
706
+            
707
+class Dropin(State):
708
+    def __init__(self,FSM):
709
+        super(Dropin, self).__init__(FSM)    
710
+        
711
+    def Enter(self):
712
+        self.FSM.stateLife = 1
713
+        if self.FSM.owner.throw_deck != None:
714
+            self.FSM.owner.throw_deck.endObject()
715
+            self.FSM.owner.throw_deck = None
716
+            self.FSM.owner.show_deck()
717
+        self.FSM.owner.arm.playAction('reg_dropin3', 30, 50, layer=2, play_mode=0, speed=1, blendin=5)
718
+        self.FSM.owner.deck_arm.playAction('b_reg_dropin', 30, 50, layer=2, play_mode=0, speed=1, blendin=5)
719
+        self.out_triggered = False
720
+        # #player armature action name, start, end frames
721
+        # 'reg_dropin3', 30, 50,
722
+        # #deck action name, start, end frames  
723
+        # 'b_reg_dropin', 30, 50,
724
+        # #layer, speed, mode (0 = play, 1 = loop), blendin
725
+        # 1, .5, 0, 15,
726
+        # #intro, length
727
+
728
+        super(Dropin, self).Enter()        
729
+        
730
+    def Execute(self):
731
+        self.FSM.stateLife += 1
732
+        print('dropin')
733
+        eu = self.FSM.owner.get_vert_rot(self.FSM.owner.obj, self.FSM.owner.dropin_obj[0])
734
+        #print(eu, 'eu')
735
+        
736
+        self.FSM.owner.arm.playAction('reg_dropin3', 50, 50, layer=1, play_mode=1, speed=1, blendin=5)
737
+        self.FSM.owner.deck_arm.playAction('b_reg_dropin', 50, 50, layer=1, play_mode=1, speed=1, blendin=5)
738
+        
739
+        if dict['last_yBut'] == True and dict['yBut'] == False:
740
+            self.out_triggered = True
741
+        
742
+        if self.out_triggered:
743
+            self.FSM.owner.arm.playAction('reg_dropin3', 60, 80, layer=2, play_mode=0, speed=1, blendin=5)
744
+            self.FSM.owner.deck_arm.playAction('b_reg_dropin', 60, 80, layer=2, play_mode=0, speed=1, blendin=5)
745
+            self.FSM.owner.obj.applyForce([-15, 0, 0], True)
746
+            self.FSM.owner.obj.applyRotation([0, -.01, 0], True)
747
+
748
+        else:
749
+            self.FSM.owner.move_to_te()
750
+
751
+        if self.FSM.owner.arm.getActionFrame(2)> 78:
752
+            
753
+            self.FSM.ToTransition('toRoll')
754
+
755
+        self.FSM.owner.move_walk_cam()
756
+
757
+        
588
         
758
         
759
+
760
+
589
     def Exit(self):
761
     def Exit(self):
590
-        pass                                
762
+        self.FSM.owner.obj['getonboard'] = True
763
+        self.FSM.owner.walking = False
764
+        #self.FSM.owner.obj['getonboard'] = False
765
+        dict['walking'] = False
766
+        self.FSM.owner.obj['walking'] = False
767
+        self.FSM.owner.obj['requestAction'] = 'reg_air'
768
+        self.FSM.owner.obj['getoffboard'] == False
591
 
769
 
592
-#==================================== 
770
+
771
+
772
+#==================================== 

+ 1
- 1
scripts/actionPlayer.py View File

475
 
475
 
476
 
476
 
477
 		#-----------------------
477
 		#-----------------------
478
-		#print(own['aState'], newState, rA)
478
+		#print(own['aState'], newState, rA, own['l_aState'])
479
 		#print()
479
 		#print()
480
 		if newState != '':
480
 		if newState != '':
481
 			own['aState'] = newState 
481
 			own['aState'] = newState 

+ 4
- 3
scripts/actionsFSMlist.py View File

2556
 	#intro, length
2556
 	#intro, length
2557
 	None, 0,
2557
 	None, 0,
2558
 	#exits
2558
 	#exits
2559
-	['fak_idle', 'fak_offboard', 'reg_offboard' 'fak_turnLeft', 'fak_turnRight', 'fak_opos', 'fak_nopos', 'fak_pump', 'fak_push', 'fak_push_goof', 'fak_powerslide', 'fak_fs_powerslide', 'fak_manual', 'fak_nmanual', 'fak_air', 'fak_air_nose', 'fak_air_tail', 'fak_manual_left', 'fak_manual_right', 'fak_nmanual_left', 'fak_nmanual_right'],
2559
+	['fak_idle', 'fak_offboard', 'reg_offboard','fak_turnLeft', 'fak_turnRight', 'fak_opos', 'fak_nopos', 'fak_pump', 'fak_push', 'fak_push_goof', 'fak_powerslide', 'fak_fs_powerslide', 'fak_manual', 'fak_nmanual', 'fak_air', 'fak_air_nose', 'fak_air_tail', 'fak_manual_left', 'fak_manual_right', 'fak_nmanual_left', 'fak_nmanual_right'],
2560
 	#force exit, frame
2560
 	#force exit, frame
2561
 	None, 0,
2561
 	None, 0,
2562
 	#opposite
2562
 	#opposite
2563
 	'reg_roll')
2563
 	'reg_roll')
2564
 
2564
 
2565
+#not working
2565
 fak_turnLeft = a_class(
2566
 fak_turnLeft = a_class(
2566
 	#player armature action name, start, end frames
2567
 	#player armature action name, start, end frames
2567
 	'nfak_left', 10, 30,
2568
 	'nfak_left', 10, 30,
2572
 	#intro, length
2573
 	#intro, length
2573
 	None, 0,
2574
 	None, 0,
2574
 	#exits
2575
 	#exits
2575
-	['fak_roll', 'fak_opos', 'fak_nopos', 'fak_pump', 'fak_pump_left', 'fak_pump_right', 'fak_push', 'fak_push_goof', 'fak_powerslide', 'fak_fs_powerslide', 'fak_manual', 'fak_nmanual', 'fak_offboard', 'fak_air', 'fak_air_nose', 'fak_air_tail', 'fak_manual_left', 'fak_manual_right', 'fak_nmanual_left', 'fak_nmanual_right', 'reg_turnRight'],
2576
+	['fak_turnRight', 'fak_roll', 'fak_opos', 'fak_nopos', 'fak_pump', 'fak_pump_left', 'fak_pump_right', 'fak_push', 'fak_push_goof', 'fak_powerslide', 'fak_fs_powerslide', 'fak_manual', 'fak_nmanual', 'fak_offboard', 'fak_air', 'fak_air_nose', 'fak_air_tail', 'fak_manual_left', 'fak_manual_right', 'fak_nmanual_left', 'fak_nmanual_right', 'reg_turnRight'],
2576
 	#force exit, frame
2577
 	#force exit, frame
2577
 	None, 0,
2578
 	None, 0,
2578
 	#opposite
2579
 	#opposite
2588
 	#intro, length
2589
 	#intro, length
2589
 	None, 0,
2590
 	None, 0,
2590
 	#exits
2591
 	#exits
2591
-	['fak_roll', 'fak_opos', 'fak_nopos', 'fak_pump', 'fak_pump_left', 'fak_pump_right', 'fak_push', 'fak_push_goof', 'fak_powerslide', 'fak_fs_powerslide', 'fak_manual', 'fak_nmanual', 'fak_offboard', 'fak_air', 'fak_air_nose', 'fak_air_tail', 'fak_manual_left', 'fak_manual_right', 'fak_nmanual_left', 'fak_nmanual_right', 'reg_turnLeft'],
2592
+	['fak_turnLeft', 'fak_roll', 'fak_opos', 'fak_nopos', 'fak_pump', 'fak_pump_left', 'fak_pump_right', 'fak_push', 'fak_push_goof', 'fak_powerslide', 'fak_fs_powerslide', 'fak_manual', 'fak_nmanual', 'fak_offboard', 'fak_air', 'fak_air_nose', 'fak_air_tail', 'fak_manual_left', 'fak_manual_right', 'fak_nmanual_left', 'fak_nmanual_right', 'reg_turnLeft'],
2592
 	#force exit, frame
2593
 	#force exit, frame
2593
 	None, 0,
2594
 	None, 0,
2594
 	#opposite
2595
 	#opposite

+ 4
- 3
scripts/boneRecord.py View File

4
 dict = bge.logic.globalDict
4
 dict = bge.logic.globalDict
5
 dict['replay_record_length']
5
 dict['replay_record_length']
6
 
6
 
7
-bone_list = ["foot.ik.R", "foot.ik.L", "knee.pt.ik.R", "knee.pt.ik.L", "hips", "root", "spine", "spine-1", "chest", "chest-1", "clavicle.L", "clavicle.R", "deltoid.L", "deltoid.R", "upper_arm.fk.L", "upper_arm.fk.R",  "forearm.fk.L", "forearm.fk.R", "hand.fk.L", "hand.fk.R", "neck", "head", "master"]
7
+bone_list = ["foot.ik.R", "foot.ik.L", "knee.pt.ik.R", "knee.pt.ik.L", "hips", "root", "spine", "spine-1", "chest", "chest-1", "clavicle.L", "clavicle.R", "deltoid.L", "deltoid.R", "upper_arm.fk.L", "upper_arm.fk.R",  "forearm.fk.L", "forearm.fk.R", "hand.fk.L", "hand.fk.R", "neck", "head", "master", 
8
+    'foot.rev.R', 'foot.rev.L', 'shin.ik.R', 'shin.ik.L', 'toe.rev.R', 'toe.rev.L']
8
 
9
 
9
 deck_list = ['main', 'turn']
10
 deck_list = ['main', 'turn']
10
 
11
 
11
 #bone_list = ['root', 'head']
12
 #bone_list = ['root', 'head']
12
 
13
 
13
-def Record():    
14
+def Record():   
15
+    print('bone recording') 
14
     scene = bge.logic.getCurrentScene()
16
     scene = bge.logic.getCurrentScene()
15
     #own = cont.owner
17
     #own = cont.owner
16
     master = scene.objects['control_cube.002']
18
     master = scene.objects['control_cube.002']
17
     cam = scene.objects['Camera.003']
19
     cam = scene.objects['Camera.003']
18
     armature = scene.objects['Char4']
20
     armature = scene.objects['Char4']
19
     deck = scene.objects['deck_arm']
21
     deck = scene.objects['deck_arm']
20
-    #print('bone recording')
21
     if 'dataList' not in master:
22
     if 'dataList' not in master:
22
         for x in bone_list:
23
         for x in bone_list:
23
             master['dataList'] = True
24
             master['dataList'] = True

+ 1
- 2
scripts/camera.py View File

250
 
250
 
251
 ################
251
 ################
252
     multer = .02
252
     multer = .02
253
-    if dict['walk'] == 1 and not controlcube['ragdoll_active']:
253
+    if dict['walk'] == 1 and controlcube['ragdoll_active'] == False:
254
         if dict['cur_ccH_targetHeight'] < dict['cam_walk_height']:
254
         if dict['cur_ccH_targetHeight'] < dict['cam_walk_height']:
255
             dist = dict['cam_walk_height'] - dict['cur_ccH_targetHeight']
255
             dist = dict['cam_walk_height'] - dict['cur_ccH_targetHeight']
256
 
256
 
262
         cam.max = dict['cam_walk_max']
262
         cam.max = dict['cam_walk_max']
263
 
263
 
264
     else:
264
     else:
265
-
266
         if dict['cur_ccH_targetHeight'] < dict['cch_targetHeight']:
265
         if dict['cur_ccH_targetHeight'] < dict['cch_targetHeight']:
267
             dist = dict['cur_ccH_targetHeight'] - dict['cch_targetHeight']
266
             dist = dict['cur_ccH_targetHeight'] - dict['cch_targetHeight']
268
             dict['cur_ccH_targetHeight'] = dict['cur_ccH_targetHeight'] - (dist * multer)
267
             dict['cur_ccH_targetHeight'] = dict['cur_ccH_targetHeight'] - (dist * multer)

+ 19
- 6
scripts/controller2.py View File

611
             if LAST_LEFT_FAK == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
611
             if LAST_LEFT_FAK == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
612
                 LAST_LEFT_FAK = 1
612
                 LAST_LEFT_FAK = 1
613
             own["LAST_LEFT_FAK"] = 1
613
             own["LAST_LEFT_FAK"] = 1
614
+            
614
     def fak_stance_left_off():
615
     def fak_stance_left_off():
615
         LAST_LEFT_FAK = own["LAST_LEFT_FAK"]
616
         LAST_LEFT_FAK = own["LAST_LEFT_FAK"]
616
         own["LAST_LEFT_FAK"] = 0
617
         own["LAST_LEFT_FAK"] = 0
623
                 own['requestAction'] = 'fak_turnRight'
624
                 own['requestAction'] = 'fak_turnRight'
624
             LAST_RIGHT_FAK = own["LAST_RIGHT_FAK"]
625
             LAST_RIGHT_FAK = own["LAST_RIGHT_FAK"]
625
             own["LAST_RIGHT_FAK"] = 1
626
             own["LAST_RIGHT_FAK"] = 1
627
+
626
     def fak_stance_right_off():
628
     def fak_stance_right_off():
627
         LAST_RIGHT_FAK = own["LAST_RIGHT_FAK"]
629
         LAST_RIGHT_FAK = own["LAST_RIGHT_FAK"]
628
         own["LAST_RIGHT_FAK"] = 0
630
         own["LAST_RIGHT_FAK"] = 0
3385
                     pass
3387
                     pass
3386
 
3388
 
3387
     def getoffboard():
3389
     def getoffboard():
3388
-        lasty = own['lasty']
3390
+        #lasty = own['lasty']
3391
+        lasty = dict['last_yBut']
3389
         getoffboard = own['getoffboard']
3392
         getoffboard = own['getoffboard']
3390
         # if getoffboard == 1 and own['fall'] == False:
3393
         # if getoffboard == 1 and own['fall'] == False:
3391
         #     own['getoffboard'] = 0
3394
         #     own['getoffboard'] = 0
3395
         if (yBut == True and lasty == False) or dict['kb_q'] == 3:
3398
         if (yBut == True and lasty == False) or dict['kb_q'] == 3:
3396
             own['getoffboard'] = 1
3399
             own['getoffboard'] = 1
3397
 
3400
 
3401
+
3402
+
3398
     def switchcam():
3403
     def switchcam():
3399
         pass
3404
         pass
3400
     #    if ltsBut == False and own['lastlts'] == True and rtsBut == False:
3405
     #    if ltsBut == False and own['lastlts'] == True and rtsBut == False:
3948
 
3953
 
3949
     def wallride_sound():
3954
     def wallride_sound():
3950
         sact = own.actuators["wallSound"]
3955
         sact = own.actuators["wallSound"]
3956
+        # if 'aState' not in own:
3957
+        #     own['aState'] = ''
3951
         if  own['aState'] in ['reg_wall_r', 'reg_wall_l', 'fak_wall_r', 'fak_wall_l'] and not skater.isPlayingAction(3):
3958
         if  own['aState'] in ['reg_wall_r', 'reg_wall_l', 'fak_wall_r', 'fak_wall_l'] and not skater.isPlayingAction(3):
3952
             sact.volume = .2
3959
             sact.volume = .2
3953
             cont.activate(own.actuators["wallSound"])
3960
             cont.activate(own.actuators["wallSound"])
4264
             ud_sens = .04      
4271
             ud_sens = .04      
4265
             if 'spine' in localRay_v[0] and lUD < -.04:
4272
             if 'spine' in localRay_v[0] and lUD < -.04:
4266
                 if STANCE == True:
4273
                 if STANCE == True:
4267
-                    own.applyRotation([0,.15,0], True)
4274
+                    #own.applyRotation([0,.15,0], True)
4275
+                    own.applyRotation([0,.1,0], True)
4268
                 else:    
4276
                 else:    
4269
-                    own.applyRotation([0,-.15,0], True)
4270
-                own.linearVelocity.x *= .97  
4277
+                    #own.applyRotation([0,-.15,0], True)
4278
+                    own.applyRotation([0,-.1,0], True)
4279
+                #own.linearVelocity.x *= .97  
4280
+                own.linearVelocity.x *= .95
4271
             
4281
             
4272
             elif lUD > -ud_sens: 
4282
             elif lUD > -ud_sens: 
4273
                 own['last_vert_frame'] = own['framenum']
4283
                 own['last_vert_frame'] = own['framenum']
4280
                         own.localLinearVelocity.z = 0
4290
                         own.localLinearVelocity.z = 0
4281
                     own.applyMovement((0, 0, (.295 - (localHitDist))), True)
4291
                     own.applyMovement((0, 0, (.295 - (localHitDist))), True)
4282
                     if localRay_v[2] != [0, 0, -1]:    
4292
                     if localRay_v[2] != [0, 0, -1]:    
4283
-                        own.alignAxisToVect(localRay_v[2], 2, .5)
4293
+                        #own.alignAxisToVect(localRay_v[2], 2, .5)
4294
+                        own.alignAxisToVect(localRay_v[2], 2, .15)
4284
                         aligned = True
4295
                         aligned = True
4296
+                # elif localHitDist > .4 and localHitDist < 1.5:
4297
+                #     own.applyMovement((0, 0, (.295 - (localHitDist))), True)
4285
             else:
4298
             else:
4286
                 own.alignAxisToVect([0,0,1], 2, .1)
4299
                 own.alignAxisToVect([0,0,1], 2, .1)
4287
                 print('doing nothing')            
4300
                 print('doing nothing')            
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']:
4335
     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']:
4323
         own['requestAction'] = 'fak_land'   
4336
         own['requestAction'] = 'fak_land'   
4324
 
4337
 
4325
-    print(own['getonboard'], 'controller geton', '--controller running')
4338
+    #print(own['getonboard'], 'controller geton', '--controller running')

+ 3
- 1
scripts/game.py View File

20
 		own['game_inited'] = True
20
 		own['game_inited'] = True
21
 		own['cont'] = cont
21
 		own['cont'] = cont
22
 		dict['gameFSM'] = FSM.GameFSM(own)
22
 		dict['gameFSM'] = FSM.GameFSM(own)
23
+		dict['game_life'] = 0
23
 		#phone_home()
24
 		#phone_home()
24
 
25
 
25
-	dict['gameFSM'].Execute()
26
+	dict['gameFSM'].Execute()
27
+	dict['game_life'] += 1

+ 179
- 10
scripts/player.py View File

1
 import bge
1
 import bge
2
 import FSM
2
 import FSM
3
 from mathutils import Vector
3
 from mathutils import Vector
4
+import math
5
+import mathutils
4
 
6
 
5
 dict = bge.logic.globalDict
7
 dict = bge.logic.globalDict
6
 
8
 
14
 		self.throw_timer = 0
16
 		self.throw_timer = 0
15
 		self.throw_deck = None
17
 		self.throw_deck = None
16
 		self.throw_deck_empty = self.obj.childrenRecursive["throw_deck_empty"]
18
 		self.throw_deck_empty = self.obj.childrenRecursive["throw_deck_empty"]
19
+		self.step = True
20
+		self.dropin_obj = None
21
+
17
 		#self.throw_deck_obj = dict['level_scene'].objects['throw_deck']
22
 		#self.throw_deck_obj = dict['level_scene'].objects['throw_deck']
18
 		dict['walking'] = True
23
 		dict['walking'] = True
19
 		#print(self.obj.childrenRecursive)
24
 		#print(self.obj.childrenRecursive)
40
 		front_start = start - 0.30 * tv
45
 		front_start = start - 0.30 * tv
41
 		start.z += .1
46
 		start.z += .1
42
 		front_end = Vector(front_start + (self.obj.worldOrientation.col[axis] * distance))
47
 		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)
48
+		frontray = self.obj.rayCast(front_end, front_start, 0, 'ground', 1, 0, 0, 53247)
49
+		#if ray[0] == None and frontray[0] == None:
50
+		cray = self.obj.rayCast(end, start, 0, 'ground', 1, 0, 0, 53247)
51
+
44
 		#bge.render.drawLine(front_start, front_end, [1,0,0])
52
 		#bge.render.drawLine(front_start, front_end, [1,0,0])
45
-		return [ray, frontray]
53
+		#bge.render.drawLine(back_start, end, [0,1,0])
54
+		#bge.render.drawLine(start, end, [0,0,1])
55
+		return [ray, frontray, cray]
56
+
57
+
58
+
59
+	def get_dropin_rays(self):
60
+		v = self.obj.worldOrientation.col[0]
61
+		tv = v.normalized()
62
+		axis = 2
63
+		distance = -50
64
+		start = self.obj.worldPosition.copy()
65
+		back_start = start + 0.1 * tv
66
+		start.z += .1
67
+		end = Vector.copy(self.obj.worldPosition + (self.obj.worldOrientation.col[axis] * distance))
68
+		ray = self.obj.rayCast(end, back_start, 0, 'ground', 1, 0, 0, 53247)
69
+		
70
+		v = self.obj.linearVelocity.copy()
71
+		v = self.obj.worldOrientation.col[0]
72
+		tv = v.normalized()
73
+		front_start = start - 0.1 * tv
74
+		start.z += .1
75
+		front_end = Vector(front_start + (self.obj.worldOrientation.col[axis] * distance))
76
+		frontray = self.obj.rayCast(front_end, front_start, 0, 'ground', 1, 0, 0, 53247)
77
+		cray = self.obj.rayCast(end, start, 0, 'ground', 1, 0, 0, 53247)
78
+		return [ray, frontray, cray]		
46
 
79
 
47
 
80
 
48
 	def get_hang_ray(self):
81
 	def get_hang_ray(self):
90
 	def get_ground_dist(self, groundray):
123
 	def get_ground_dist(self, groundray):
91
 		gr = groundray[0]
124
 		gr = groundray[0]
92
 		fgr = groundray[1]
125
 		fgr = groundray[1]
126
+		cgr = groundray[2]
93
 		d = None
127
 		d = None
94
 		
128
 		
95
 		if gr[0] != None:
129
 		if gr[0] != None:
102
 
136
 
103
 				if p2 < distance_to_ground:
137
 				if p2 < distance_to_ground:
104
 					distance_to_ground = p2
138
 					distance_to_ground = p2
139
+			
140
+			if cgr[0] != None:
141
+				p2 = p_z - cgr[1].z 
142
+
143
+				if p2 < distance_to_ground:
144
+					distance_to_ground = p2
105
 
145
 
106
 			return distance_to_ground
146
 			return distance_to_ground
107
 
147
 
122
 			self.obj.linearVelocity.z = 0
162
 			self.obj.linearVelocity.z = 0
123
 
163
 
124
 	def align_walk_z(self):
164
 	def align_walk_z(self):
125
-		self.obj.alignAxisToVect([0,0,1], 2, .05)
165
+		self.obj.alignAxisToVect([0,0,1], 2, .08)
126
 
166
 
127
 	def walk_movement(self):
167
 	def walk_movement(self):
128
 		
168
 		
181
 			dict['camera'].applyMovement([0, amt2, 0], True)	
221
 			dict['camera'].applyMovement([0, amt2, 0], True)	
182
 
222
 
183
 	def check_reset_point(self):
223
 	def check_reset_point(self):
184
-		print(dict['udPad'], dict['ddPad'])
185
-		if dict['udPad'] == 1:
186
-			print('set reset')
187
-		elif dict['ddPad'] == 1:
188
-			print('go to reset')			
189
-#reset
190
 		if dict['ddPad'] == 1:
224
 		if dict['ddPad'] == 1:
191
 			spawn_pos = self.obj['spawn_pos']
225
 			spawn_pos = self.obj['spawn_pos']
192
 			spawn_rot = self.obj['spawn_rot']
226
 			spawn_rot = self.obj['spawn_rot']
266
 				self.throw_deck.endObject()
300
 				self.throw_deck.endObject()
267
 				self.throw_deck = None
301
 				self.throw_deck = None
268
 
302
 
303
+	def drop_deck(self):
304
+
305
+		if self.throw_deck == None:	
306
+			self.throw_deck = dict['level_scene'].addObject('throw_deck', self.throw_deck_empty, 0)
307
+			self.throw_deck.worldOrientation = self.throw_deck_empty.worldOrientation
308
+			#self.throw_deck.applyForce([0, 0, -300], True)
309
+			#-z = forward +y = height
310
+			self.throw_deck.applyMovement([-.5, 0, .5], True)
311
+			self.throw_deck.worldPosition.z += .4
312
+			self.throw_deck.applyForce([0, 50, 75], True)
313
+			self.hide_deck()
314
+
315
+		
316
+			
317
+
269
 
318
 
270
 
319
 
271
 		#if self.throw_timer > 0:
320
 		#if self.throw_timer > 0:
277
 		for x in self.deck_arm.childrenRecursive:
326
 		for x in self.deck_arm.childrenRecursive:
278
 			x.visible = True
327
 			x.visible = True
279
 
328
 
280
-
329
+	def get_vert_rot(self, own, object):
330
+
331
+	        if 'inited' not in object:
332
+	            object['inited'] = True
333
+
334
+	            for mesh in object.meshes:
335
+	                red_verts = []
336
+	                green_verts = []
337
+	                for m_index in range(len(mesh.materials)):
338
+	                    for v_index in range(mesh.getVertexArrayLength(m_index)):
339
+	                        vertex = mesh.getVertex(m_index, v_index)
340
+	                        if vertex.color[0] > .8:
341
+	                            loc = object.worldTransform * vertex.XYZ
342
+	                            red_verts.append(loc.freeze())
343
+	                        if vertex.color[1] > .8:
344
+	                            loc = object.worldTransform * vertex.XYZ
345
+	                            green_verts.append(loc.freeze())
346
+	                           
347
+	            red_verts = set(red_verts)
348
+	            #for v in red_verts:
349
+	                #print(v, 'red_vert')
350
+	            green_verts = set(green_verts)               
351
+	            object['red_verts'] = red_verts
352
+	            object['green_verts'] = green_verts
353
+	            
354
+	            size_red = len(object['red_verts'])
355
+	            kd_red = mathutils.kdtree.KDTree(size_red)
356
+	            size_green = len(object['green_verts'])
357
+	            kd_green = mathutils.kdtree.KDTree(size_green)    
358
+
359
+	            for i, v in enumerate(object['red_verts']):
360
+	                kd_red.insert(v, i)
361
+	            for i, v in enumerate(object['green_verts']):
362
+	                kd_green.insert(v, i)
363
+
364
+	            kd_red.balance()
365
+	            kd_green.balance() 
366
+	            object['kd_red'] = kd_red
367
+	            object['kd_green'] = kd_green    
368
+	            #print('kd built -------')
369
+	            #print(own['kd_red'])
370
+	        # Find the closest points to the player
371
+	        #co_find = control_bottom.worldPosition
372
+	        co_find = own.worldPosition
373
+	        found_red = object['kd_red'].find_n(co_find, 2)
374
+	        found_green = object['kd_green'].find_n(co_find, 1)    
375
+	        
376
+	        primary = Vector(found_red[0][0])
377
+	        secondary = Vector(found_red[1][0])
378
+
379
+	        lineVector = secondary - primary
380
+	        lineVector2 = primary - secondary
381
+	        if found_green != []:
382
+	            lv_green = Vector(found_green[0][0])
383
+	            
384
+	        eul = Vector((1, 0, 0)).rotation_difference(lineVector).to_euler()        
385
+	        
386
+	        te = dict['level_scene'].objects['temp_empty']
387
+	        
388
+
389
+	        rotation = te.worldOrientation.to_euler()
390
+	        if abs(rotation.z) > 3:
391
+	            te.applyRotation([0, 0, 1.570796*2], True)
392
+	        
393
+	        xyz = te.localOrientation.to_euler()
394
+	        xyz[0] = math.radians(0)
395
+	        te.localOrientation = xyz.to_matrix()
396
+
397
+	        if lineVector == Vector([0.0, 0.0, 0.0]):
398
+	            #print('vector is empty')
399
+	            pass
400
+	        else:
401
+	            te.alignAxisToVect(lineVector, 0, 1)
402
+	        
403
+	        te.worldPosition = primary
404
+
405
+	        if found_green != []:
406
+	            local = te.worldOrientation.inverted() * (lv_green - te.worldPosition)
407
+	            if local.y < 0:
408
+	                #print('flip vector')
409
+	                eul = Vector((1, 0, 0)).rotation_difference(lineVector2).to_euler() 
410
+	                if lineVector2 == Vector([0.0, 0.0, 0.0]):
411
+	                    #print('linVector2 is empty')
412
+	                    pass
413
+	                else:
414
+	                    te.alignAxisToVect(lineVector2, 0, 1)
415
+	                #print('align2', lineVector2)
416
+	                te.worldPosition = secondary
417
+	            else:
418
+	                #print('align1', lineVector)  
419
+	                pass
420
+
421
+
422
+	        #flip z axis
423
+
424
+	        #print(local, 'local')
425
+	        
426
+	        myhead = te.worldOrientation.col[2]
427
+	        worldUp = Vector([0,0,1])
428
+	        #worldY = Vector([0,1,0])
429
+	        dot_p = myhead.dot(worldUp)
430
+
431
+	        if dot_p > 0.9:
432
+	            pass
433
+	        else:
434
+	            #print('flip grind object rotation')
435
+	            te.applyRotation([1.570796*2, 0, 0], True)
436
+
437
+
438
+
439
+
440
+	        return eul
441
+
442
+	def move_to_te(self):
443
+		o = self.obj
444
+		te = dict['level_scene'].objects['temp_empty']
445
+		te.applyRotation([0,0,-3.14/2], True)
446
+		te.worldPosition.z += .3
447
+		o.worldPosition = te.worldPosition
448
+		o.worldOrientation = te.worldOrientation
449
+		o.linearVelocity = [0,0,0]
281
 
450
 
282
 
451
 
283
 def update(cont):
452
 def update(cont):

+ 47
- 34
scripts/ragdoll.py View File

89
     #if (sens.positive) or (dict['aBut'] == 1 and dict['bBut'] == 1) or own['fall'] == True:
89
     #if (sens.positive) or (dict['aBut'] == 1 and dict['bBut'] == 1) or own['fall'] == True:
90
     if (sens.positive) or own['fall'] == True:
90
     if (sens.positive) or own['fall'] == True:
91
         #print('option1')
91
         #print('option1')
92
-        #own['fall'] = True
92
+        own['fall'] = False
93
         if own['ragdoll_active'] == False:
93
         if own['ragdoll_active'] == False:
94
             #own['fall'] = 1
94
             #own['fall'] = 1
95
             own['fall'] = True
95
             own['fall'] = True
96
             print('do ragdoll')
96
             print('do ragdoll')
97
             incer = -1
97
             incer = -1
98
             update_rb(own['rd_rb'], scene)   
98
             update_rb(own['rd_rb'], scene)   
99
-            while incer < 20:
100
-                incer += 1
101
-                scene.objects[armature].stopAction(incer)
99
+            # while incer < 20:
100
+            #     incer += 1
101
+            #     scene.objects[armature].stopAction(incer)
102
             pB = scene.objectsInactive["npc_ed_arm_physBody"]        
102
             pB = scene.objectsInactive["npc_ed_arm_physBody"]        
103
             physBody = own['rd_rb']
103
             physBody = own['rd_rb']
104
             physBody.worldPosition = own.worldPosition
104
             physBody.worldPosition = own.worldPosition
112
             own['ragdoll_active'] = True
112
             own['ragdoll_active'] = True
113
             max_constraints(own, scene, physBody)
113
             max_constraints(own, scene, physBody)
114
             own.visible = False
114
             own.visible = False
115
+            #own.visible = True
115
             own['throw_deck'] = False
116
             own['throw_deck'] = False
116
             cont.actuators['Camera'].height = 2.0
117
             cont.actuators['Camera'].height = 2.0
117
             #cont.actuators['Camera'].min = 14.0
118
             #cont.actuators['Camera'].min = 14.0
118
             #cont.actuators['Camera'].max = 18.0
119
             #cont.actuators['Camera'].max = 18.0
119
             cont.actuators['Camera'].damping = .000001
120
             cont.actuators['Camera'].damping = .000001
120
             cont.activate(cont.actuators['Camera']) 
121
             cont.activate(cont.actuators['Camera']) 
121
-                        
122
-            #own.suspendDynamics()
122
+            own.suspendDynamics(True)
123
             
123
             
124
     else:
124
     else:
125
 
125
 
126
         if own['ragdoll_active'] == True:
126
         if own['ragdoll_active'] == True:
127
             #pass
127
             #pass
128
-            scene.objects[armature].stopAction(2)
129
-            scene.objects[armature].stopAction(7)
130
-            scene.objects[armature].update()
128
+            own['rd_incer'] += 1
129
+            # scene.objects[armature].stopAction(1)
130
+            # scene.objects[armature].stopAction(2)
131
+            # scene.objects[armature].stopAction(3)
132
+            # scene.objects[armature].stopAction(7)
133
+            #scene.objects[armature].update()
131
             
134
             
132
             #cont.actuators['Camera'].object = scene.objects['ragdoll_parent']
135
             #cont.actuators['Camera'].object = scene.objects['ragdoll_parent']
133
-            #scene.objects['control_cube.002'].worldPosition = scene.objects['control_cube.002'].worldPosition.lerp(scene.objects['ragdoll_parent'].worldPosition, .01)
134
-            scene.objects['control_cube.002'].worldPosition = scene.objects['ragdoll_parent'].worldPosition
136
+            scene.objects['control_cube.002'].worldPosition = scene.objects['control_cube.002'].worldPosition.lerp(scene.objects['ragdoll_parent'].worldPosition, .01)
137
+            #scene.objects['control_cube.002'].worldPosition = scene.objects['ragdoll_parent'].worldPosition
135
 
138
 
139
+            #print('doing the active thing')
136
 
140
 
137
 
141
 
138
             wp = scene.objects['camCube'].worldPosition - scene.objects['ragdoll_parent'].worldPosition
142
             wp = scene.objects['camCube'].worldPosition - scene.objects['ragdoll_parent'].worldPosition
148
             else:    
152
             else:    
149
                 own['requestAction'] = 'fak_walk'
153
                 own['requestAction'] = 'fak_walk'
150
             if own['rd_set_vel'] == True:
154
             if own['rd_set_vel'] == True:
151
-                print(own['rd_incer'], 'rdincer', own['rd_vel'])
155
+                #print(own['rd_incer'], 'rdincer', own['rd_vel'])
152
                 
156
                 
153
                 scene.objects['npc_ed_arm_phys_master'].setLinearVelocity(own['rd_vel'] * 20, False)
157
                 scene.objects['npc_ed_arm_phys_master'].setLinearVelocity(own['rd_vel'] * 20, False)
154
                 own['rd_set_vel'] = False
158
                 own['rd_set_vel'] = False
160
                     #scene.objects['npc_ed_arm_phys_master'].worldLinearVelocity.x = 100
164
                     #scene.objects['npc_ed_arm_phys_master'].worldLinearVelocity.x = 100
161
                     #scene.objects['npc_ed_arm_phys_master'].applyForce([5000,0,0], False)
165
                     #scene.objects['npc_ed_arm_phys_master'].applyForce([5000,0,0], False)
162
                     for pB in own['rd_rb'].groupMembers:
166
                     for pB in own['rd_rb'].groupMembers:
163
-                        print('setting', pB, own['rd_vel'])
167
+                        #print('setting', pB, own['rd_vel'])
164
                         
168
                         
165
                         try:
169
                         try:
166
                             #pass
170
                             #pass
168
                             #pB.worldLinearVelocity.x = 100
172
                             #pB.worldLinearVelocity.x = 100
169
                             #pB.worldLinearVelocity = own['rd_vel']
173
                             #pB.worldLinearVelocity = own['rd_vel']
170
                             pB.setLinearVelocity(own['rd_vel'], False)
174
                             pB.setLinearVelocity(own['rd_vel'], False)
171
-                            print('adding force to', pB, pB.worldLinearVelocity)
175
+                            #print('adding force to', pB, pB.worldLinearVelocity)
172
                         except:
176
                         except:
173
                             print('cant add force to ', pB)
177
                             print('cant add force to ', pB)
174
                 else:
178
                 else:
183
                 for x in own['rd_rb'].groupMembers:
187
                 for x in own['rd_rb'].groupMembers:
184
                     x.suspendDynamics(True)
188
                     x.suspendDynamics(True)
185
                 own['ragdoll_active'] = False    
189
                 own['ragdoll_active'] = False    
186
-                print(scene.objects[armature].parent, 'parent')
190
+                #print(scene.objects[armature].parent, 'parent')
187
                 cont.actuators['Camera'].object = scene.objects['camCube']
191
                 cont.actuators['Camera'].object = scene.objects['camCube']
188
                 cont.activate(cont.actuators['Camera']) 
192
                 cont.activate(cont.actuators['Camera']) 
189
                 own.worldPosition = scene.objects['npc_ed_arm_phys_master'].worldPosition
193
                 own.worldPosition = scene.objects['npc_ed_arm_phys_master'].worldPosition
190
-                own.worldPosition.z += .4
194
+                own.worldPosition.z += .8#4
191
                 cont.activate(cont.actuators['walk']) 
195
                 cont.activate(cont.actuators['walk']) 
192
                 own['getonboard'] = True
196
                 own['getonboard'] = True
193
                 dict['walk'] = 0
197
                 dict['walk'] = 0
194
                 own['fall'] = False
198
                 own['fall'] = False
195
-
196
             if dict['lUD'] < -.08 and own['rd_incer'] > 200:
199
             if dict['lUD'] < -.08 and own['rd_incer'] > 200:
197
                 physBody = own['rd_rb']
200
                 physBody = own['rd_rb']
198
                 excludes = ['npc_ed_arm_phys_hand.R', 'npc_ed_arm_phys_hand.L', 'npc_ed_arm_phys_forearm.fk.L', 'npc_ed_arm_phys_forearm.fk.R', 'npc_ed_arm_phys_upper_arm.fk.L', 'npc_ed_arm_phys_upper_arm.fk.R']
201
                 excludes = ['npc_ed_arm_phys_hand.R', 'npc_ed_arm_phys_hand.L', 'npc_ed_arm_phys_forearm.fk.L', 'npc_ed_arm_phys_forearm.fk.R', 'npc_ed_arm_phys_upper_arm.fk.L', 'npc_ed_arm_phys_upper_arm.fk.R']
199
                 #excludes = []
202
                 #excludes = []
200
-                for x in physBody.groupMembers:
201
-                    print(x.name)
203
+                # for x in physBody.groupMembers:
204
+                #     print(x.name)
202
                                     
205
                                     
203
-                    if x.name not in excludes:
204
-                        pass
205
-                        #x.applyForce([0,0,15], False)
206
-                    else:
207
-                        #x.applyForce([0,0,100], False)   
208
-                        pass 
206
+                #     if x.name not in excludes:
207
+                #         #pass
208
+                #         x.applyForce([0,0,15], False)
209
+                #     else:
210
+                #         x.applyForce([0,0,100], False)   
211
+                #         #pass 
209
 
212
 
210
-                scene.objects['npc_ed_arm_phys_master'].applyForce([0,0,500], False)
213
+                # scene.objects['npc_ed_arm_phys_master'].applyForce([0,0,500], False)
211
                 scene.objects['npc_ed_arm_phys_head'].applyForce([0,0,400], False)
214
                 scene.objects['npc_ed_arm_phys_head'].applyForce([0,0,400], False)
212
-                scene.objects['npc_ed_arm_phys_chest'].applyForce([0,0,200], False)
215
+                # scene.objects['npc_ed_arm_phys_chest'].applyForce([0,0,200], False)
213
                 scene.objects['npc_ed_arm_phys_chest-1'].applyForce([0,0,200], False)
216
                 scene.objects['npc_ed_arm_phys_chest-1'].applyForce([0,0,200], False)
214
-                scene.objects['npc_ed_arm_phys_spine'].applyForce([0,0,200], False)
217
+                # scene.objects['npc_ed_arm_phys_spine'].applyForce([0,0,200], False)
215
                 scene.objects['npc_ed_arm_phys_neck'].applyForce([0,0,200], False)
218
                 scene.objects['npc_ed_arm_phys_neck'].applyForce([0,0,200], False)
216
-                scene.objects['npc_ed_arm_phys_deltoid.L'].applyForce([0,0,200], False)
217
-                scene.objects['npc_ed_arm_phys_deltoid.R'].applyForce([0,0,200], False)
218
-                scene.objects['npc_ed_arm_phys_clavicle.L'].applyForce([0,0,200], False)
219
-                scene.objects['npc_ed_arm_phys_clavicle.R'].applyForce([0,0,200], False)
219
+                scene.objects['npc_ed_arm_phys_forearm.fk.L'].applyForce([0,0,30], False)
220
+                scene.objects['npc_ed_arm_phys_forearm.fk.R'].applyForce([0,0,30], False)
221
+                
222
+                # scene.objects['npc_ed_arm_phys_deltoid.L'].applyForce([0,0,200], False)
223
+                # scene.objects['npc_ed_arm_phys_deltoid.R'].applyForce([0,0,200], False)
224
+                # scene.objects['npc_ed_arm_phys_clavicle.L'].applyForce([0,0,200], False)
225
+                # scene.objects['npc_ed_arm_phys_clavicle.R'].applyForce([0,0,200], False)
220
 
226
 
221
-            if dict['rUD'] > .08 and own['rd_incer'] > 200:
222
-                scene.objects['npc_ed_arm_phys_master'].applyForce([0,600,0], True)
227
+            if dict['lLR'] < -.04:
228
+                scene.objects['npc_ed_arm_phys_spine'].applyRotation([0,.1,0], True)
229
+                scene.objects['npc_ed_arm_phys_head'].applyRotation([0,.1,0], True)
230
+            if dict['lLR'] > .04:
231
+                scene.objects['npc_ed_arm_phys_spine'].applyRotation([0,-.1,0], True)
232
+                scene.objects['npc_ed_arm_phys_head'].applyRotation([0,-.1,0], True)
233
+                
234
+            # if dict['rUD'] > .08 and own['rd_incer'] > 200:
235
+            #     scene.objects['npc_ed_arm_phys_master'].applyForce([0,600,0], True)
223
         else:
236
         else:
224
             update_rb(own['rd_rb'], scene)   
237
             update_rb(own['rd_rb'], scene)   
225
             #pass
238
             #pass

+ 14
- 0
scripts/sound_man.py View File

10
 	self.pop = sounds('pop')
10
 	self.pop = sounds('pop')
11
 	self.land = sounds('land')
11
 	self.land = sounds('land')
12
 	self.roll = sounds('roll')
12
 	self.roll = sounds('roll')
13
+	self.s_l_1 = sounds('s_l_1')
14
+
15
+	self.s_r_1 = sounds('s_r_1')
16
+	self.s_l_2 = sounds('s_l_2')
17
+	self.s_r_2 = sounds('s_r_2')
18
+	self.s_l_1.volume = 0.3
19
+	self.s_r_1.volume = 0.3
20
+	self.s_l_1.pitch = 3
21
+	self.s_r_1.pitch = 3
22
+
23
+	self.walk_grunt = sounds('walk_grunt')
24
+	self.walk_land = sounds('walk_land')
25
+	self.walk_hang = sounds('walk_hang')
26
+	self.walk_climb = sounds('walk_climb')
13
 	self.revert = sounds('revert')
27
 	self.revert = sounds('revert')
14
 	self.engine_idle = sounds('engine_idle')
28
 	self.engine_idle = sounds('engine_idle')
15
 	self.roll.loop = True
29
 	self.roll.loop = True

+ 2
- 2
shuvit.blend View File

1
 version https://git-lfs.github.com/spec/v1
1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:ed9ccab1cd84ac46d7e14d38f51a2a6c4c23d4bc182f4cb05510ee43188ef47f
3
-size 125585980
2
+oid sha256:d1ad57d6355aae70aaf5a7e4dc2ca1a6917ca514249d3c072e54524ac5e2b0d0
3
+size 125371052

+ 3
- 0
sounds/s_l_1.wav View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:a143eb49abfe2cb65b7cdf9334049969eb1d7158421351d5586a61c5234c0f17
3
+size 96948

+ 3
- 0
sounds/s_l_2.wav View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:c47a482aae3f046822412fbc27dcd1b181a9d574992a746aea0be8a05d8f6c2d
3
+size 84092

+ 3
- 0
sounds/s_r_1.wav View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:f597344c9b60d80945d809cc7fd8cf7024bfd9834206b0e728cd907e0f73ea6c
3
+size 99284

+ 3
- 0
sounds/s_r_2.wav View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:7f719526cd85d65a6d6390a2a9f1f3693ad706e9af59bf76aa6271835a365e1a
3
+size 70576

+ 3
- 0
sounds/walk_climb.wav View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:670e826c4bd46f51eb6352fdb8e07e18ee0f106596ed0afa61a63487b01ddefe
3
+size 49584

+ 3
- 0
sounds/walk_grunt.wav View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:2a0f9b681331d5e8bc5da85a6a116b14faf96f80a8b65527ab7eb07ed158d010
3
+size 49584

+ 3
- 0
sounds/walk_hang.wav View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:57b60a397c288b0c5be62717fa26ac3bc877919bc67b927ecf12e260de966daf
3
+size 456044

+ 3
- 0
sounds/walk_land.wav View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:113be012923dd1ac23bdb8e17cd345cf8a0acbf77318167a81115def6b6f8995
3
+size 100384

+ 3
- 0
sounds/walkondirt.wav View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:c13bfda173c45077e66dbdffe96771ee77c8d5c22343b053668ff59edd710cc4
3
+size 403244

Loading…
Cancel
Save