Browse Source

sunday morn push

shuvit 6 years ago
parent
commit
eb19ff649d
3 changed files with 341 additions and 37 deletions
  1. 62
    6
      co_ActionState.py
  2. 277
    30
      controller2.py
  3. 2
    1
      walk.py

+ 62
- 6
co_ActionState.py
File diff suppressed because it is too large
View File


+ 277
- 30
controller2.py View File

@@ -89,6 +89,7 @@ def main():
89 89
     frame = own['framenum']
90 90
     frames_since_grinding = frame - lgf
91 91
     ground_since = own["framenum"] - own['lF_air_frame']
92
+    gsf = frame - own['grind_start_frame']
92 93
     own['last_footplant'] = own['footplant_on']
93 94
     lastaBut_ground = own['lastaBut_ground'] 
94 95
     lastxBut_ground = own['lastxBut_ground'] 
@@ -288,6 +289,9 @@ def main():
288 289
             deck.stopAction(x)
289 290
             trucks.stopAction(x) 
290 291
 
292
+    def reset_rtimers_done():
293
+        print('rtimer reset:', q1oncd, q2oncd, q3oncd, q4oncd, q5oncd, q6oncd, q7oncd, q8oncd)
294
+
291 295
     def reset_rtimers():
292 296
         own["Q1oncd"] = 0
293 297
         own["Q2oncd"] = 0
@@ -304,7 +308,8 @@ def main():
304 308
         q5oncd = 0
305 309
         q6oncd = 0
306 310
         q7oncd = 0
307
-        q8oncd = 0    
311
+        q8oncd = 0 
312
+        reset_rtimers_done()   
308 313
 
309 314
     def check_fall():
310 315
         playing_frame = 20
@@ -1076,6 +1081,92 @@ def main():
1076 1081
             own['requestAction'] = 'fak_kickflip'
1077 1082
             if own["wallride"] != None: 
1078 1083
                 jump()
1084
+
1085
+
1086
+    def inward_heelflip():
1087
+        print("inward heelflip")
1088
+        dict['trick_string'] = 'Inward Heelflip'
1089
+        STANCE = own["stance"]
1090
+        if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
1091
+            own["wallride_off"] = 1
1092
+            own['requestAction'] = 'reg_inward_heelflip'
1093
+            jump()
1094
+        elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
1095
+            own["wallride_off"] = 1
1096
+            own['requestAction'] = 'fak_inward_heelflip'
1097
+            jump()
1098
+        if r_ground.triggered == 0 and STANCE == False:
1099
+            own["wallride_off"] = 1
1100
+            if own["wallride"] != None: 
1101
+                jump()              
1102
+        elif r_ground.triggered == 0 and STANCE == True:
1103
+            own["wallride_off"] = 1
1104
+            if own["wallride"] != None: 
1105
+                jump()              
1106
+
1107
+    def hardflip():
1108
+        print("hardflip")
1109
+        dict['trick_string'] = 'Hardflip'
1110
+        STANCE = own["stance"]
1111
+        if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
1112
+            own["wallride_off"] = 1
1113
+            own['requestAction'] = 'reg_hardflip'
1114
+            jump()
1115
+        elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
1116
+            own["wallride_off"] = 1
1117
+            own['requestAction'] = 'fak_hardflip'
1118
+            jump()
1119
+        if r_ground.triggered == 0 and STANCE == False:
1120
+            own["wallride_off"] = 1
1121
+            if own["wallride"] != None: 
1122
+                jump()              
1123
+        elif r_ground.triggered == 0 and STANCE == True:
1124
+            own["wallride_off"] = 1
1125
+            if own["wallride"] != None: 
1126
+                jump()
1127
+                
1128
+    def nollie_inward_heelflip():
1129
+        print("nollie inward heelflip")
1130
+        dict['trick_string'] = 'Nollie Inward Heelflip'
1131
+        STANCE = own["stance"]
1132
+        if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
1133
+            own["wallride_off"] = 1
1134
+            own['requestAction'] = 'reg_nollie_inward_heelflip'
1135
+            jump()
1136
+        elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
1137
+            own["wallride_off"] = 1
1138
+            own['requestAction'] = 'fak_nollie_inward_heelflip'
1139
+            jump()
1140
+        if r_ground.triggered == 0 and STANCE == False:
1141
+            own["wallride_off"] = 1
1142
+            if own["wallride"] != None: 
1143
+                jump()              
1144
+        elif r_ground.triggered == 0 and STANCE == True:
1145
+            own["wallride_off"] = 1
1146
+            if own["wallride"] != None: 
1147
+                jump()
1148
+
1149
+    def nollie_hardflip():
1150
+        print("nollie hardflip")
1151
+        dict['trick_string'] = 'Nollie Hardflip'
1152
+        STANCE = own["stance"]
1153
+        if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
1154
+            own["wallride_off"] = 1
1155
+            own['requestAction'] = 'reg_nollie_hardflip'
1156
+            jump()
1157
+        elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
1158
+            own["wallride_off"] = 1
1159
+            own['requestAction'] = 'fak_nollie_hardflip'
1160
+            jump()
1161
+        if r_ground.triggered == 0 and STANCE == False:
1162
+            own["wallride_off"] = 1
1163
+            if own["wallride"] != None: 
1164
+                jump()              
1165
+        elif r_ground.triggered == 0 and STANCE == True:
1166
+            own["wallride_off"] = 1
1167
+            if own["wallride"] != None: 
1168
+                jump()                  
1169
+
1079 1170
                 
