Browse Source

after the freeze

shuvit 6 years ago
parent
commit
6a9d152a0f
7 changed files with 224 additions and 86 deletions
  1. 7
    2
      Settings.py
  2. 3
    1
      Startup.py
  3. 31
    16
      co_ActionState.py
  4. 13
    6
      controller2.py
  5. 56
    46
      inputs.py
  6. 46
    2
      menuV3.py
  7. 68
    13
      walk.py

+ 7
- 2
Settings.py View File

80
     dict['shadow_on'] = int(data[48])
80
     dict['shadow_on'] = int(data[48])
81
     dict['ambient_strength'] = float(data[49]) 
81
     dict['ambient_strength'] = float(data[49]) 
82
     dict['fullscreen_on'] = int(data[51]) 
82
     dict['fullscreen_on'] = int(data[51]) 
83
-    dict['bloom_on'] = int(data[53])        
83
+    dict['bloom_on'] = int(data[53]) 
84
+    dict['cam_height'] = float(data[55]) 
85
+    dict['focal_length'] = int(data[56])        
84
     
86
     
85
     
87
     
86
     
88
     
151
         writing.write(str("//fullscreen on (0,1)")+"\n")
153
         writing.write(str("//fullscreen on (0,1)")+"\n")
152
         writing.write(str(dict["fullscreen_on"])+"\n") 
154
         writing.write(str(dict["fullscreen_on"])+"\n") 
153
         writing.write(str("//bloom on (0,1)")+"\n")
155
         writing.write(str("//bloom on (0,1)")+"\n")
154
-        writing.write(str(dict["bloom_on"])+"\n")         
156
+        writing.write(str(dict["bloom_on"])+"\n")  
157
+        writing.write(str("//cam")+"\n")
158
+        writing.write(str(dict["cam_height"])+"\n") 
159
+        writing.write(str(dict["focal_length"])+"\n")                 
155
         
160
         
156
         
161
         
157
         
162
         

+ 3
- 1
Startup.py View File

90
     dict['kb_la'] = 0
90
     dict['kb_la'] = 0
91
     dict['kb_ra'] = 0
91
     dict['kb_ra'] = 0
92
     dict['kb_ua'] = 0
92
     dict['kb_ua'] = 0
93
-    dict['kb_da'] = 0    
93
+    dict['kb_da'] = 0 
94
+    dict['kb_lsh'] = 0
95
+    dict['kb_space'] = 0    
94
     
96
     
95
     dict['aBut'] = 0.0
97
     dict['aBut'] = 0.0
96
     dict['bBut'] = 0.0
98
     dict['bBut'] = 0.0

+ 31
- 16
co_ActionState.py View File

67
         own['requestAction'] = 'empty'              
67
         own['requestAction'] = 'empty'              
68
 #================
68
 #================
69
     #stance change detection
69
     #stance change detection
70
-    if (requestAction == 'reg_roll' and l_actionState in ('fak_roll', 'fak_land', 'fak_pump_out', 'fak_nopos_out', 'fak_opos_out')) or l_actionState == 'fak_land' and (requestAction == 'reg_turnLeft' or requestAction == 'reg_turnRight' or requestAction == 'reg_turnLeft_out' or requestAction == 'reg_turnRight_out' or requestAction == 'reg_opos' or requestAction == 'reg_nopos' or requestAction == 'reg_pump' or requestAction == 'reg_push' or requestAction == 'reg_push_goof' or requestAction == 'fak_5050-roll') and requestAction not in ['reg_push', 'reg_push_goof', 'fak_push', 'fak_push_goof'] or (requestAction in ('reg_turnLeft', 'reg_turnRight') and l_actionState in ('fak_turnLeft', 'fak_turnRight')):
70
+    if (requestAction == 'reg_roll' and l_actionState in ('fak_roll', 'fak_land', 'fak_pump_out', 'fak_nopos_out', 'fak_opos_out', 'fak_air-roll')) or l_actionState == 'fak_land' and (requestAction == 'reg_turnLeft' or requestAction == 'reg_turnRight' or requestAction == 'reg_turnLeft_out' or requestAction == 'reg_turnRight_out' or requestAction == 'reg_opos' or requestAction == 'reg_nopos' or requestAction == 'reg_pump' or requestAction == 'reg_push' or requestAction == 'reg_push_goof' or requestAction == 'fak_5050-roll') and requestAction not in ['reg_push', 'reg_push_goof', 'fak_push', 'fak_push_goof'] or (requestAction in ('reg_turnLeft', 'reg_turnRight') and l_actionState in ('fak_turnLeft', 'fak_turnRight')):
71
         #print("fak-reg_roll")
71
         #print("fak-reg_roll")
72
         requestAction = 'fak-reg_roll'
72
         requestAction = 'fak-reg_roll'
73
         own['requestAction'] = 'fak-reg_roll' 
73
         own['requestAction'] = 'fak-reg_roll' 
74
-    if (requestAction == 'fak_roll' and l_actionState in ('reg_roll', 'reg_land', 'reg_pump_out', 'reg_nopos_out', 'reg_opos_out')) or l_actionState == 'reg_land' and (requestAction == 'fak_turnLeft' or requestAction == 'fak_turnRight' or requestAction == 'fak_turnLeft_out' or requestAction == 'fak_turnRight_out' or requestAction == 'fak_opos' or requestAction == 'fak_nopos' or requestAction == 'fak_pump' or requestAction == 'fak_push' or requestAction == 'reg_push_goof' or requestAction == 'reg_5050-roll') and requestAction not in ['reg_push', 'reg_push_goof', 'fak_push', 'fak_push_goof'] or (requestAction in ('fak_turnLeft', 'fak_turnRight') and l_actionState in ('reg_turnLeft', 'reg_turnRight')):
74
+    if (requestAction == 'fak_roll' and l_actionState in ('reg_roll', 'reg_land', 'reg_pump_out', 'reg_nopos_out', 'reg_opos_out', 'reg_air-roll')) or l_actionState == 'reg_land' and (requestAction == 'fak_turnLeft' or requestAction == 'fak_turnRight' or requestAction == 'fak_turnLeft_out' or requestAction == 'fak_turnRight_out' or requestAction == 'fak_opos' or requestAction == 'fak_nopos' or requestAction == 'fak_pump' or requestAction == 'fak_push' or requestAction == 'reg_push_goof' or requestAction == 'reg_5050-roll') and requestAction not in ['reg_push', 'reg_push_goof', 'fak_push', 'fak_push_goof'] or (requestAction in ('fak_turnLeft', 'fak_turnRight') and l_actionState in ('reg_turnLeft', 'reg_turnRight')):
75
         #print("reg-fak_roll")
