shuvit 6 years ago
parent
commit
2ce5698ff9
4 changed files with 87 additions and 31 deletions
  1. 40
    18
      co_ActionState.py
  2. 21
    7
      controller2.py
  3. 5
    4
      grindV2.py
  4. 21
    2
      walk.py

+ 40
- 18
co_ActionState.py
File diff suppressed because it is too large
View File


+ 21
- 7
controller2.py View File

1987
         STANCE = own["stance"]
1987
         STANCE = own["stance"]
1988
         jumpstance = own["jump_stance"]
1988
         jumpstance = own["jump_stance"]
1989
         lif = frame - own['last_invert_frame']
1989
         lif = frame - own['last_invert_frame']
1990
+        giniter = 0
1990
         if own['LAST_GRIND'] == False and grindHit == True:
1991
         if own['LAST_GRIND'] == False and grindHit == True:
1991
             own['grindstartFrame'] = own['framenum']
1992
             own['grindstartFrame'] = own['framenum']
1993
+            giniter = 1
1992
         #print(own['grindstartFrame'])    
1994
         #print(own['grindstartFrame'])    
1993
-        if grindHit == True and own['invert_on'] == 0 and own['footplant_on'] == False and own['manual'] == 0 and lif > 40 and own['dropinTimer'] < 30:  
1995
+        if grindHit == True and own['invert_on'] == 0 and own['footplant_on'] == False and own['manual'] == 0 and lif > 40 and own['dropinTimer'] < 30 and giniter == 0: 
1996
+            
1997
+            control_bottom = scene.objects['control_bottom']
1998
+            grindTouch = control_bottom.sensors['grindCol_bottom']
1999
+            edge = 0
2000
+            try:
2001
+                if 'edge' in grindTouch.hitObject:
2002
+                    print('Edge')
2003
+                    edge = 1
2004
+            except:
2005
+                pass               
2006
+             
1994
             gblend = 1    
2007
             gblend = 1    
1995
             if LAST_GRIND == 0:
2008
             if LAST_GRIND == 0:
1996
                 gt = own['grindType']
2009
                 gt = own['grindType']
2043
                 elif own['grindType'] == "fak_tailgL":
2056
                 elif own['grindType'] == "fak_tailgL":
2044
                     own['requestAction'] = 'fak_tailgl' 
2057
                     own['requestAction'] = 'fak_tailgl' 
2045
                 
2058
                 
2046
-                elif own['grindType'] == "reg_tailslide":
2059
+                elif own['grindType'] == "reg_tailslide" and edge == 1:
2047
                     #own['requestAction'] = 'reg_tailslide'
2060
                     #own['requestAction'] = 'reg_tailslide'
2048
                     own['requestAction'] = 'fak_noseslide'  
2061
                     own['requestAction'] = 'fak_noseslide'  
2049
                     own['grind_stance'] = 0                
2062
                     own['grind_stance'] = 0                
2050
                 elif own['grindType'] == "fak_tailslide":
2063
                 elif own['grindType'] == "fak_tailslide":
2051
                     own['requestAction'] = 'fak_tailslide'                
2064
                     own['requestAction'] = 'fak_tailslide'                
2052
                     own['grind_stance'] = 1
2065
                     own['grind_stance'] = 1
2053
-                elif own['grindType'] == "reg_noseslide":
2066
+                elif own['grindType'] == "reg_noseslide" and edge == 1:
2054
                     #own['requestAction'] = 'reg_noseslide'
2067
                     #own['requestAction'] = 'reg_noseslide'
2055
                     own['requestAction'] = 'fak_tailslide'  
2068
                     own['requestAction'] = 'fak_tailslide'  
2056
                     own['grind_stance'] = 0
2069
                     own['grind_stance'] = 0
2097
                     own['requestAction'] = 'fak_tailgl' 
2110
                     own['requestAction'] = 'fak_tailgl' 
2098
                 elif own['grindType'] == "reg_tailslide":
2111
                 elif own['grindType'] == "reg_tailslide":
2099
                     own['requestAction'] = 'reg_tailslide'
2112
                     own['requestAction'] = 'reg_tailslide'
2100
-                elif own['grindType'] == "fak_tailslide":
2113
+                    
2114
+                elif own['grindType'] == "fak_tailslide" and edge == 1:
2101
                     own['grind_stance'] = 1
2115
                     own['grind_stance'] = 1
2102
                     own['requestAction'] = 'reg_noseslide'
2116
                     own['requestAction'] = 'reg_noseslide'
2103
                 elif own['grindType'] == "reg_noseslide":
2117
                 elif own['grindType'] == "reg_noseslide":
2104
                     own['grind_stance'] = 0
2118
                     own['grind_stance'] = 0
2105
                     own['requestAction'] = 'reg_noseslide'
2119
                     own['requestAction'] = 'reg_noseslide'