1080 1171
     def varial_kickflip():
1081 1172
         print("varial kickflip")
@@ -2979,8 +3070,16 @@ def main():
2979 3070
     if q6oncd > 0 and q5oncd > 0 and q8oncd > 0 and q6oncd <= q5oncd <= q8oncd:
2980 3071
         print ("Hardflip")
2981 3072
         dict['trick_string'] = 'Hardflip'
2982
-        aollie()
2983
-        reset_rtimers()    
3073
+        hardflip()
3074
+        reset_rtimers() 
3075
+        q1oncd = 0
3076
+        q2oncd = 0
3077
+        q3oncd = 0
3078
+        q4oncd = 0
3079
+        q5oncd = 0
3080
+        q6oncd = 0
3081
+        q7oncd = 0
3082
+        q8oncd = 0            
2984 3083
 
2985 3084
     # inward heelflip
2986 3085
     # 4 > 5 > 2
@@ -2988,27 +3087,48 @@ def main():
2988 3087
     if q4oncd > 0 and q5oncd > 0 and q2oncd > 0 and q4oncd <= q5oncd <= q2oncd:
2989 3088
         print ("Inward Heelflip")
2990 3089
         dict['trick_string'] = 'Inward Heelflip'
2991
-        aollie()
3090
+        inward_heelflip()
2992 3091
         reset_rtimers()     
2993
-
3092
+        q1oncd = 0
3093
+        q2oncd = 0
3094
+        q3oncd = 0
3095
+        q4oncd = 0
3096
+        q5oncd = 0
3097
+        q6oncd = 0
3098
+        q7oncd = 0
3099
+        q8oncd = 0 
2994 3100
     # nollie hard flip
2995 3101
     # 8 > 1 > 6
2996 3102
 
2997 3103
     if q8oncd > 0 and q1oncd > 0 and q6oncd > 0 and q8oncd <= q1oncd <= q6oncd:
2998 3104
         print ("Nollie Hardflip")
2999 3105
         dict['trick_string'] = 'Nollie Hardflip'
3000
-        aollie()
3106
+        nollie_hardflip()
3001 3107
         reset_rtimers()
3002
-
3108
+        q1oncd = 0
3109
+        q2oncd = 0
3110
+        q3oncd = 0
3111
+        q4oncd = 0
3112
+        q5oncd = 0
3113
+        q6oncd = 0
3114
+        q7oncd = 0
3115
+        q8oncd = 0 
3003 3116
     # nollie inward heelflip
3004 3117
     # 2 > 1 > 4
3005 3118
 
3006 3119
     if q2oncd > 0 and q1oncd > 0 and q4oncd > 0 and q2oncd <= q1oncd <= q4oncd:
3007 3120
         print ("Nollie Inward Heelflip")
3008 3121
         dict['trick_string'] = 'Nollie Inward Heelflip'
3009
-        aollie()
3122
+        nollie_inward_heelflip()
3010 3123
         reset_rtimers()    
3011
-
3124
+        q1oncd = 0
3125
+        q2oncd = 0
3126
+        q3oncd = 0
3127
+        q4oncd = 0
3128
+        q5oncd = 0
3129
+        q6oncd = 0
3130
+        q7oncd = 0
3131
+        q8oncd = 0 
3012 3132
     # 360 flip
3013 3133
     # 3 > 4 > 5 > 8
