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

+ 20
- 34
controller2.py View File

312
             playing_frame = skater.getActionFrame(fliplay)
312
             playing_frame = skater.getActionFrame(fliplay)
313
         if r_ground.triggered == True and skater.isPlayingAction(fliplay) and own['jump_timer'] < 40 and playing_frame < 14 and playing_frame > 3:
313
         if r_ground.triggered == True and skater.isPlayingAction(fliplay) and own['jump_timer'] < 40 and playing_frame < 14 and playing_frame > 3:
314
             own['fall'] = 1
314
             own['fall'] = 1
315
+            own['last_fall_frame'] = frame
315
             print("fall: ", playing_frame, own['jump_timer'])
316
             print("fall: ", playing_frame, own['jump_timer'])
316
             if STANCE == 0:
317
             if STANCE == 0:
317
                 #own['requestAction'] = 'reg_fall1'
318
                 #own['requestAction'] = 'reg_fall1'
997
         if linVelocity.x < .05 and linVelocity.x > -.05 and own["lastStop"] == True:
998
         if linVelocity.x < .05 and linVelocity.x > -.05 and own["lastStop"] == True:
998
             own["lastStop"] == False       
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
     def aollie():
1022
     def aollie():
1037
         print("ollie")
1023
         print("ollie")

+ 12
- 3
walk.py View File

77
 freecam = scene.objects["freecam"]
77
 freecam = scene.objects["freecam"]
78
 followcam = scene.objects["followcam"]
78
 followcam = scene.objects["followcam"]
79
 
79
 
80
+control_bottom = scene.objects['control_bottom']
81
+cb = control_bottom.sensors['grindCol_bottom']
82
+
80
 noidle = 0
83
 noidle = 0
81
 
84
 
82
 if skater.isPlayingAction(460):  
85
 if skater.isPlayingAction(460):  
1004
     if r_ground.positive:
1007
     if r_ground.positive:
1005
         own['lF_ground_frame'] = own['framenum']
1008
         own['lF_ground_frame'] = own['framenum']
1006
         if 'grind' in r_ground.hitObject:
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
     else:
1014
     else:
1011
-        #print('in air')    
1015
+        print('in air')    
1012
         
1016
         
1013
         if  own['framenum'] - own['lF_ground_frame'] > 10:
1017
         if  own['framenum'] - own['lF_ground_frame'] > 10:
1014
             if STANCE == 0:            
1018
             if STANCE == 0:            
1015
                 own['requestAction'] = 'reg_walk_air'
1019
                 own['requestAction'] = 'reg_walk_air'
1016
             else:
1020
             else:
1017
                 own['requestAction'] = 'fak_walk_air' 
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
 onboard() 
1028
 onboard() 
1020
 jump()
1029
 jump()

Loading…
Cancel
Save