75
         #print("reg-fak_roll")
76
         requestAction = 'reg-fak_roll'
76
         requestAction = 'reg-fak_roll'
77
         own['requestAction'] = 'reg-fak_roll'
77
         own['requestAction'] = 'reg-fak_roll'
112
             actionState = requestAction
112
             actionState = requestAction
113
             own['actionTimer'] = 0
113
             own['actionTimer'] = 0
114
             actionTimer = 0 
114
             actionTimer = 0 
115
+            
116
+    if requestAction == 'reg_land' and l_actionState == 'reg_back_invert_out' and actionTimer > 0:
117
+        requestAction = 'reg_back_invert_out' 
118
+    if requestAction == 'fak_land' and l_actionState == 'fak_fr_invert_out' and actionTimer > 0:
119
+        requestAction = 'fak_fr_invert_out'                
120
+        
115
     #print(own['manual_v2_timer'], 'man_timer###@!')                   
121
     #print(own['manual_v2_timer'], 'man_timer###@!')                   
116
 #    if (own['l_requestAction'] == 'reg_air_nose' or own['l_requestAction'] == 'reg_air_tail' or own['l_requestAction'] == 'fak_air_nose' or own['l_requestAction'] == 'fak_air_tail') and (requestAction == 'reg_land' or requestAction == 'fak_land') and own['manual_v2_timer'] > 2:
122
 #    if (own['l_requestAction'] == 'reg_air_nose' or own['l_requestAction'] == 'reg_air_tail' or own['l_requestAction'] == 'fak_air_nose' or own['l_requestAction'] == 'fak_air_tail') and (requestAction == 'reg_land' or requestAction == 'fak_land') and own['manual_v2_timer'] > 2:
117
 #    #if (requestAction == 'reg_land' or requestAction == 'fak_land') and own['manual_v2_timer'] > 2:
123
 #    #if (requestAction == 'reg_land' or requestAction == 'fak_land') and own['manual_v2_timer'] > 2:
563
             requestAction = 'reg-fak_roll'             
569
             requestAction = 'reg-fak_roll'             
564
                                              
570
                                              
565
                                              
571
                                              
566
-        if l_actionState in ('reg_noseslide_out', 'regtailslide_out') and requestAction == ' fak_roll':
567
-            requestAction = 'reg-fak_roll'
568
-        if l_actionState in ('fak_noseslide_out', 'faktailslide_out') and requestAction == ' reg_roll':
569
-            requestAction = 'fak-reg_roll'     
572
+#        if l_actionState in ('reg_noseslide_out', 'reg_tailslide_out', 'reg_air-roll') and requestAction == 'fak_roll':
573
+#            requestAction = 'reg-fak_roll'
574
+#            print('this is new ______________________')
575
+#        if l_actionState in ('fak_noseslide_out', 'fak_tailslide_out', 'fak_air-roll') and requestAction == 'reg_roll':
576
+#            requestAction = 'fak-reg_roll'
577
+#            print('this is new ______________________')   
578
+            
579
+        if l_actionState == 'reg_back_invert_out' and requestAction == 'fak_roll' and actionTimer < 1:
580
+            requestAction = 'reg_air-roll'              
581
+            
582
+            
570
             
583
             
571
             
584
             
572
 #        if (l_actionState == 'fak_air-roll' and requestAction == 'fak_manual'):
585
 #        if (l_actionState == 'fak_air-roll' and requestAction == 'fak_manual'):
1635
             #reg_jump
1648
             #reg_jump
1636
             if requestAction == 'reg_jump':
1649
             if requestAction == 'reg_jump':
1637
                 actionState = 'reg_jump'
1650
                 actionState = 'reg_jump'