3014 3134
 
@@ -3021,7 +3141,14 @@ def main():
3021 3141
         dict['trick_string'] = 'Nollie 360 shuvit'
3022 3142
         nollie_shuvit360()
3023 3143
         reset_rtimers()
3024
-
3144
+        q1oncd = 0
3145
+        q2oncd = 0
3146
+        q3oncd = 0
3147
+        q4oncd = 0
3148
+        q5oncd = 0
3149
+        q6oncd = 0
3150
+        q7oncd = 0
3151
+        q8oncd = 0 
3025 3152
     #nollie fs 360 shuvit
3026 3153
     if q7oncd > 0 and q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q3oncd > 0 and q3oncd <= q2oncd <= q1oncd <= q8oncd <= q7oncd:
3027 3154
         #print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
@@ -3029,21 +3156,42 @@ def main():
3029 3156
         dict['trick_string'] = 'Nollie FS 360 shuvit'
3030 3157
         nollie_fsshuvit360()
3031 3158
         reset_rtimers()   
3032
-
3159
+        q1oncd = 0
3160
+        q2oncd = 0
3161
+        q3oncd = 0
3162
+        q4oncd = 0
3163
+        q5oncd = 0
3164
+        q6oncd = 0
3165
+        q7oncd = 0
3166
+        q8oncd = 0 
3033 3167
     # varial heelflip
3034 3168
     # 7 < 6 < 2
3035 3169
     if q7oncd > 0 and q6oncd > 0 and q2oncd > 0 and q7oncd < q6oncd < q2oncd:
3036 3170
         dict['trick_string'] = 'Varial Heelflip'
3037 3171
         varial_heelflip()
3038 3172
         reset_rtimers()
3039
-        
3173
+        q1oncd = 0
3174
+        q2oncd = 0
3175
+        q3oncd = 0
3176
+        q4oncd = 0
3177
+        q5oncd = 0
3178
+        q6oncd = 0
3179
+        q7oncd = 0
3180
+        q8oncd = 0         
3040 3181
     # varial kickflip 
3041 3182
     # 3 < 4 < 8
3042 3183
     if q3oncd > 0 and q4oncd > 0 and q8oncd > 0 and q3oncd < q4oncd < q8oncd:
3043 3184
         dict['trick_string'] = 'Varial Kickflip'
3044 3185
         varial_kickflip()
3045 3186
         reset_rtimers()
3046
-
3187
+        q1oncd = 0
3188
+        q2oncd = 0
3189
+        q3oncd = 0
3190
+        q4oncd = 0
3191
+        q5oncd = 0
3192
+        q6oncd = 0
3193
+        q7oncd = 0
3194
+        q8oncd = 0 
3047 3195
     # nollie varial kickflip
3048 3196
     # 3 < 2 < 6
3049 3197
     if q3oncd > 0 and q2oncd > 0 and q6oncd > 0 and q3oncd <= q2oncd <= q6oncd:
@@ -3051,7 +3199,14 @@ def main():
3051 3199
         print('Nollie Varial Kickflip')
3052 3200
         nollie_varial_kickflip()
3053 3201
         reset_rtimers()   
3054
-        
3202
+        q1oncd = 0
3203
+        q2oncd = 0
3204
+        q3oncd = 0
3205
+        q4oncd = 0
3206
+        q5oncd = 0
3207
+        q6oncd = 0
3208
+        q7oncd = 0
3209
+        q8oncd = 0         
3055 3210
     # nollie varial heelflip
3056 3211
     # 7 < 8 < 4
3057 3212
     if q7oncd > 0 and q8oncd > 0 and q4oncd > 0 and q7oncd <= q8oncd <= q4oncd:
@@ -3059,7 +3214,14 @@ def main():
3059 3214
         print('Nollie Varial Heelflip')
3060 3215
         nollie_varial_heelflip()
3061 3216
         reset_rtimers()   
3062
-
3217
+        q1oncd = 0
3218
+        q2oncd = 0
3219
+        q3oncd = 0
3220
+        q4oncd = 0
3221
+        q5oncd = 0
3222
+        q6oncd = 0
3223
+        q7oncd = 0
3224
+        q8oncd = 0 
3063 3225
     #360 shuvit
3064 3226
     if q3oncd > 0 and q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q7oncd > 0 and q7oncd >= q6oncd >= q5oncd >= q4oncd >= q3oncd:
3065 3227
     #    print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