2106
-                elif own['grindType'] == "fak_noseslide":  
2120
+                elif own['grindType'] == "fak_noseslide" and edge == 1:  
2107
                     own['grind_stance'] = 1              
2121
                     own['grind_stance'] = 1              
2108
                     own['requestAction'] = 'reg_tailslide'                                
2122
                     own['requestAction'] = 'reg_tailslide'                                
2109
                 else:
2123
                 else:
2325
             killact(4)
2339
             killact(4)
2326
             if STANCE == 0:
2340
             if STANCE == 0:
2327
                 own['requestAction'] = 'reg_air_nose' 
2341
                 own['requestAction'] = 'reg_air_nose' 
2328
-                print("reg_air_nose")
2342
+                #print("reg_air_nose")
2329
             else:
2343
             else:
2330
                 own['requestAction'] = 'fak_air_nose' 
2344
                 own['requestAction'] = 'fak_air_nose' 
2331
-                print("fak_air_nose")
2345
+                #print("fak_air_nose")
2332
 
2346
 
2333
     def air_turn_boost():
2347
     def air_turn_boost():
2334
         pass
2348
         pass

+ 5
- 4
grindV2.py View File

227
             #player.applyForce([0, 0, 0], True)            
227
             #player.applyForce([0, 0, 0], True)            
228
             player.setLinearVelocity([velxb, 0.0, zvel], 1)  
228
             player.setLinearVelocity([velxb, 0.0, zvel], 1)  
229
             grindpos = "reg_5050"
229
             grindpos = "reg_5050"
230
-            print("50-1")
230
+            #print("50-1")
231
 
231
 
232
 
232
 
233
         elif rot >= 45 and rot < 90:  
233
         elif rot >= 45 and rot < 90:  
519
                     own.worldPosition = [nearpos.x, nearpos.y, nearpos.z + .2975]
519
                     own.worldPosition = [nearpos.x, nearpos.y, nearpos.z + .2975]
520
                     print('moving world')
520
                     print('moving world')
521
 
521
 
522
-            grindold = True
523
-            own['grindold_timer'] = 0
524
-            own["grindHit"] = True
522
+
525
             #print("grinding")
523
             #print("grinding")
526
             grind_height_dif = (own.worldPosition[2] - nearestObject.worldPosition[2]) - .287
524
             grind_height_dif = (own.worldPosition[2] - nearestObject.worldPosition[2]) - .287
527
             worldPos = own.worldPosition
525
             worldPos = own.worldPosition
529
                 grindvect(nearestObject)          
527
                 grindvect(nearestObject)          
530
                 grindrotvel(nearestObject)
528
                 grindrotvel(nearestObject)
531
                 grind(nearestObject)
529
                 grind(nearestObject)
530
+                grindold = True
531
+                own['grindold_timer'] = 0
532
+                own["grindHit"] = True                
532
 
533
 
533
 
534
 
534
     else:
535
     else:

+ 21
- 2
walk.py View File

930
         wheel4act.visibility = False
930
         wheel4act.visibility = False
931
         act = throw_deck_empty.actuators['throw_dec_act']
931
         act = throw_deck_empty.actuators['throw_dec_act']
932
         if STANCE == True:
932
         if STANCE == True:
933
-            skater.playAction("fak_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
933
+            #skater.playAction("fak_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
934
+            own['requestAction'] = 'fak_throw'
934
             act.linearVelocity = [0.0, 5.0, 5.0]
935
             act.linearVelocity = [0.0, 5.0, 5.0]
935
         if STANCE == False:
936
         if STANCE == False:
936
-            skater.playAction("reg_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)  
937
+            #skater.playAction("reg_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)  
938
+            own['requestAction'] = 'fak_throw'
937
             act.linearVelocity = [0.0, 5.0, -5.0]  
939
             act.linearVelocity = [0.0, 5.0, -5.0]  
938
         cont.activate(act)
940
         cont.activate(act)
939
     else:
941
     else:
1288
     own['walk_idling'] = 0
1290
     own['walk_idling'] = 0
1289
     own["walk_idle_frame"] = 0
1291
     own["walk_idle_frame"] = 0
1290
 
1292
 
1293
+
1294
+if own['requestAction'] == None:
1295
+    if own['throw_deck'] == False:
1296
+        if STANCE == 1:
1297
+            own['requestAction'] = reg_idle
1298
+        else:
1299
+            own['requestAction'] = fak_idle        
1300
+    else:
1301
+        if STANCE == 1:
1302
+            own['requestAction'] = reg_idle_nb
1303
+        else:
1304
+            own['requestAction'] = fak_idle_nb                            
1305
+   
1306
+if deck.visible:
1307
+    own['deckvis'] = 1
1308
+else:
1309
+    own['deckvis'] = 0       
1291
                     
1310
                     
1292
 onboard() 
1311
 onboard() 
1293
 jump()
1312
 jump()

Loading…
Cancel
Save