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,7 +80,9 @@ def readSettings():
80 80
     dict['shadow_on'] = int(data[48])
81 81
     dict['ambient_strength'] = float(data[49]) 
82 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,7 +153,10 @@ def writeSettings():
151 153
         writing.write(str("//fullscreen on (0,1)")+"\n")
152 154
         writing.write(str(dict["fullscreen_on"])+"\n") 
153 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,7 +90,9 @@ def main():
90 90
     dict['kb_la'] = 0
91 91
     dict['kb_ra'] = 0
92 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 97
     dict['aBut'] = 0.0
96 98
     dict['bBut'] = 0.0

+ 31
- 16
co_ActionState.py View File

@@ -67,11 +67,11 @@ def main():
67 67
         own['requestAction'] = 'empty'              
68 68
 #================
69 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 71
         #print("fak-reg_roll")
72 72
         requestAction = 'fak-reg_roll'
73 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 75
         #print("reg-fak_roll")
76 76
         requestAction = 'reg-fak_roll'
77 77
         own['requestAction'] = 'reg-fak_roll'
@@ -112,6 +112,12 @@ def main():
112 112
             actionState = requestAction
113 113
             own['actionTimer'] = 0
114 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 121
     #print(own['manual_v2_timer'], 'man_timer###@!')                   
116 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 123
 #    #if (requestAction == 'reg_land' or requestAction == 'fak_land') and own['manual_v2_timer'] > 2:
@@ -563,10 +569,17 @@ def main():
563 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 585
 #        if (l_actionState == 'fak_air-roll' and requestAction == 'fak_manual'):
@@ -1635,7 +1648,7 @@ def main():
1635 1648
             #reg_jump
1636 1649
             if requestAction == 'reg_jump':
1637 1650
                 actionState = 'reg_jump'
