shuvit 6 years ago
parent
commit
bac1461a7e
3 changed files with 38 additions and 39 deletions
  1. 6
    2
      co_ActionState.py
  2. 20
    34
      controller2.py
  3. 12
    3
      walk.py

+ 6
- 2
co_ActionState.py View File

@@ -492,9 +492,9 @@ def main():
492 492
             requestAction = 'fak_land'  
493 493
 
494 494
         if l_actionState in ('reg_air_tail', 'reg_air_nose') and requestAction in ('fak_opos', 'fak_nopos'):
495
-            requestAction = 'fak_land'
495
+            requestAction = 'reg_land'
496 496
         if l_actionState in ('fak_air_tail', 'fak_air_nose') and requestAction in ('reg_opos', 'reg_nopos'):
497
-            requestAction = 'reg_land'            
497
+            requestAction = 'fak_land'            
498 498
                                                                                                                                                                                         
499 499
     else:
500 500
         print("action over written")               
@@ -1187,21 +1187,25 @@ def main():
1187 1187
 
1188 1188
             if requestAction == 'reg_push' and own['actionTimer'] == 0:
1189 1189
                 own['actionTimer'] = 70
1190
+                actionState = 'reg_push'
1190 1191
                 skater.playAction("reg_push", 1,35, layer=trans_layer, play_mode=0, speed=.5)
1191 1192
                 deck.playAction("a_reg", 1,40, layer=trans_layer, play_mode=1, speed=.5)
1192 1193
                 trucks.playAction("a_reg", 1,40, layer=trans_layer, play_mode=1, speed=.5)
1193 1194
             if requestAction == 'reg_push_goof' and own['actionTimer'] == 0:
1194 1195
                 own['actionTimer'] = 70
1196
+                actionState = 'reg_push_goof'
1195 1197
                 skater.playAction("reg_push_goof", 1,35, layer=trans_layer, play_mode=0, speed=.5)
1196 1198
                 deck.playAction("a_reg", 1,40, layer=trans_layer, play_mode=1, speed=.5)
1197 1199
                 trucks.playAction("a_reg", 1,40, layer=trans_layer, play_mode=1, speed=.5)
1198 1200
             if requestAction == 'fak_push' and own['actionTimer'] == 0:
1199 1201
                 own['actionTimer'] = 70
1202
+                actionState = 'fak_push'
1200 1203
                 skater.playAction("fak_push", 1,35, layer=trans_layer, play_mode=0, speed=.5)
1201 1204
                 deck.playAction("a_reg", 1,40, layer=trans_layer, play_mode=1, speed=.5)
1202 1205
                 trucks.playAction("a_reg", 1,40, layer=trans_layer, play_mode=1, speed=.5)
1203 1206
             if requestAction == 'fak_push_goof' and own['actionTimer'] == 0:
1204 1207
                 own['actionTimer'] = 70
1208
+                actionState = 'fak_push_goof'
1205 1209
                 skater.playAction("fak_push_goof", 1,35, layer=trans_layer, play_mode=0, speed=.5)
1206 1210
                 deck.playAction("a_reg", 1,40, layer=trans_layer, play_mode=1, speed=.5)
1207 1211
                 trucks.playAction("a_reg", 1,40, layer=trans_layer, play_mode=1, speed=.5)

+ 20
- 34
controller2.py View File

@@ -312,6 +312,7 @@ def main():
312 312
             playing_frame = skater.getActionFrame(fliplay)
313 313
         if r_ground.triggered == True and skater.isPlayingAction(fliplay) and own['jump_timer'] < 40 and playing_frame < 14 and playing_frame > 3:
314 314
             own['fall'] = 1
315
+            own['last_fall_frame'] = frame
315 316
             print("fall: ", playing_frame, own['jump_timer'])
316 317
             if STANCE == 0:
317 318
                 #own['requestAction'] = 'reg_fall1'
@@ -997,41 +998,26 @@ def main():
997 998
         if linVelocity.x < .05 and linVelocity.x > -.05 and own["lastStop"] == True:
998 999
             own["lastStop"] == False       
999 1000
 