@@ -3067,12 +3229,27 @@ def main():
3067 3229
         dict['trick_string'] = '360 shuvit'
3068 3230
         shuvit360()
3069 3231
         reset_rtimers()
3232
+        q1oncd = 0
3233
+        q2oncd = 0
3234
+        q3oncd = 0
3235
+        q4oncd = 0
3236
+        q5oncd = 0
3237
+        q6oncd = 0
3238
+        q7oncd = 0
3239
+        q8oncd = 0         
3070 3240
     #360 fs shuvit    
3071 3241
     if q3oncd > 0 and q4oncd > 0 and q5oncd > 0 and q6oncd >= 0 and q7oncd > 0 and q7oncd <= q6oncd <= q5oncd <= q4oncd <= q3oncd:
3072 3242
         dict['trick_string'] = '360 Frontside shuvit'
3073 3243
         fsshuvit360()
3074 3244
         reset_rtimers()    
3075
-
3245
+        q1oncd = 0
3246
+        q2oncd = 0
3247
+        q3oncd = 0
3248
+        q4oncd = 0
3249
+        q5oncd = 0
3250
+        q6oncd = 0
3251
+        q7oncd = 0
3252
+        q8oncd = 0 
3076 3253
     #ollie
3077 3254
     if q5oncd > 0 and q1oncd > 0 and q5oncd < q1oncd:
3078 3255
         JUMPSTRENGTH = q1oncd - q5oncd
@@ -3085,7 +3262,14 @@ def main():
3085 3262
            JUMPSTRENGTH = .9               
3086 3263
         aollie()
3087 3264
         reset_rtimers()
3088
-        
3265
+        q1oncd = 0
3266
+        q2oncd = 0
3267
+        q3oncd = 0
3268
+        q4oncd = 0
3269
+        q5oncd = 0
3270
+        q6oncd = 0
3271
+        q7oncd = 0
3272
+        q8oncd = 0         
3089 3273
     #nollie
3090 3274
     if q5oncd > 0 and q1oncd > 0 and q5oncd > q1oncd:
3091 3275
         JUMPSTRENGTH = q5oncd - q1oncd
@@ -3099,51 +3283,114 @@ def main():
3099 3283
         nollie()
3100 3284
         reset_rtimers()
3101 3285
         print("nollie")
3102
-
3286
+        q1oncd = 0
3287
+        q2oncd = 0
3288
+        q3oncd = 0
3289
+        q4oncd = 0
3290
+        q5oncd = 0
3291
+        q6oncd = 0
3292
+        q7oncd = 0
3293
+        q8oncd = 0 
3103 3294
     #kickflip
3104 3295
     if q5oncd > 0 and q8oncd > 0 and q5oncd < q8oncd and q3oncd < 1:
3105 3296
         kickflip()
3106 3297
         reset_rtimers()
3107
-        
3298
+        q1oncd = 0
3299
+        q2oncd = 0
3300
+        q3oncd = 0
3301
+        q4oncd = 0
3302
+        q5oncd = 0
3303
+        q6oncd = 0
3304
+        q7oncd = 0
3305
+        q8oncd = 0         
3108 3306
     #nollie kickflip
3109 3307
     if q1oncd > 0 and q6oncd > 0 and q1oncd < q6oncd:
3110 3308
         nollie_kickflip()
3111 3309
         reset_rtimers()  
3112
-
3310
+        q1oncd = 0
3311
+        q2oncd = 0
3312
+        q3oncd = 0
3313
+        q4oncd = 0
3314
+        q5oncd = 0
3315
+        q6oncd = 0
3316
+        q7oncd = 0
3317
+        q8oncd = 0 
3113 3318
     #heelflip
3114 3319
     if q5oncd > 0 and q2oncd > 0 and q5oncd < q2oncd:
3115 3320
         heelflip()
3116 3321
         reset_rtimers()
3117
-        
3322
+        q1oncd = 0
3323
+        q2oncd = 0
3324
+        q3oncd = 0
3325
+        q4oncd = 0
3326
+        q5oncd = 0
3327
+        q6oncd = 0
3328
+        q7oncd = 0
3329
+        q8oncd = 0         
3118 3330
     #nollie_heelflip
3119 3331
     if q1oncd > 0 and q4oncd > 0 and q1oncd < q4oncd:
3120 3332
         nollie_heelflip()
3121 3333
         reset_rtimers()