1638
-                own['actionTimer'] = 9                
1651
+                own['actionTimer'] = 19                
1639 1652
                 skater.playAction("reg_jump", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1640 1653
                 deck.playAction("a_reg_jump2", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1641 1654
                 trucks.playAction("a_reg_jump2", 1,10, layer=trans_layer, play_mode=0, speed=.5)
@@ -1643,7 +1656,7 @@ def main():
1643 1656
             #fak_jump    
1644 1657
             if requestAction == 'fak_jump':
1645 1658
                 actionState = 'fak_jump'
1646
-                own['actionTimer'] = 9                
1659
+                own['actionTimer'] = 19                
1647 1660
                 skater.playAction("fak_jump", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1648 1661
                 trucks.playAction("a_fak_jump", 1,10, layer=trans_layer, play_mode=0, speed=.5)
1649 1662
                 deck.playAction("a_fak_jump", 1,10, layer=trans_layer, play_mode=0, speed=.5)
@@ -1806,13 +1819,13 @@ def main():
1806 1819
                 trucks.playAction("a_reg", 30,40, layer=trans_layer, play_mode=0, speed=.5) 
1807 1820
                      
1808 1821
             if requestAction == 'reg_back_invert_out':
1809
-                own['actionTimer'] = 60
1822
+                own['actionTimer'] = 30
1810 1823
                 actionState = 'reg_back_invert_out'
1811 1824
                 skater.playAction("reg_back_invert_in", 30,1, layer=trans_layer, play_mode=0, speed=1)
1812 1825
                 deck.playAction("a_reg_back_invert_in", 30,1, layer=trans_layer, play_mode=0, speed=1)
1813 1826
                 trucks.playAction("a_reg_back_invert_in", 30,1, layer=trans_layer, play_mode=0, speed=1)            
1814 1827
             if requestAction == 'fak_fr_invert_out':  
1815
-                own['actionTimer'] = 60
1828
+                own['actionTimer'] = 30
1816 1829
                 actionState = 'fak_fr_invert_out'
1817 1830
                 skater.playAction("fak_fr_invert", 30,1, layer=trans_layer, play_mode=0, speed=1)
1818 1831
                 deck.playAction("a_fak_fr_invert", 30,1, layer=trans_layer, play_mode=0, speed=1)
@@ -2853,9 +2866,9 @@ def main():
2853 2866
             if requestAction == 'reg_judo':
2854 2867
                 actionState = 'reg_judo'
2855 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 2872
                 else:
2860 2873
                     skater.playAction("reg_judo", 10,30, layer=loop_layer, play_mode=1, speed=1)
2861 2874
                     deck.playAction("a_reg", 10,30, layer=loop_layer, play_mode=1, speed=1)
@@ -2863,9 +2876,9 @@ def main():
2863 2876
             if requestAction == 'fak_judo':
2864 2877
                 actionState = 'fak_judo'
2865 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 2882
                 else:
2870 2883
                     skater.playAction("fak_judo", 10,30, layer=loop_layer, play_mode=1, speed=1)
2871 2884
                     deck.playAction("a_reg", 10,30, layer=loop_layer, play_mode=1, speed=1)
@@ -3745,6 +3758,7 @@ def main():
3745 3758
 #        own['actionTimer'] = 0
3746 3759
                   
3747 3760
     if (own['actionTimer'] == 0 or requestAction == 'reg_land' or requestAction == 'fak_land') or requestAction in jump_overrideList:
3761
+        
3748 3762
         actionState = updateAction(requestAction, actionState)
3749 3763
         
3750 3764
 #    if (own['actionState'] == 'reg_land' or own['actionState'] == 'reg_land') and own['actionTimer'] > 0:
@@ -3760,6 +3774,7 @@ def main():
3760 3774
         cur_frame = skater.getActionFrame(trans_layer)  
3761 3775
         cur_frame = round(cur_frame, 2)     
3762 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 3778
     cur_frame = skater.getActionFrame(trans_layer)
3764 3779
     #print(cur_frame)
3765 3780
     def printplaying():

+ 13
- 6
controller2.py View File

@@ -4123,16 +4123,23 @@ def main():
4123 4123
     def wallhit():
4124 4124
         linvelx = linVelocity.x
4125 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 4136
             own.setLinearVelocity(force, True)        
4130 4137
     
4131 4138
     def land_boost():
4132 4139
         linvelx = linVelocity.x
4133 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 4143
             force = (lastx, linVelocity.y, linVelocity.z )                    
4137 4144
             own.setLinearVelocity(force, True)             
4138 4145
         
@@ -4157,7 +4164,7 @@ def main():
4157 4164
     air_mover()
4158 4165
     dropinRotate()    
4159 4166
     onboard()   
4160
-    #wallhit() 
4167
+    wallhit() 
4161 4168
     linvelx = own.getLinearVelocity(True)
4162 4169
     land_boost()
4163 4170
     own["linvelx"] = linvelx.x

+ 56
- 46
inputs.py View File

@@ -22,7 +22,7 @@ def main():
22 22
     
23 23
     joy_con = dict['joy_con']  
24 24
     scenes = bge.logic.getSceneList()
25
-    
25
+        
26 26
 #hard controller mappings    
27 27
     lar_lts = 0
28 28
     uad_lts = 1
@@ -49,6 +49,60 @@ def main():
49 49
     reduction = 400000
50 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 106
     if not any(bge.logic.joysticks):
53 107
         #print("joystick not connnected")
54 108
         dict['joy_con'] = 0
@@ -124,51 +178,7 @@ def main():
124 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 184
         dict['last_aBut'] = dict['aBut']

+ 46
- 2
menuV3.py View File

@@ -441,6 +441,25 @@ def endpoint(funct, motion, dict, cont):
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 463
     #levels
445 464
     if funct == 'Demo Scene':
446 465
         if motion == 'inc':
@@ -612,6 +631,12 @@ def get_c_list(dict):
612 631
         if dict['lv1_opt'] == 'level':
613 632
         #if opt == 'settings':
614 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 641
     if dict['mlevel'] == 3:
617 642
         if dict['lv2_opt'] == 'ao':
@@ -627,9 +652,18 @@ def get_c_list(dict):
627 652
             dict['current_list'] = ['bloom on']                
628 653
 
629 654
 def get_inputs(dict, cont):
655
+    import aud
656
+    obj = cont.owner
630 657
     #opt = dict['current_list'][dict['current_index']]
631 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 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 667
         if dict['current_index'] not in dict['menu_end_points']:
634 668
             #print('lkey')
635 669
             if dict['mlevel'] == 2:
@@ -648,6 +682,7 @@ def get_inputs(dict, cont):
648 682
 #            endpoint(funct, motion, dict)                               
649 683
         #a
650 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 686
         if dict['current_opt'] not in dict['menu_end_points']:
652 687
             if dict['mlevel'] == 0: 
653 688
                 dict['lv0_opt'] = dict['current_list'][dict['current_index']]
@@ -680,6 +715,7 @@ def get_inputs(dict, cont):
680 715
             endpoint(funct, motion, dict, cont)                          
681 716
     #down     
682 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 719
         if dict['current_index'] < (len(dict['current_list']) - 1):
684 720
             dict['current_index'] += 1  
685 721
             if dict['mlevel'] == 0:
@@ -692,6 +728,7 @@ def get_inputs(dict, cont):
692 728
                 dict['lv3_index'] = dict['current_index']                                                
693 729
     #up    
694 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 732
         if dict['current_index'] > 0:
696 733
             dict['current_index'] -= 1  
697 734
             if dict['mlevel'] == 0:
@@ -705,6 +742,7 @@ def get_inputs(dict, cont):
705 742
                 
706 743
     #left
707 744
     if dict['ldPad'] == False and dict['last_ldPad'] == True:
745
+        aud.device().play(obj['sound_a'])
708 746
         if dict['current_opt'] in dict['menu_end_points']:
709 747
             funct = dict['current_opt']
710 748
             motion = 'dec'
@@ -712,6 +750,7 @@ def get_inputs(dict, cont):
712 750
     
713 751
     #right
714 752
     if dict['rdPad'] == False and dict['last_rdPad'] == True:
753
+        aud.device().play(obj['sound_b'])
715 754
         if dict['current_opt'] in dict['menu_end_points']:
716 755
             funct = dict['current_opt']
717 756
             motion = 'inc'
@@ -734,7 +773,7 @@ def init(own, dict):
734 773
     dict['mlevel'] = 0
735 774
     dict['current_opt'] = ''
736 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 778
 def output(dict):
740 779
     try:
@@ -827,7 +866,12 @@ def output(dict):
827 866
         if dict['current_opt'] ==  'fullscreen':
828 867
             outp = outp + ': ' + str(dict['fullscreen_on'])  
829 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 876
     dict['pause_menu_text'] = outp
833 877
 def main(cont):

+ 68
- 13
walk.py View File

@@ -79,6 +79,7 @@ followcam = scene.objects["followcam"]
79 79
 
80 80
 control_bottom = scene.objects['control_bottom']
81 81
 cb = control_bottom.sensors['grindCol_bottom']
82
+cb_td = control_bottom.sensors['td_bottom']
82 83
 
83 84
 noidle = 0
84 85
 
@@ -153,7 +154,15 @@ else:
153 154
 if lUD > sens:
154 155
     ldown = 1
155 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 167
 #walking
159 168
 
@@ -170,10 +179,14 @@ wf = 1
170 179
 if own['last_walk_frame'] - own['last_roll_frame'] > 55:
171 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 187
     own['walking'] = "regular"
175 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 190
     own['walking'] = "fast"
178 191
     walking = "fast"
179 192
 else:
@@ -209,7 +222,7 @@ if walking == None:
209 222
         #print("set 0 vel")    
210 223
     
211 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 226
     own.actuators["walkondirt"].volume = .2
214 227
     own.actuators["walkondirt"].pitch = 1
215 228
     cont.activate(own.actuators["walkondirt"])
@@ -228,7 +241,7 @@ if (lup == 1 and aBut == 0 and yBut == False and (r_ground.positive or own['stai
228 241
         else:
229 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 245
     own.actuators["walkondirt"].volume = .2
233 246
     own.actuators["walkondirt"].pitch = 1.3
234 247
     cont.activate(own.actuators["walkondirt"])
@@ -253,8 +266,21 @@ else:
253 266
     vel = own.getLinearVelocity(True)
254 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 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 285
     if stance == 0:
260 286
         cont.deactivate(own.actuators['forward'])
@@ -273,7 +299,9 @@ if lup == 1 and r_ground.positive == False:
273 299
         killact(6)
274 300
         killact(7)        
275 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 306
 if rLR > .05:
279 307
     cont.activate(camobj.actuators['camRight'])
@@ -332,7 +360,8 @@ def onboard():
332 360
             trucks.stopAction(truckon)
333 361
             own['requestAction'] = 'fak_offboard'                          
334 362
 def jump():
335
-    if xBut == True:
363
+    if xBut == True or dict['kb_space'] == 1:
364
+    #if xBut == True:    
336 365
         if own['lastx'] == 0:
337 366
             killact(3)
338 367
             killact(4)
@@ -340,9 +369,11 @@ def jump():
340 369
             killact(6)
341 370
             killact(7)      
342 371
             if STANCE == 0:  
343
-                own['requestAction'] ='reg_jump'   
372
+                own['requestAction'] ='reg_jump'  
373
+                print('jump') 
344 374
             if STANCE == 1:
345 375
                 own['requestAction'] ='fak_jump'             
376
+                print('jump')
346 377
             JUMPHEIGHT = 1100
347 378
             force = [ 0.0, 0.0, JUMPHEIGHT]
348 379
             # use local axis
@@ -648,6 +679,8 @@ def throwdeck(strength, ud):
648 679
         hard = strength * .08
649 680
         if hard > 9:
650 681
             hard = 9
682
+        if hard < 1:
683
+            hard = 1    
651 684
         ud = ud * 4
652 685
         own['bbut_timer'] = 0
653 686
         if STANCE == True:
@@ -683,7 +716,28 @@ def throwdeck_trigger():
683 716
     if bBut == False and own['lastb'] == True:        
684 717
         strength = own['bbut_timer']
685 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 742
 def fall():
689 743
     if own['fall'] == True:
@@ -1007,12 +1061,12 @@ def onground():
1007 1061
     if r_ground.positive:
1008 1062
         own['lF_ground_frame'] = own['framenum']
1009 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 1065
                 own.applyForce([0,100,0], True)
1012
-                print('moving away from rail')
1066
+                #print('moving away from rail')
1013 1067
 
1014 1068
     else:
1015
-        print('in air')    
1069
+        #print('in air')    
1016 1070
         
1017 1071
         if  own['framenum'] - own['lF_ground_frame'] > 10:
1018 1072
             if STANCE == 0:            
@@ -1041,6 +1095,7 @@ fall()
1041 1095
 idle_anim()
1042 1096
 sit()
1043 1097
 onground()
1098
+focus_deck()
1044 1099
 #printplaying() 
1045 1100
 
1046 1101
 own.alignAxisToVect([0.0,0.0,1.0], 2, .03)

Loading…
Cancel
Save