1000
-    def oposin():
1001
-        if skater.isPlayingAction(30) or skater.isPlayingAction(31):
1002
-            landing = 1
1003
-        else:
1004
-            landing = 0     
1005
-        if (r_ground.triggered == 1) and STANCE == False and landing == 0 and own['manual'] == 0:
1006
-            if grindold == 0:
1007
-                own['requestAction'] = 'reg_opos'
1008
-        elif (r_ground.triggered == 1) and STANCE == True and own['manual'] == 0:
1009
-            if grindold == 0:
1010
-                own['requestAction'] = 'fak_opos'
1011
-        else:
1012
-            killact(65)
1013
-            killact(66)
1014
-            killact(67)
1015
-            killact(68)          
1016
-        own["last_Opos"] = True
1001
+    def oposin(): 
1002
+        if ground_since > 30:       
1003
+            if (r_ground.triggered == 1) and STANCE == False and own['manual'] == 0:
1004
+                if grindold == 0:
1005
+                    own['requestAction'] = 'reg_opos'
1006
+            elif (r_ground.triggered == 1) and STANCE == True and own['manual'] == 0:
1007
+                if grindold == 0:
1008
+                    own['requestAction'] = 'fak_opos'
1009
+         
1010
+            own["last_Opos"] = True
1017 1011
         
1018
-    def noposin():
1019
-        if skater.isPlayingAction(30) or skater.isPlayingAction(31):
1020
-            landing = 1
1021
-        else:
1022
-            landing = 0    
1023
-        if (r_ground.triggered == 1) and STANCE == False and landing == 0 and own['manual'] == 0:
1024
-            if grindold == 0:
1025
-                own['requestAction'] = 'reg_nopos'
1026
-        elif (r_ground.triggered == 1) and STANCE == True and own['manual'] == 0:
1027
-            if grindold == 0:
1028
-                own['requestAction'] = 'fak_nopos'
1029
-        else:        
1030
-            killact(71)
1031
-            killact(72)
1032
-            killact(73)
1033
-            killact(74)         
1034
-        own["last_nOpos"] = True    
1012
+    def noposin():  
1013
+        if ground_since > 30:
1014
+            if (r_ground.triggered == 1) and STANCE == False and own['manual'] == 0:
1015
+                if grindold == 0:
1016
+                    own['requestAction'] = 'reg_nopos'
1017
+            elif (r_ground.triggered == 1) and STANCE == True and own['manual'] == 0:
1018
+                if grindold == 0:
1019
+                    own['requestAction'] = 'fak_nopos'      
1020
+            own["last_nOpos"] = True    
1035 1021
                 
1036 1022
     def aollie():
1037 1023
         print("ollie")

+ 12
- 3
walk.py View File

@@ -77,6 +77,9 @@ cam = scene.objects["Camera.003"]
77 77
 freecam = scene.objects["freecam"]
78 78
 followcam = scene.objects["followcam"]
79 79
 
80
+control_bottom = scene.objects['control_bottom']
81
+cb = control_bottom.sensors['grindCol_bottom']
82
+
80 83
 noidle = 0
81 84
 
82 85
 if skater.isPlayingAction(460):  
@@ -1004,17 +1007,23 @@ def onground():
1004 1007
     if r_ground.positive:
1005 1008
         own['lF_ground_frame'] = own['framenum']
1006 1009
         if 'grind' in r_ground.hitObject:
1007
-            own.applyForce([0,100,0], True)
1008
-            print('moving away from rail')
1010
+            if own['framenum'] - own['last_fall_frame'] < 60:
1011
+                own.applyForce([0,100,0], True)
1012
+                print('moving away from rail')
1009 1013
 
1010 1014
     else:
1011
-        #print('in air')    
1015
+        print('in air')    
1012 1016
         
1013 1017
         if  own['framenum'] - own['lF_ground_frame'] > 10:
1014 1018
             if STANCE == 0:            
1015 1019
                 own['requestAction'] = 'reg_walk_air'
1016 1020
             else:
1017 1021
                 own['requestAction'] = 'fak_walk_air' 
1022
+    #if control bottom is touching ground object, turn ground on            
1023
+    if cb.positive:
1024
+        if own['framenum'] - own['lF_ground_frame'] > 30:
1025
+            own['lF_ground_frame'] = own['framenum']
1026
+                                    
1018 1027
                 
1019 1028
 onboard() 
1020 1029
 jump()

Loading…
Cancel
Save