3122
-           
3334
+        q1oncd = 0
3335
+        q2oncd = 0
3336
+        q3oncd = 0
3337
+        q4oncd = 0
3338
+        q5oncd = 0
3339
+        q6oncd = 0
3340
+        q7oncd = 0
3341
+        q8oncd = 0            
3123 3342
 
3124 3343
     #shuvit
3125 3344
     if q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q4oncd <= q5oncd <= q6oncd and q3oncd < 1:
3126
-       shuvit()
3127
-       reset_rtimers()
3128
-        
3345
+        shuvit()
3346
+        reset_rtimers()
3347
+        q1oncd = 0
3348
+        q2oncd = 0
3349
+        q3oncd = 0
3350
+        q4oncd = 0
3351
+        q5oncd = 0
3352
+        q6oncd = 0
3353
+        q7oncd = 0
3354
+        q8oncd = 0         
3129 3355
     #nollie_shuvit
3130 3356
     if q2oncd > 0 and q1oncd > 0 and q8oncd > 0 and q2oncd <= q1oncd <= q8oncd and q3oncd == 0:
3131 3357
         nollie_shuvit()
3132 3358
         print('nollie shuvit')
3133 3359
         #nollie_fsshuvit()
3134 3360
         reset_rtimers()   
3135
-        
3361
+        q1oncd = 0
3362
+        q2oncd = 0
3363
+        q3oncd = 0
3364
+        q4oncd = 0
3365
+        q5oncd = 0
3366
+        q6oncd = 0
3367
+        q7oncd = 0
3368
+        q8oncd = 0         
3136 3369
     #fsshuvit
3137 3370
     if q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q6oncd <= q5oncd <= q4oncd and q7oncd < 1:
3138 3371
         fsshuvit()
3139 3372
         reset_rtimers()
3140
-        
3373
+        q1oncd = 0
3374
+        q2oncd = 0
3375
+        q3oncd = 0
3376
+        q4oncd = 0
3377
+        q5oncd = 0
3378
+        q6oncd = 0
3379
+        q7oncd = 0
3380
+        q8oncd = 0         
3141 3381
     #nollie_fsshuvit
3142 3382
     if q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q8oncd <= q1oncd <= q2oncd and q7oncd == 0:
3143 3383
         print ("nollie fsshuvit")
3144 3384
         nollie_fsshuvit()
3145 3385
         reset_rtimers()
3146
-
3386
+        q1oncd = 0
3387
+        q2oncd = 0
3388
+        q3oncd = 0
3389
+        q4oncd = 0
3390
+        q5oncd = 0
3391
+        q6oncd = 0
3392
+        q7oncd = 0
3393
+        q8oncd = 0 
3147 3394
     #360 shuvit
3148 3395
 
3149 3396
     # 360 shuvit
@@ -3325,7 +3572,7 @@ def main():
3325 3572
         lF_air_frame = own['lF_air_frame']
3326 3573
         frames_since_ground = framenum - lF_air_frame
3327 3574
         frames_since_grind = framenum - own['last_grind_frame']
3328
-        if grindHit == True and aBut == True:
3575
+        if grindHit == True and aBut == True and ground_since < 10:
3329 3576
             own.linearVelocity.x = 0
3330 3577
             own.linearVelocity.y = 0                         
3331 3578
             own['footplant_on'] = 1
@@ -3342,7 +3589,7 @@ def main():
3342 3589
                     own['requestAction'] = 'fak_fp_rback'
3343 3590
                
3344 3591
     def invert():    
3345
-        if grindHit == True and own['grindpos'] == 'reg_board':   
3592
+        if grindHit == True and own['grindpos'] == 'reg_board' and gsf < 10:   
3346 3593
             if lBump == 1:   
3347 3594
                 own['invert_on'] = 1
3348 3595
                 own.linearVelocity.x = 0

+ 2
- 1
walk.py View File

@@ -1075,7 +1075,8 @@ def onground():
1075 1075
                 own['requestAction'] = 'fak_walk_air' 
1076 1076
     #if control bottom is touching ground object, turn ground on            
1077 1077
     if cb.positive:
1078
-        if own['framenum'] - own['lF_ground_frame'] > 30:
1078
+        #if own['framenum'] - own['lF_ground_frame'] > 30:
1079
+        if own['framenum'] - own['last_fall_frame'] < 90:
1079 1080
             own['lF_ground_frame'] = own['framenum']
1080 1081
                                     
1081 1082
                 

Loading…
Cancel
Save