1638
-                own['actionTimer'] = 9                
1651
+                own['actionTimer'] = 19                
1639
                 skater.playAction("reg_jump", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1652
                 skater.playAction("reg_jump", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1640
                 deck.playAction("a_reg_jump2", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1653
                 deck.playAction("a_reg_jump2", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1641
                 trucks.playAction("a_reg_jump2", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1654
                 trucks.playAction("a_reg_jump2", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1643
             #fak_jump    
1656
             #fak_jump    
1644
             if requestAction == 'fak_jump':
1657
             if requestAction == 'fak_jump':
1645
                 actionState = 'fak_jump'
1658
                 actionState = 'fak_jump'
1646
-                own['actionTimer'] = 9                
1659
+                own['actionTimer'] = 19                
1647
                 skater.playAction("fak_jump", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1660
                 skater.playAction("fak_jump", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1648
                 trucks.playAction("a_fak_jump", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1661
                 trucks.playAction("a_fak_jump", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1649
                 deck.playAction("a_fak_jump", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1662
                 deck.playAction("a_fak_jump", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1806
                 trucks.playAction("a_reg", 30,40, layer=trans_layer, play_mode=0, speed=.5) 
1819
                 trucks.playAction("a_reg", 30,40, layer=trans_layer, play_mode=0, speed=.5) 
1807
                      
1820
                      
1808
             if requestAction == 'reg_back_invert_out':
1821
             if requestAction == 'reg_back_invert_out':
1809
-                own['actionTimer'] = 60
1822
+                own['actionTimer'] = 30
1810
                 actionState = 'reg_back_invert_out'
1823
                 actionState = 'reg_back_invert_out'
1811
                 skater.playAction("reg_back_invert_in", 30,1, layer=trans_layer, play_mode=0, speed=1)
1824
                 skater.playAction("reg_back_invert_in", 30,1, layer=trans_layer, play_mode=0, speed=1)
1812
                 deck.playAction("a_reg_back_invert_in", 30,1, layer=trans_layer, play_mode=0, speed=1)
1825
                 deck.playAction("a_reg_back_invert_in", 30,1, layer=trans_layer, play_mode=0, speed=1)
1813
                 trucks.playAction("a_reg_back_invert_in", 30,1, layer=trans_layer, play_mode=0, speed=1)            
1826
                 trucks.playAction("a_reg_back_invert_in", 30,1, layer=trans_layer, play_mode=0, speed=1)            
1814
             if requestAction == 'fak_fr_invert_out':  
1827
             if requestAction == 'fak_fr_invert_out':  
1815
-                own['actionTimer'] = 60
1828
+                own['actionTimer'] = 30
1816
                 actionState = 'fak_fr_invert_out'
1829
                 actionState = 'fak_fr_invert_out'
1817
                 skater.playAction("fak_fr_invert", 30,1, layer=trans_layer, play_mode=0, speed=1)
1830
                 skater.playAction("fak_fr_invert", 30,1, layer=trans_layer, play_mode=0, speed=1)
1818
                 deck.playAction("a_fak_fr_invert", 30,1, layer=trans_layer, play_mode=0, speed=1)
1831
                 deck.playAction("a_fak_fr_invert", 30,1, layer=trans_layer, play_mode=0, speed=1)
2853
             if requestAction == 'reg_judo':
2866
             if requestAction == 'reg_judo':
2854
                 actionState = 'reg_judo'
2867
                 actionState = 'reg_judo'
2855
                 if l_actionState != 'reg_judo':
2868
                 if l_actionState != 'reg_judo':
2856
-                    skater.playAction("reg_judo", 1,10, layer=trans_layer, play_mode=0, speed=1)
2857
-                    deck.playAction("a_reg", 1,10, layer=trans_layer, play_mode=0, speed=1)
2858
-                    trucks.playAction("a_reg", 1,10, layer=trans_layer, play_mode=0, speed=1)    
2869
+                    skater.playAction("reg_judo", 1,10, layer=trans_layer, play_mode=0, speed=.5)
2870
+                    deck.playAction("a_reg", 1,10, layer=trans_layer, play_mode=0, speed=.5)
2871
+                    trucks.playAction("a_reg", 1,10, layer=trans_layer, play_mode=0, speed=.5)    
2859
                 else:
2872
                 else:
2860
                     skater.playAction("reg_judo", 10,30, layer=loop_layer, play_mode=1, speed=1)
2873
                     skater.playAction("reg_judo", 10,30, layer=loop_layer, play_mode=1, speed=1)
2861
                     deck.playAction("a_reg", 10,30, layer=loop_layer, play_mode=1, speed=1)
2874
                     deck.playAction("a_reg", 10,30, layer=loop_layer, play_mode=1, speed=1)
2863
             if requestAction == 'fak_judo':
2876
             if requestAction == 'fak_judo':
2864
                 actionState = 'fak_judo'
2877
                 actionState = 'fak_judo'
2865
                 if l_actionState != 'fak_judo':
2878
                 if l_actionState != 'fak_judo':
2866
-                    skater.playAction("fak_judo", 1,10, layer=trans_layer, play_mode=0, speed=1)
2867
-                    deck.playAction("a_reg", 1,10, layer=trans_layer, play_mode=0, speed=1)
2868
-                    trucks.playAction("a_reg", 1,10, layer=trans_layer, play_mode=0, speed=1)    
2879
+                    skater.playAction("fak_judo", 1,10, layer=trans_layer, play_mode=0, speed=.5)
2880
+                    deck.playAction("a_reg", 1,10, layer=trans_layer, play_mode=0, speed=.5)
2881
+                    trucks.playAction("a_reg", 1,10, layer=trans_layer, play_mode=0, speed=.5)    
2869
                 else:
2882
                 else:
2870
                     skater.playAction("fak_judo", 10,30, layer=loop_layer, play_mode=1, speed=1)
2883
                     skater.playAction("fak_judo", 10,30, layer=loop_layer, play_mode=1, speed=1)
2871
                     deck.playAction("a_reg", 10,30, layer=loop_layer, play_mode=1, speed=1)
2884
                     deck.playAction("a_reg", 10,30, layer=loop_layer, play_mode=1, speed=1)
3745
 #        own['actionTimer'] = 0
3758
 #        own['actionTimer'] = 0
3746
                   
3759
                   
3747
     if (own['actionTimer'] == 0 or requestAction == 'reg_land' or requestAction == 'fak_land') or requestAction in jump_overrideList:
3760
     if (own['actionTimer'] == 0 or requestAction == 'reg_land' or requestAction == 'fak_land') or requestAction in jump_overrideList:
3761
+        
3748
         actionState = updateAction(requestAction, actionState)
3762
         actionState = updateAction(requestAction, actionState)
3749
         
3763
         
3750
 #    if (own['actionState'] == 'reg_land' or own['actionState'] == 'reg_land') and own['actionTimer'] > 0:
3764
 #    if (own['actionState'] == 'reg_land' or own['actionState'] == 'reg_land') and own['actionTimer'] > 0:
3760
         cur_frame = skater.getActionFrame(trans_layer)  
3774
         cur_frame = skater.getActionFrame(trans_layer)  
3761
         cur_frame = round(cur_frame, 2)     
3775
         cur_frame = round(cur_frame, 2)     
3762
     #print("oG: ", og_request, "rA:", requestAction, "|aS:", own['actionState'], "q", queueAction, own['actionTimer'], 'cf', cur_frame)
3776
     #print("oG: ", og_request, "rA:", requestAction, "|aS:", own['actionState'], "q", queueAction, own['actionTimer'], 'cf', cur_frame)
3777
+    print("rA:", requestAction, "|aS:", own['actionState'], own['actionTimer'], 'cf', cur_frame)
3763
     cur_frame = skater.getActionFrame(trans_layer)
3778
     cur_frame = skater.getActionFrame(trans_layer)
3764
     #print(cur_frame)
3779
     #print(cur_frame)
3765
     def printplaying():
3780
     def printplaying():

+ 13
- 6
controller2.py View File

4123
     def wallhit():
4123
     def wallhit():
4124
         linvelx = linVelocity.x
4124
         linvelx = linVelocity.x
4125
         lastx = own["linvelx"]
4125
         lastx = own["linvelx"]
4126
-        if frames_since_ground > 20 and (abs(lastx) - abs(linvelx)) > .5:
4127
-            #print('::::::wallhit')
4128
-            force = (linVelocity.x * -.7, linVelocity.y, linVelocity.z )                    
4126
+        wallsens = cont.sensors['wall']
4127
+        #print(wallsens.positive, 'wallsens')
4128
+        if frames_since_ground > 20 and (abs(lastx) - abs(linvelx)) > .5 and wallsens.positive:
4129
+            print('::::::wallhit')
4130
+            velx = linVelocity.x * -1.5
4131
+            if velx > 0 and velx < 1:
4132
+                velx = 1
4133
+            if velx < 0 and velx > -1:
4134
+                velx = -1    
4135
+            force = (velx, linVelocity.y, linVelocity.z )                    
4129
             own.setLinearVelocity(force, True)        
4136
             own.setLinearVelocity(force, True)        
4130
     
4137
     
4131
     def land_boost():
4138
     def land_boost():
4132
         linvelx = linVelocity.x
4139
         linvelx = linVelocity.x
4133
         lastx = own["linvelx"]
4140
         lastx = own["linvelx"]
4134
-        if frames_since_ground < 2 and (abs(lastx) - abs(linvelx)) > .5:
4135
-            #print('**_____________land boost')
4141
+        if frames_since_ground < 10 and (abs(lastx) - abs(linvelx)) > .5:
4142
+            print('**_____________land boost')
4136
             force = (lastx, linVelocity.y, linVelocity.z )                    
4143
             force = (lastx, linVelocity.y, linVelocity.z )                    
4137
             own.setLinearVelocity(force, True)             
4144
             own.setLinearVelocity(force, True)             
4138
         
4145
         
4157
     air_mover()
4164
     air_mover()
4158
     dropinRotate()    
4165
     dropinRotate()    
4159
     onboard()   
4166
     onboard()   
4160
-    #wallhit() 
4167
+    wallhit() 
4161
     linvelx = own.getLinearVelocity(True)
4168
     linvelx = own.getLinearVelocity(True)
4162
     land_boost()
4169
     land_boost()
4163
     own["linvelx"] = linvelx.x
4170
     own["linvelx"] = linvelx.x

+ 56
- 46
inputs.py View File

22
     
22
     
23
     joy_con = dict['joy_con']  
23
     joy_con = dict['joy_con']  
24
     scenes = bge.logic.getSceneList()
24
     scenes = bge.logic.getSceneList()
25
-    
25
+        
26
 #hard controller mappings    
26
 #hard controller mappings    
27
     lar_lts = 0
27
     lar_lts = 0
28
     uad_lts = 1
28
     uad_lts = 1
49
     reduction = 400000
49
     reduction = 400000
50
     axisTh = 0.03   
50
     axisTh = 0.03   
51
     
51
     
52
+    
53
+    keyboard = G.keyboard.events
54
+    # KEY BINDINGS
55
+    kb_a = events.AKEY 
56
+    kb_d = events.DKEY 
57
+    kb_w = events.WKEY
58
+    kb_s = events.SKEY
59
+    kb_q = events.QKEY
60
+    kb_e = events.EKEY
61
+    kb_z = events.ZKEY
62
+    kb_c = events.CKEY      
63
+    kb_en = events.ENTERKEY   
64
+    kb_la = events.LEFTARROWKEY
65
+    kb_ra = events.RIGHTARROWKEY
66
+    kb_ua = events.UPARROWKEY
67
+    kb_da = events.DOWNARROWKEY
68
+    kb_lsh = events.LEFTSHIFTKEY
69
+    kb_space = events.SPACEKEY
70
+    #if keyboard[kb_a]:
71
+    #print(keyboard[kb_a])
72
+    
73
+    dict['last_kb_a'] = dict['kb_a']
74
+    dict['last_kb_d'] = dict['kb_d']
75
+    dict['last_kb_w'] = dict['kb_w']
76
+    dict['last_kb_s'] = dict['kb_s']
77
+    dict['last_kb_q'] = dict['kb_q']
78
+    dict['last_kb_e'] = dict['kb_e']
79
+    dict['last_kb_z'] = dict['kb_z']
80
+    dict['last_kb_c'] = dict['kb_c']  
81
+    dict['last_kb_en'] = dict['kb_en']  
82
+    dict['last_kb_la'] = dict['kb_la']
83
+    dict['last_kb_ra'] = dict['kb_ra']
84
+    dict['last_kb_ua'] = dict['kb_ua']
85
+    dict['last_kb_da'] = dict['kb_da'] 
86
+    dict['last_kb_lsh'] = dict['kb_lsh'] 
87
+    dict['last_kb_space'] = dict['kb_space']    
88
+    
89
+    dict['kb_a'] = keyboard[kb_a]
90
+    dict['kb_d'] = keyboard[kb_d]
91
+    dict['kb_w'] = keyboard[kb_w]
92
+    dict['kb_s'] = keyboard[kb_s]
93
+    dict['kb_q'] = keyboard[kb_q]
94
+    dict['kb_e'] = keyboard[kb_e]
95
+    dict['kb_z'] = keyboard[kb_z]
96
+    dict['kb_c'] = keyboard[kb_c]    
97
+    dict['kb_en'] = keyboard[kb_en]
98
+    dict['kb_la'] = keyboard[kb_la]
99
+    dict['kb_ra'] = keyboard[kb_ra]
100
+    dict['kb_ua'] = keyboard[kb_ua]
101
+    dict['kb_da'] = keyboard[kb_da] 
102
+    dict['kb_lsh'] = keyboard[kb_lsh]
103
+    dict['kb_space'] = keyboard[kb_space]      
104
+    
105
+    
52
     if not any(bge.logic.joysticks):
106
     if not any(bge.logic.joysticks):
53
         #print("joystick not connnected")
107
         #print("joystick not connnected")
54
         dict['joy_con'] = 0
108
         dict['joy_con'] = 0
124
         else: mTrig = 0
178
         else: mTrig = 0
125
         #    
179
         #    
126
 
180
 
127
-        keyboard = G.keyboard.events
128
-        # KEY BINDINGS
129
-        kb_a = events.AKEY 
130
-        kb_d = events.DKEY 
131
-        kb_w = events.WKEY
132
-        kb_s = events.SKEY
133
-        kb_q = events.QKEY
134
-        kb_e = events.EKEY
135
-        kb_z = events.ZKEY
136
-        kb_c = events.CKEY      
137
-        kb_en = events.ENTERKEY   
138
-        kb_la = events.LEFTARROWKEY
139
-        kb_ra = events.RIGHTARROWKEY
140
-        kb_ua = events.UPARROWKEY
141
-        kb_da = events.DOWNARROWKEY
142
-        #if keyboard[kb_a]:
143
-        #print(keyboard[kb_a])
144
-        
145
-        dict['last_kb_a'] = dict['kb_a']
146
-        dict['last_kb_d'] = dict['kb_d']
147
-        dict['last_kb_w'] = dict['kb_w']
148
-        dict['last_kb_s'] = dict['kb_s']
149
-        dict['last_kb_q'] = dict['kb_q']
150
-        dict['last_kb_e'] = dict['kb_e']
151
-        dict['last_kb_z'] = dict['kb_z']
152
-        dict['last_kb_c'] = dict['kb_c']  
153
-        dict['last_kb_en'] = dict['kb_en']  
154
-        dict['last_kb_la'] = dict['kb_la']
155
-        dict['last_kb_ra'] = dict['kb_ra']
156
-        dict['last_kb_ua'] = dict['kb_ua']
157
-        dict['last_kb_da'] = dict['kb_da']    
158
-        
159
-        dict['kb_a'] = keyboard[kb_a]
160
-        dict['kb_d'] = keyboard[kb_d]
161
-        dict['kb_w'] = keyboard[kb_w]
162
-        dict['kb_s'] = keyboard[kb_s]
163
-        dict['kb_q'] = keyboard[kb_q]
164
-        dict['kb_e'] = keyboard[kb_e]
165
-        dict['kb_z'] = keyboard[kb_z]
166
-        dict['kb_c'] = keyboard[kb_c]    
167
-        dict['kb_en'] = keyboard[kb_en]
168
-        dict['kb_la'] = keyboard[kb_la]
169
-        dict['kb_ra'] = keyboard[kb_ra]
170
-        dict['kb_ua'] = keyboard[kb_ua]
171
-        dict['kb_da'] = keyboard[kb_da]        
181
+      
172
         
182
         
173
         
183
         
174
         dict['last_aBut'] = dict['aBut']
184
         dict['last_aBut'] = dict['aBut']

+ 46
- 2
menuV3.py View File

441
         
441
         
442
         
442
         
443
         
443
         
444
+    if funct == 'cam height':
445
+        b = dict['cam_height']
446
+        if motion == 'inc':
447
+            b += .1
448
+        else:
449
+            b -= .1    
450
+        dict['cam_height'] = round(b,2)  
451
+        
452
+    if funct == 'focal length':
453
+        b = dict['focal_length']
454
+        if motion == 'inc':
455
+            b += 2
456
+        else:
457
+            b -= 2    
458
+        dict['focal_length'] = b                   
459
+        
460
+        
461
+        
462
+        
444
     #levels
463
     #levels
445
     if funct == 'Demo Scene':
464
     if funct == 'Demo Scene':
446
         if motion == 'inc':
465
         if motion == 'inc':
612
         if dict['lv1_opt'] == 'level':
631
         if dict['lv1_opt'] == 'level':
613
         #if opt == 'settings':
632
         #if opt == 'settings':
614
             dict['current_list'] = ['sun strength', 'ambient strength', 'sun rot x', 'sun rot y', 'shadow on']
633
             dict['current_list'] = ['sun strength', 'ambient strength', 'sun rot x', 'sun rot y', 'shadow on']
634
+            
635
+    if dict['mlevel'] == 2:
636
+        if dict['lv1_opt'] == 'camera':
637
+        #if opt == 'settings':
638
+            dict['current_list'] = ['cam height', 'focal length', 'min dist', 'max dist']            
639
+            
615
 
640
 
616
     if dict['mlevel'] == 3:
641
     if dict['mlevel'] == 3:
617
         if dict['lv2_opt'] == 'ao':
642
         if dict['lv2_opt'] == 'ao':
627
             dict['current_list'] = ['bloom on']                
652
             dict['current_list'] = ['bloom on']                
628
 
653
 
629
 def get_inputs(dict, cont):
654
 def get_inputs(dict, cont):
655
+    import aud
656
+    obj = cont.owner
630
     #opt = dict['current_list'][dict['current_index']]
657
     #opt = dict['current_list'][dict['current_index']]
631
     #b
658
     #b
659
+    
660
+    obj['sound'] = aud.Factory(bge.logic.expandPath('//sounds/select.wav'))
661
+    obj['sound_a'] = aud.Factory(bge.logic.expandPath('//sounds/a.wav'))
662
+    obj['sound_b'] = aud.Factory(bge.logic.expandPath('//sounds/b.wav')) 
663
+    
632
     if keyboard.events[bge.events.LEFTARROWKEY] == JUST_ACTIVATED or (dict['bBut'] == False and dict['last_bBut'] == True):
664
     if keyboard.events[bge.events.LEFTARROWKEY] == JUST_ACTIVATED or (dict['bBut'] == False and dict['last_bBut'] == True):
665
+        
666
+        aud.device().play(obj['sound_b'])
633
         if dict['current_index'] not in dict['menu_end_points']:
667
         if dict['current_index'] not in dict['menu_end_points']:
634
             #print('lkey')
668
             #print('lkey')
635
             if dict['mlevel'] == 2:
669
             if dict['mlevel'] == 2:
648
 #            endpoint(funct, motion, dict)                               
682
 #            endpoint(funct, motion, dict)                               
649
         #a
683
         #a
650
     if (keyboard.events[bge.events.RIGHTARROWKEY] == JUST_ACTIVATED) or (dict['aBut'] == False and dict['last_aBut'] == True):
684
     if (keyboard.events[bge.events.RIGHTARROWKEY] == JUST_ACTIVATED) or (dict['aBut'] == False and dict['last_aBut'] == True):
685
+        aud.device().play(obj['sound_a'])
651
         if dict['current_opt'] not in dict['menu_end_points']:
686
         if dict['current_opt'] not in dict['menu_end_points']:
652
             if dict['mlevel'] == 0: 
687
             if dict['mlevel'] == 0: 
653
                 dict['lv0_opt'] = dict['current_list'][dict['current_index']]
688
                 dict['lv0_opt'] = dict['current_list'][dict['current_index']]
680
             endpoint(funct, motion, dict, cont)                          
715
             endpoint(funct, motion, dict, cont)                          
681
     #down     
716
     #down     
682
     if keyboard.events[bge.events.DOWNARROWKEY] == JUST_ACTIVATED or (dict['ddPad'] == False and dict['last_ddPad'] == True):
717
     if keyboard.events[bge.events.DOWNARROWKEY] == JUST_ACTIVATED or (dict['ddPad'] == False and dict['last_ddPad'] == True):
718
+        aud.device().play(obj['sound'])
683
         if dict['current_index'] < (len(dict['current_list']) - 1):
719
         if dict['current_index'] < (len(dict['current_list']) - 1):
684
             dict['current_index'] += 1  
720
             dict['current_index'] += 1  
685
             if dict['mlevel'] == 0:
721
             if dict['mlevel'] == 0:
692
                 dict['lv3_index'] = dict['current_index']                                                
728
                 dict['lv3_index'] = dict['current_index']                                                
693
     #up    
729
     #up    
694
     if keyboard.events[bge.events.UPARROWKEY] == JUST_ACTIVATED or (dict['udPad'] == False and dict['last_udPad'] == True):
730
     if keyboard.events[bge.events.UPARROWKEY] == JUST_ACTIVATED or (dict['udPad'] == False and dict['last_udPad'] == True):
731
+        aud.device().play(obj['sound'])
695
         if dict['current_index'] > 0:
732
         if dict['current_index'] > 0:
696
             dict['current_index'] -= 1  
733
             dict['current_index'] -= 1  
697
             if dict['mlevel'] == 0:
734
             if dict['mlevel'] == 0:
705
                 
742
                 
706
     #left
743
     #left
707
     if dict['ldPad'] == False and dict['last_ldPad'] == True:
744
     if dict['ldPad'] == False and dict['last_ldPad'] == True:
745
+        aud.device().play(obj['sound_a'])
708
         if dict['current_opt'] in dict['menu_end_points']:
746
         if dict['current_opt'] in dict['menu_end_points']:
709
             funct = dict['current_opt']
747
             funct = dict['current_opt']
710
             motion = 'dec'
748
             motion = 'dec'
712
     
750
     
713
     #right
751
     #right
714
     if dict['rdPad'] == False and dict['last_rdPad'] == True:
752
     if dict['rdPad'] == False and dict['last_rdPad'] == True:
753
+        aud.device().play(obj['sound_b'])
715
         if dict['current_opt'] in dict['menu_end_points']:
754
         if dict['current_opt'] in dict['menu_end_points']:
716
             funct = dict['current_opt']
755
             funct = dict['current_opt']
717
             motion = 'inc'
756
             motion = 'inc'
734
     dict['mlevel'] = 0
773
     dict['mlevel'] = 0
735
     dict['current_opt'] = ''
774
     dict['current_opt'] = ''
736
     dict['pause_menu_text'] = ''
775
     dict['pause_menu_text'] = ''
737
-    dict['menu_end_points'] = ['exit', 'restart', 'shirt color r', 'shirt color g', 'shirt color b', 'shoe color r', 'shoe color g', 'shoe color b','deck color r', 'deck color g', 'deck color b', 'shirt logo', 'brightness / contrast on', 'brightness value', 'contrast value', 'hdr on', 'avgL', 'hdr strength', 'ao on', 'ao radius', 'ao width', 'ao only', 'dof on', 'sun strength', 'sun rot x', 'sun rot y', 'shadow on', 'ambient strength', 'Demo Scene', 'Empty Lot', 'Park A', 'Training', 'Spine', 'Warehouse', '1920x1080', '1280x720', '1024x768', '800x600', 'fullscreen', 'bloom on']
776
+    dict['menu_end_points'] = ['exit', 'restart', 'shirt color r', 'shirt color g', 'shirt color b', 'shoe color r', 'shoe color g', 'shoe color b','deck color r', 'deck color g', 'deck color b', 'shirt logo', 'brightness / contrast on', 'brightness value', 'contrast value', 'hdr on', 'avgL', 'hdr strength', 'ao on', 'ao radius', 'ao width', 'ao only', 'dof on', 'sun strength', 'sun rot x', 'sun rot y', 'shadow on', 'ambient strength', 'Demo Scene', 'Empty Lot', 'Park A', 'Training', 'Spine', 'Warehouse', '1920x1080', '1280x720', '1024x768', '800x600', 'fullscreen', 'bloom on', 'cam height', 'focal length', 'min dist', 'max dist']
738
     
777
     
739
 def output(dict):
778
 def output(dict):
740
     try:
779
     try:
827
         if dict['current_opt'] ==  'fullscreen':
866
         if dict['current_opt'] ==  'fullscreen':
828
             outp = outp + ': ' + str(dict['fullscreen_on'])  
867
             outp = outp + ': ' + str(dict['fullscreen_on'])  
829
         if dict['current_opt'] ==  'bloom on':
868
         if dict['current_opt'] ==  'bloom on':
830
-            outp = outp + ': ' + str(dict['bloom_on'])                                                 
869
+            outp = outp + ': ' + str(dict['bloom_on'])  
870
+            
871
+        if dict['current_opt'] ==  'cam height':
872
+            outp = outp + ': ' + str(dict['cam_height']) 
873
+        if dict['current_opt'] ==  'focal length':
874
+            outp = outp + ': ' + str(dict['focal_length'])                                                                         
831
             
875
             
832
     dict['pause_menu_text'] = outp
876
     dict['pause_menu_text'] = outp
833
 def main(cont):
877
 def main(cont):

+ 68
- 13
walk.py View File

79
 
79
 
80
 control_bottom = scene.objects['control_bottom']
80
 control_bottom = scene.objects['control_bottom']
81
 cb = control_bottom.sensors['grindCol_bottom']
81
 cb = control_bottom.sensors['grindCol_bottom']
82
+cb_td = control_bottom.sensors['td_bottom']
82
 
83
 
83
 noidle = 0
84
 noidle = 0
84
 
85
 
153
 if lUD > sens:
154
 if lUD > sens:
154
     ldown = 1
155
     ldown = 1
155
 else:
156
 else:
156
-    ldown = 0    
157
+    ldown = 0 
158
+if lLR < -sens:
159
+    lLeft = 1
160
+else:
161
+    lLeft = 0
162
+if lLR > sens:
163
+    lRight = 1
164
+else:
165
+    lRight = 0        
157
     
166
     
158
 #walking
167
 #walking
159
 
168
 
170
 if own['last_walk_frame'] - own['last_roll_frame'] > 55:
179
 if own['last_walk_frame'] - own['last_roll_frame'] > 55:
171
     wf = 0
180
     wf = 0
172
    
181
    
173
-if (lup == 1 and aBut == 0 and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0) and wf == 0:    
182
+   
183
+if dict['kb_lsh'] == 2 and dict['kb_w'] == 2:   
184
+    print('wtf')   
185
+   
186
+if ((lup == 1 and aBut == 0) or (dict['kb_w'] == 2 and dict['kb_lsh'] == 0)) and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0 and wf == 0 and dict['kb_space'] == 0:
174
     own['walking'] = "regular"
187
     own['walking'] = "regular"
175
     walking = "regular"
188
     walking = "regular"
176
-elif lup == 1 and aBut == 1 and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0 and wf == 0:
189
+elif ((lup == 1 and aBut == 1) or (dict['kb_lsh'] == 2 and dict['kb_w'] == 2)) and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0 and wf == 0 and dict['kb_space'] != 2:
177
     own['walking'] = "fast"
190
     own['walking'] = "fast"
178
     walking = "fast"
191
     walking = "fast"
179
 else:
192
 else:
209
         #print("set 0 vel")    
222
         #print("set 0 vel")    
210
     
223
     
211
 #old walking
224
 #old walking
212
-if (lup == 1 and aBut == 0 and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0):
225
+if (lup == 1 and aBut == 0) or (dict['kb_w'] == 2 and dict['kb_lsh'] == 0)  and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0:
213
     own.actuators["walkondirt"].volume = .2
226
     own.actuators["walkondirt"].volume = .2
214
     own.actuators["walkondirt"].pitch = 1
227
     own.actuators["walkondirt"].pitch = 1
215
     cont.activate(own.actuators["walkondirt"])
228
     cont.activate(own.actuators["walkondirt"])
228
         else:
241
         else:
229
             own['requestAction'] = 'fak_walk'
242
             own['requestAction'] = 'fak_walk'
230
        
243
        
231
-elif lup == 1 and aBut == 1 and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0:
244
+elif ((lup == 1 and aBut == 1) or (dict['kb_lsh'] == 2 and dict['kb_w'] == 2)) and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0:
232
     own.actuators["walkondirt"].volume = .2
245
     own.actuators["walkondirt"].volume = .2
233
     own.actuators["walkondirt"].pitch = 1.3
246
     own.actuators["walkondirt"].pitch = 1.3
234
     cont.activate(own.actuators["walkondirt"])
247
     cont.activate(own.actuators["walkondirt"])
253
     vel = own.getLinearVelocity(True)
266
     vel = own.getLinearVelocity(True)
254
     cont.deactivate(own.actuators["walkondirt"])       
267
     cont.deactivate(own.actuators["walkondirt"])       
255
 
268
 
269
+#turning
270
+if lRight == 1 or dict['kb_d'] == 2:
271
+    cont.activate(own.actuators['right'])
272
+else:
273
+    cont.deactivate(own.actuators['right'])    
274
+    
275
+if lLeft == 1 or dict['kb_a'] == 2:
276
+    cont.activate(own.actuators['left'])    
277
+else:
278
+    cont.deactivate(own.actuators['left'])        
279
+
280
+
281
+
256
 #in air        
282
 #in air        
257
-if lup == 1 and r_ground.positive == False:
283
+if (lup == 1 or dict['kb_w'] != 0) and r_ground.positive == False:
258
     
284
     
259
     if stance == 0:
285
     if stance == 0:
260
         cont.deactivate(own.actuators['forward'])
286
         cont.deactivate(own.actuators['forward'])
273
         killact(6)
299
         killact(6)
274
         killact(7)        
300
         killact(7)        
275
         velx = linvel.x + 1
301
         velx = linvel.x + 1
276
-        own.setLinearVelocity([1.5, linvel.y, linvel.z], 1)       
302
+        own.setLinearVelocity([1.5, linvel.y, linvel.z], 1)  
303
+        
304
+    own['lF_air_frame'] = own['framenum']         
277
 #---------------
305
 #---------------
278
 if rLR > .05:
306
 if rLR > .05:
279
     cont.activate(camobj.actuators['camRight'])
307
     cont.activate(camobj.actuators['camRight'])
332
             trucks.stopAction(truckon)
360
             trucks.stopAction(truckon)
333
             own['requestAction'] = 'fak_offboard'                          
361
             own['requestAction'] = 'fak_offboard'                          
334
 def jump():
362
 def jump():
335
-    if xBut == True:
363
+    if xBut == True or dict['kb_space'] == 1:
364
+    #if xBut == True:    
336
         if own['lastx'] == 0:
365
         if own['lastx'] == 0:
337
             killact(3)
366
             killact(3)
338
             killact(4)
367
             killact(4)
340
             killact(6)
369
             killact(6)
341
             killact(7)      
370
             killact(7)      
342
             if STANCE == 0:  
371
             if STANCE == 0:  
343
-                own['requestAction'] ='reg_jump'   
372
+                own['requestAction'] ='reg_jump'  
373
+                print('jump') 
344
             if STANCE == 1:
374
             if STANCE == 1:
345
                 own['requestAction'] ='fak_jump'             
375
                 own['requestAction'] ='fak_jump'             
376
+                print('jump')
346
             JUMPHEIGHT = 1100
377
             JUMPHEIGHT = 1100
347
             force = [ 0.0, 0.0, JUMPHEIGHT]
378
             force = [ 0.0, 0.0, JUMPHEIGHT]
348
             # use local axis
379
             # use local axis
648
         hard = strength * .08
679
         hard = strength * .08
649
         if hard > 9:
680
         if hard > 9:
650
             hard = 9
681
             hard = 9
682
+        if hard < 1:
683
+            hard = 1    
651
         ud = ud * 4
684
         ud = ud * 4
652
         own['bbut_timer'] = 0
685
         own['bbut_timer'] = 0
653
         if STANCE == True:
686
         if STANCE == True:
683
     if bBut == False and own['lastb'] == True:        
716
     if bBut == False and own['lastb'] == True:        
684
         strength = own['bbut_timer']
717
         strength = own['bbut_timer']
685
         ud = (rUD * 10) +1
718
         ud = (rUD * 10) +1
686
-        throwdeck(strength, ud)        
719
+        throwdeck(strength, ud)   
720
+        
721
+def focus_deck():
722
+    since_air = own['framenum'] - own['lF_air_frame']
723
+    if cb_td.positive and since_air < 10:
724
+        print('focus!!!!!')
725
+        object = 'focus_deckA'
726
+        object2 = 'focus_deckB'            
727
+        other = throw_deck_empty
728
+        throw_deck = scene.objects["throw_deck"]
729
+        throw_deck.endObject()
730
+        scene.addObject(object, other, 0)          
731
+        scene.addObject(object2, other, 0)
732
+                
733
+    if own['throw_deck'] == True:
734
+        if dict['ldPad'] == False and dict['last_ldPad'] == True:
735
+            #focus  
736
+            object = 'focus_deckA'
737
+            object2 = 'focus_deckB'            
738
+            other = throw_deck_empty
739
+            scene.addObject(object, other, 0)          
740
+            scene.addObject(object2, other, 0)          
687
               
741
               
688
 def fall():
742
 def fall():
689
     if own['fall'] == True:
743
     if own['fall'] == True:
1007
     if r_ground.positive:
1061
     if r_ground.positive:
1008
         own['lF_ground_frame'] = own['framenum']
1062
         own['lF_ground_frame'] = own['framenum']
1009
         if 'grind' in r_ground.hitObject:
1063
         if 'grind' in r_ground.hitObject:
1010
-            if own['framenum'] - own['last_fall_frame'] < 60:
1064
+            if own['framenum'] - own['last_fall_frame'] < 90:
1011
                 own.applyForce([0,100,0], True)
1065
                 own.applyForce([0,100,0], True)
1012
-                print('moving away from rail')
1066
+                #print('moving away from rail')
1013
 
1067
 
1014
     else:
1068
     else:
1015
-        print('in air')    
1069
+        #print('in air')    
1016
         
1070
         
1017
         if  own['framenum'] - own['lF_ground_frame'] > 10:
1071
         if  own['framenum'] - own['lF_ground_frame'] > 10:
1018
             if STANCE == 0:            
1072
             if STANCE == 0:            
1041
 idle_anim()
1095
 idle_anim()
1042
 sit()
1096
 sit()
1043
 onground()
1097
 onground()
1098
+focus_deck()
1044
 #printplaying() 
1099
 #printplaying() 
1045
 
1100
 
1046
 own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
1101
 own.alignAxisToVect([0.0,0.0,1.0], 2, .03)

Loading…
Cancel
Save