Browse Source

Merge branch 'configobj_config_file' of shuvit/shuvit into dev

shuvit 5 years ago
parent
commit
244e99f824

+ 35
- 248
Settings.py View File

@@ -1,223 +1,42 @@
1
-#from bge import logic
1
+import bge
2 2
 import GameLogic
3
-#from os.path import dirname, realpath, join
3
+import configobj
4
+from configobj import ConfigObj
4 5
 
5
-#BASE_DIR = os.path.join( os.path.dirname( __file__ ), '..' )
6 6
 mainDir = GameLogic.expandPath("//")
7 7
 
8
-fileName = mainDir + "Settings.dat"
9
-resx = 1280
10
-resy = 720
8
+fileName = mainDir + "config.ini"
9
+
10
+config = ConfigObj(fileName, interpolation=True)
11
+dict = bge.logic.globalDict
12
+
13
+print('###############start game##########')
14
+dict['music_player'] = 1
15
+
16
+def to_dict(section, key):
17
+    dict = bge.logic.globalDict
18
+    value = config[key]
19
+    if isinstance(value, str):
20
+        if value.isdigit():
21
+            value = int(value)
22
+        else:
23
+            try:
24
+                value = float(value)
25
+            except:
26
+                pass
27
+    dict[key] = value  
28
+
11 29
 def readSettings():
12
-    import GameLogic
13
-    import bge
14
-    cont = GameLogic.getCurrentController()
15
-    own = cont.owner
16
-    scenes = bge.logic.getSceneList()
17
-    main_scene = [scene for scene in scenes if scene.name=="main"][0]
18
-    own = main_scene.objects['Empty']
19
-    
20
-    with open(fileName) as reading:
21
-        #data = [line.split()[0] for line in reading]
22
-        data = reading.readlines()
23
-        #print lines[25]
24
-        #print lines[29]
25
-        reading.close()
30
+    config.walk(to_dict)     
26 31
 
27
-    #own["val"] = int(data[1])
28
-    #own["bright"] = int(data[1])
29
-    own["playerName"] = data[4]
30
-    #own["audio"] = int(data[3])
31
-    own["level"] = data[5]
32
-    #data6 = data[6]
33
-    #data6.split(None, 1)[0]
34
-    #data5 = data5.strip('\n')
35
-    #print(data6)
36
-    own["resx"] = int(data[7])
37
-    own["resy"] = int(data[8])
38
-    own["framerate"] = int(data[10])
39
-    own["profile"] = int(data[12])
40
-    dict = bge.logic.globalDict #Get the global dictionary
41
-    
42
-    dict['resx'] = own["resx"]
43
-    dict['resy'] = own["resy"]   
44
-    level = data[5]
45
-    level = level.split(None, 1)[0]
46
-    level = str(level)
47
-    own["level"] = level
48
-    dict["level"] = level
49
-    print("reading. settings")
50
-    print("Level: ", level)
51
-    recorder_on = int(data[14])
52
-    print("Game play recorder on: ", recorder_on) 
53
-    #dict = bge.logic.globalDict
54
-    dict['recorder_on'] = recorder_on
55
-    own['recorder_on'] = recorder_on
56
-    dict['recorder_on'] = recorder_on 
57
-    character = data[1]
58
-    dict["character"] = str(character.split(None, 1)[0])
59
-    dict["shirt_color_r"] = float(data[16])
60
-    dict["shirt_color_g"] = float(data[17])
61
-    dict["shirt_color_b"] = float(data[18])
62
-    dict["shoe_color_r"] = float(data[20])
63
-    dict["shoe_color_g"] = float(data[21])
64
-    dict["shoe_color_b"] = float(data[22]) 
65
-    dict["deck_color_r"] = float(data[24])
66
-    dict["deck_color_g"] = float(data[25])
67
-    dict["deck_color_b"] = float(data[26]) 
68
-    dict["shirt_logo"] = int(data[28])  
69
-    dict["bc"] = int(data[30])
70
-    dict["BC_BRIGHTNESS"] = float(data[31])
71
-    dict["BC_CONTRAST"] = float(data[32])  
72
-    dict['hdr'] = int(data[34])
73
-    dict['avgL'] = float(data[35])
74
-    dict['HDRamount'] = float(data[36])
75
-    dict['ao'] = int(data[38])
76
-    dict['onlyAO'] = int(data[39])
77
-    dict['aowidth'] = float(data[40])
78
-    dict['aoradius'] = float(data[41])
79
-    dict['dof_on'] = float(data[43])
80
-    dict['sun_strength'] = float(data[45])
81
-    dict['sun_rot_x'] = float(data[46])
82
-    dict['sun_rot_y'] = float(data[47])            
83
-    dict['shadow_on'] = int(data[48])
84
-    dict['ambient_strength'] = float(data[49]) 
85
-    dict['fullscreen_on'] = int(data[51]) 
86
-    dict['bloom_on'] = int(data[53]) 
87
-    dict['cam_height'] = float(data[55]) 
88
-    dict['focal_length'] = int(data[56])        
89
-    dict['cam_min'] = float(data[57])
90
-    dict['cam_max'] = float(data[58])
91
-    dict['music_player'] = int(data[60]) 
92
-    dict['fxaa'] = int(data[62]) 
93
-    dict['FXAA_SPAN_MAX'] = float(data[63])   
94
-    dict['cch_targetHeight'] = float(data[65])         
95
-    dict["trucks_r"] = float(data[67])
96
-    dict["trucks_g"] = float(data[68])
97
-    dict["trucks_b"] = float(data[69])
98
-    dict["wheel1_r"] = float(data[71])
99
-    dict["wheel1_g"] = float(data[72])
100
-    dict["wheel1_b"] = float(data[73])
101
-    dict["wheel2_r"] = float(data[75])
102
-    dict["wheel2_g"] = float(data[76])
103
-    dict["wheel2_b"] = float(data[77])
104
-    dict["wheel3_r"] = float(data[79])
105
-    dict["wheel3_g"] = float(data[80])
106
-    dict["wheel3_b"] = float(data[81])
107
-    dict["wheel4_r"] = float(data[83])
108
-    dict["wheel4_g"] = float(data[84])
109
-    dict["wheel4_b"] = float(data[85])  
110
-    dict["deck_index"] = int(data[87])                        
111
-    
112
-    #print('bc = ', dict['bc'])        
113
-    #dict['music_player_on'] = int(data[16])  
114
-def writeSettings():
115
-    import GameLogic
116
-    import bge
117
-    cont = GameLogic.getCurrentController()
118
-    own = cont.owner
119
-    scenes = bge.logic.getSceneList()
32
+def from_dict(section, key):
120 33
     dict = bge.logic.globalDict
121
-    main_scene = [scene for scene in scenes if scene.name=="main"][0]
122
-    own = main_scene.objects['Empty']
123
-    print("writing called")
124
-    with open(fileName, 'w') as writing:
125
-        writing.write(str("//settings.dat")+"\n")
126
-        writing.write(str(dict["character"])+"\n")
127
-        writing.write(str(own["bright"])+"\n")
128
-        writing.write(str("-\n"))
129
-        writing.write(str("//level (e.g. spine, city, city2)")+"\n")
130
-        writing.write(str(own["level"])+"\n")
131
-        writing.write(str("//resolution")+"\n")
132
-        writing.write(str(dict["resx"])+"\n")
133
-        writing.write(str(dict["resy"])+"\n")
134
-        writing.write(str("//show framerate")+"\n")
135
-        writing.write(str(own["framerate"])+"\n")
136
-        writing.write(str("//show profile")+"\n")
137
-        writing.write(str(own["profile"])+"\n")
138
-        writing.write(str("//Game play recorder off/on (0,1)")+"\n")
139
-        writing.write(str(own["recorder_on"])+"\n")
140
-        writing.write(str("//Shirt color [r,g,b]")+"\n")
141
-        writing.write(str(dict["shirt_color_r"])+"\n") #16
142
-        writing.write(str(dict["shirt_color_g"])+"\n")
143
-        writing.write(str(dict["shirt_color_b"])+"\n")    # 
144
-        writing.write(str("//Shoe color [r,g,b]")+"\n")
145
-        writing.write(str(dict["shoe_color_r"])+"\n") #16
146
-        writing.write(str(dict["shoe_color_g"])+"\n")
147
-        writing.write(str(dict["shoe_color_b"])+"\n")    # 
148
-        writing.write(str("//Deck color [r,g,b]")+"\n")
149
-        writing.write(str(dict["deck_color_r"])+"\n") #24
150
-        writing.write(str(dict["deck_color_g"])+"\n")
151
-        writing.write(str(dict["deck_color_b"])+"\n")    #                           
152
-        writing.write(str("//Shirt Logo")+"\n")
153
-        writing.write(str(dict["shirt_logo"])+"\n") #24
154
-        writing.write(str("//Brightness/Contrast: On, brightness, contrast")+"\n")
155
-        writing.write(str(dict["bc"])+"\n")
156
-        writing.write(str(dict["BC_BRIGHTNESS"])+"\n")
157
-        writing.write(str(dict["BC_CONTRAST"])+"\n")
158
-        writing.write(str("//HDR: On, avgL, amount")+"\n")
159
-        writing.write(str(dict["hdr"])+"\n")
160
-        writing.write(str(dict["avgL"])+"\n")
161
-        writing.write(str(dict["HDRamount"])+"\n") 
162
-        writing.write(str("//AO: On, only, width, radius")+"\n")
163
-        writing.write(str(dict["ao"])+"\n")
164
-        writing.write(str(dict["onlyAO"])+"\n")
165
-        writing.write(str(dict["aowidth"])+"\n")                
166
-        writing.write(str(dict["aoradius"])+"\n") 
167
-        writing.write(str("//dof on")+"\n")
168
-        writing.write(str(dict["dof_on"])+"\n") 
169
-        writing.write(str("//sun settings: strength, rotx, roty, shadow on, ambient strength")+"\n")
170
-        writing.write(str(dict["sun_strength"])+"\n")                           
171
-        writing.write(str(dict["sun_rot_x"])+"\n")                           
172
-        writing.write(str(dict["sun_rot_y"])+"\n")                           
173
-        writing.write(str(dict["shadow_on"])+"\n")                                     
174
-        writing.write(str(dict["ambient_strength"])+"\n") 
175
-        writing.write(str("//fullscreen on (0,1)")+"\n")
176
-        writing.write(str(dict["fullscreen_on"])+"\n") 
177
-        writing.write(str("//bloom on (0,1)")+"\n")
178
-        writing.write(str(dict["bloom_on"])+"\n")  
179
-        writing.write(str("//cam")+"\n")
180
-        writing.write(str(dict["cam_height"])+"\n") 
181
-        writing.write(str(dict["focal_length"])+"\n") 
182
-        writing.write(str(dict["cam_min"])+"\n")                 
183
-        writing.write(str(dict["cam_max"])+"\n") 
184
-        writing.write(str("//music player on / off")+"\n")
185
-        writing.write(str(dict["music_player"])+"\n")
186
-        writing.write(str("//fxaa")+"\n")
187
-        writing.write(str(dict["fxaa"])+"\n") 
188
-        writing.write(str(dict["FXAA_SPAN_MAX"])+"\n")    
189
-        writing.write(str("//camera target height")+"\n")
190
-        writing.write(str(dict["cch_targetHeight"] )+"\n")   
191
-        writing.write(str("//trucks color [r,g,b]")+"\n")
192
-        writing.write(str(dict["trucks_r"])+"\n")
193
-        writing.write(str(dict["trucks_g"])+"\n")
194
-        writing.write(str(dict["trucks_b"])+"\n") 
195
-        writing.write(str("//wheel1 color [r,g,b]")+"\n")
196
-        writing.write(str(dict["wheel1_r"])+"\n")
197
-        writing.write(str(dict["wheel1_g"])+"\n")
198
-        writing.write(str(dict["wheel1_b"])+"\n") 
199
-        writing.write(str("//wheel2 color [r,g,b]")+"\n")
200
-        writing.write(str(dict["wheel2_r"])+"\n")
201
-        writing.write(str(dict["wheel2_g"])+"\n")
202
-        writing.write(str(dict["wheel2_b"])+"\n") 
203
-        writing.write(str("//wheel3 color [r,g,b]")+"\n")
204
-        writing.write(str(dict["wheel3_r"])+"\n")
205
-        writing.write(str(dict["wheel3_g"])+"\n")
206
-        writing.write(str(dict["wheel3_b"])+"\n") 
207
-        writing.write(str("//wheel4 color [r,g,b]")+"\n")
208
-        writing.write(str(dict["wheel4_r"])+"\n")
209
-        writing.write(str(dict["wheel4_g"])+"\n")
210
-        writing.write(str(dict["wheel4_b"])+"\n")                                          
211
-        writing.write(str("//deck index")+"\n")
212
-        writing.write(str(dict["deck_index"])+"\n")        
213
-        
214
-        #dict['ccH_targetHeight']     
215
-        
216
-        #writing.write(str(own["framerate"])+"\n")
217
-        print("writing settings")
218
-        writing.close()
219
-       
220
-       
34
+    config[key] = dict[key]
35
+
36
+def writeSettings():
37
+    config.walk(from_dict)  
38
+    config.write()    
39
+          
221 40
 def setres():
222 41
     import GameLogic
223 42
     import bge
@@ -227,8 +46,8 @@ def setres():
227 46
     cont = GameLogic.getCurrentController()
228 47
     own2 = cont.owner
229 48
     dict = bge.logic.globalDict 
230
-    resx = dict["resx"]
231
-    resy = dict["resy"]
49
+    resx = int(dict["resx"])
50
+    resy = int(dict["resy"])
232 51
     fullscreen = bge.render.getFullScreen()
233 52
     print("fullscreen = ", fullscreen)
234 53
     if fullscreen != True:
@@ -249,44 +68,19 @@ def loadlevel():
249 68
     own = main_scene.objects['Empty']
250 69
     cont = GameLogic.getCurrentController()
251 70
     own2 = cont.owner
252
-    #readSettings()
253 71
 
254 72
     dict = bge.logic.globalDict #Get the global dictionary
255 73
     
256
-#    resx = dict["resx"]
257
-#    resy = dict["resy"]
258
-#    #dict['resx'] = resx
259
-#    #dict['resy'] = resy
260
-#    
261
-#    fullscreen = bge.render.getFullScreen()
262
-#    print("fullscreen = ", fullscreen)
263
-#    if fullscreen != True:
264
-#        if dict['fullscreen_on'] == 1:
265
-#            bge.render.setFullScreen(True)
266
-#    if fullscreen == True:
267
-#        if dict['fullscreen_on'] == 0:
268
-#            bge.render.setFullScreen(False) 
269
-#            
270
-#    bge.render.setWindowSize(resx, resy)         
271
-#    print("resolution = ", resx, resy)
272
-    #objList = scene.objects
273 74
     if own["framerate"] == 1:    
274 75
         bge.render.showFramerate(1)
275 76
     if own["profile"] ==1:    
276 77
         bge.render.showProfile(1)   
277
-    #cont = GameLogic.getCurrentController() 
278
-    #own = cont.owner
279
-    #cont = own2.controllers['loadLevel']
280 78
     act = own2.actuators["level"]
281
-    #cont.activate(own.actuators["loading"]) 
282
-    #level = own["level"]
283
-    
284 79
     dict = bge.logic.globalDict
285 80
     level = dict['level']
286
-    #dict['level'] = level
81
+    print('loading level', level)
287 82
     act.scene = level 
288 83
     cont.activate(own2.actuators["level"]) 
289
-    #cont.activate(own2.actuators["stance"])
290 84
     dict['npause'] = False 
291 85
     
292 86
 def timer():
@@ -296,14 +90,7 @@ def timer():
296 90
     dict = bge.logic.globalDict    
297 91
     
298 92
     if dict['reload_timer'] == 1:
299
-        #restart
300
-        # get current scene
301 93
         scene = bge.logic.getCurrentScene()
302
-
303
-        # restart the current scene
304
-        #scene.restart()        
305 94
             
306 95
     if dict['reload_timer'] > 0:
307 96
        dict['reload_timer'] -= 1         
308
-    #print(dict['reload_timer'])
309
-    #own['reload_timer'] = dict['reload_timer']   

+ 5
- 2
Startup.py View File

@@ -139,12 +139,15 @@ def main():
139 139
     dict['spawned_npc_decks'] = []
140 140
     dict['spawned_npc_trucks'] = []    
141 141
     dict['spawned_npcs'] = []
142
-    dict['JUMPHEIGHT'] = 800
143
-    dict['MAX_VEL'] = 6.7
142
+    #dict['JUMPHEIGHT'] = 800
143
+    #dict['MAX_VEL'] = 6.7
144 144
     dict['char_loaded'] = 0
145 145
     dict['man_sens_l'] = .03
146 146
     dict['man_sens_r'] = .08
147 147
     dict['walk'] = 1
148 148
     dict['cur_ccH_targetHeight'] = .3
149
+    dict['music_start'] = False  
150
+    dict['npause'] = False
151
+    dict['playback'] = False  
149 152
 
150 153
 main()

BIN
Test/Music/Divineinfinite - Bang This.mp3 View File


BIN
Test/Music/Just 1 Soul - Growing.mp3 View File


+ 0
- 1
Test/Music/Test.txt View File

@@ -1 +0,0 @@
1
-Hello, friend

BIN
Test/Music/alien-spaceship_daniel_simion.wav View File


+ 363
- 0
camera.py View File

@@ -0,0 +1,363 @@
1
+#zskcam
2
+import bge
3
+import mathutils
4
+from mathutils import *
5
+scene = bge.logic.getCurrentScene()
6
+cont = bge.logic.getCurrentController()
7
+own = cont.owner
8
+def main():
9
+    dict = bge.logic.globalDict 
10
+    camempty = scene.objects['camEmpty.001']
11
+    controlcube = scene.objects['control_cube.002']
12
+    
13
+    camCube = scene.objects['camCube']
14
+    
15
+    dropinCol = controlcube.sensors['dropinCol']
16
+    LAST_GRIND = controlcube['LAST_GRIND']
17
+    up = cont.sensors['up']
18
+    ray = cont.sensors['up']
19
+    down = cont.sensors['down']
20
+    left = cont.sensors['left']
21
+    right = cont.sensors['right']
22
+    distance = 0.12
23
+    cam = cont.actuators["Camera"]
24
+    near = cont.sensors["Near"]
25
+    move = own.actuators["move"]
26
+    #match camera actuaotor
27
+    cam_def_height = dict['cam_height'] #-.1 #-.6
28
+    #cam_def_min = 1.6
29
+    #cam_def_max = 2.4
30
+    cam_def_min = dict['cam_min']
31
+    cam_def_max = dict['cam_max']
32
+    cam_height = cam.height 
33
+    cam_min = cam.min   
34
+    cam_max = cam.max
35
+    lasty = controlcube['lasty']
36
+    cam_moved = 0
37
+    lastCamheight = controlcube['lastCamheight']
38
+    raised = 0
39
+    walk = controlcube['walk']
40
+    cam.axis = 4
41
+    ccheight = controlcube.worldPosition[2]
42
+    camwpz = own.worldPosition[2]
43
+    zdist = camwpz - ccheight
44
+    
45
+    cam1 = scene.objects['Camera.003']
46
+    cam2 = scene.objects['freecam']
47
+    cam3 = scene.objects['followcam']
48
+    
49
+    camList = scene.cameras
50
+    freecam = camList["freecam"]     
51
+    
52
+    if 'init' not in own:
53
+        own['init'] = 1
54
+        own['last_move_x'] = 0
55
+        own['last_move_y'] = 0
56
+        own['last_move_z'] = 0
57
+        own['last_rot_x'] = 0
58
+        own['last_rot_y'] = 0
59
+        own['last_rot_z'] = 0
60
+        own['idlecampos_x'] = 0
61
+        own['speed_mult'] = 1.00 
62
+        controlcube['driving'] = False  
63
+        dict['cur_ccH_min'] = dict['cam_walk_min']
64
+        dict['cur_ccH_max'] = dict['cam_walk_max']
65
+        cam.height = dict['cam_height']
66
+    acam = scene.active_camera
67
+
68
+
69
+    
70
+    #if 1 == 1:
71
+    #if own['playback'] == False:
72
+    if controlcube['driving'] == False:
73
+        if down.triggered == True and LAST_GRIND == False and walk == 0:
74
+            hitPosition = down.hitPosition
75
+            distance = own.getDistanceTo(hitPosition)
76
+            cam_moved = 1       
77
+            if distance < .2:
78
+                camempty['hitdown'] = True
79
+                cam.height = cam_height + .3
80
+                cam.damping = .0 
81
+                #print("raise cam")
82
+            if zdist < -.2:
83
+                cam.height = lastCamheight + .01
84
+                cam.damping = .0
85
+                raised = 1    
86
+            if (distance > .4 and distance < .6) and zdist > -.2 and raised == 0:
87
+                camheight2 = cam.height - .001
88
+                if cam.height < .2: 
89
+                    cam.height = camheight2
90
+                    #print("slow lower")
91
+            if distance >= .6 and zdist > -.2 and raised == 0:
92
+                cam.height = cam.height - .02
93
+                #print("slow lower2")           
94
+        if down.triggered == False and LAST_GRIND == False and cam_moved == 0 and walk == 0:
95
+            camempty['hitdown'] = False
96
+            if cam_height > (cam_def_height + .06) and zdist > -.2 and raised == 0:
97
+                cam.height = cam_height - .02
98
+        if cam_height < -.6 and cam_moved == 0 and LAST_GRIND == False and zdist > -.2 and raised == 0 and walk == 0:
99
+            cam_height = .1  
100
+        if LAST_GRIND == True and walk == 0:
101
+            if cam.height < -.5 or zdist < -.2:
102
+                cam.height = cam.height + .013
103
+            if cam.height >= -.5 and not down.triggered:
104
+                pass
105
+        
106
+        if walk == 1:
107
+            if dropinCol.positive == True and lasty == True:
108
+                pass 
109
+            else:
110
+                pass   
111
+        controlcube['lastCamheight'] = cam.height    
112
+        #########
113
+        #cam.min = dict['cam_min']
114
+        #cam.max = dict['cam_max']
115
+        cont.activate(own.actuators['Camera'])  
116
+        ########
117
+        
118
+        if near.triggered == True and walk == 0:
119
+            #print("near")
120
+            if cam.min < 1:
121
+                cam.min = cam.min + .1
122
+                cam.max = cam.max + .1
123
+            cam.height = cam_height + .01
124
+            cam.damping = .001
125
+            cont.activate(move)
126
+            
127
+        else:
128
+            #print("far")
129
+            cont.deactivate(move)
130
+            if cam.min > cam_def_min:
131
+                cam.min = cam.min - .05
132
+                cam.max = cam.max - .05 
133
+            cam.damping = .0          
134
+        if cam.damping != 0 and down.triggered == False and near.triggered == False:
135
+            cam.damping = 0.91             
136
+
137
+        obj = cont.owner
138
+        cube = controlcube
139
+        to = cube
140
+        from2 = obj
141
+        distance = 0.0
142
+        property = ""
143
+        face = 1
144
+        xray = 0
145
+        poly = 0
146
+        hit = obj.rayCast( to, from2, distance, property, face, xray, poly)
147
+        control = "control_cube.002"
148
+        hitobj = hit[0]
149
+        hitobj = str(hitobj)
150
+        if hitobj != control and walk == 0:
151
+            cam.damping = .0 
152
+            if cam.height < 3:
153
+                cam.height = cam_height + .1
154
+    
155
+    if dict['menu_idle_timer'] > 300:
156
+        move_len = 2048
157
+        if own['idlecampos_x'] < move_len:
158
+            own['idlecampos_x'] += 1
159
+        if own['idlecampos_x'] == move_len:
160
+           own['idlecampos_x'] = 0     
161
+            
162
+        if own['idlecampos_x'] < (move_len / 2):
163
+            move = [.0001, 0, 0]
164
+            freecam.applyMovement( move, True)
165
+            freecam.applyRotation([.0001, 0, .0001],True)
166
+        if own['idlecampos_x'] > (move_len / 2):
167
+            move = [-.0001, 0, 0]
168
+            freecam.applyMovement( move, True)
169
+            freecam.applyRotation([-.0001, 0, -.0001],True)        
170
+        
171
+    if dict['npause'] == True:
172
+        cont.deactivate(own.actuators['Camera'])
173
+        controlcube['camera'] = 2
174
+    if controlcube['camera'] == 2 and dict['joy_con'] == 1:
175
+        cont.deactivate(own.actuators['Camera'])
176
+        scene.active_camera = freecam 
177
+        cont.activate(cube.actuators['freecam']) 
178
+        #print('activating camera', freecam)  
179
+#####        
180
+    #get value 0-100    
181
+        lLR = dict['lLR'] / .082 * 100
182
+        lUD = dict['lUD'] / .082 * 100 - 20 / 80
183
+        rLR = dict['rLR'] / .082 * 100 - 20 / 80
184
+        rUD = dict['rUD'] / .082 * 100 - 20 / 80
185
+        lTrig = dict['lTrig'] / .082 * 100 - 20 / 80
186
+        rTrig = dict['rTrig'] / .082 * 100 - 20 / 80
187
+#        lBump = dict['lBump']
188
+#        rBump = dict['rBump']
189
+        
190
+        if lLR < -20:
191
+            lmLR = round((lLR + 20) / 80 * 100, 0) 
192
+        elif lLR > 20:
193
+            lmLR = round((lLR - 20) / 80 * 100, 0)
194
+        else: lmLR = 0  
195
+              
196
+        if lUD > 20:
197
+            lmUD = round((lUD - 20) / 80 * 100, 0)
198
+        elif lUD < -20:
199
+            lmUD = round((lUD + 20) / 80 * 100, 0)
200
+        else: lmUD = 0 
201
+
202
+        if rLR < -20:
203
+            rmLR = round((rLR + 20) / 80 * 100, 0)
204
+        elif rLR > 20:
205
+            rmLR = round((rLR - 20) / 80 * 100, 0)
206
+        else: rmLR = 0         
207
+        
208
+        if rUD > 20:
209
+            rmUD = round((rUD - 20) / 80 * 100, 0)
210
+        elif rUD < -20:
211
+            rmUD = round((rUD + 20) / 80 * 100, 0)
212
+        else: rmUD = 0 
213
+      
214
+        if lTrig > 3:
215
+            mTrig = lTrig * -1
216
+        elif rTrig > 3:
217
+            mTrig = rTrig    
218
+        else: mTrig = 0
219
+
220
+        #move camera
221
+        damping = .95
222
+        damping2 = 1.005
223
+        mult = .0005 * own['speed_mult']
224
+        move_x = lmUD * mult
225
+        move_y = lmLR * mult
226
+        move_z = (mTrig * -mult) / 2#4
227
+        
228
+        rot_mult = -.00015 * own['speed_mult']
229
+        rot_x = rmUD * rot_mult
230
+        rot_y = rmLR * rot_mult
231
+        
232
+        if move_x == 0 and own['last_move_x'] != 0:
233
+            move_x = own['last_move_x'] * damping
234
+        if move_y == 0 and own['last_move_y'] != 0:
235
+            move_y = own['last_move_y'] * damping 
236
+        if move_z == 0 and own['last_move_z'] != 0:
237
+            move_z = own['last_move_z'] * damping         
238
+        if rot_x == 0 and own['last_rot_x'] != 0:
239
+            rot_x = own['last_rot_x'] * damping
240
+        if rot_y == 0 and own['last_rot_y'] != 0:
241
+            rot_y = own['last_rot_y'] * damping         
242
+                             
243
+        move = [move_y, 0, move_x]
244
+        freecam.applyMovement( move, True)
245
+        freecam.applyMovement([0, 0, move_z], False)    
246
+        freecam.applyRotation([rot_x, 0, 0],True)
247
+        freecam.applyRotation([0, 0, rot_y],False)
248
+       
249
+        
250
+################    
251
+    #print(dict['walk'], 'walk')
252
+    multer = .02
253
+    if dict['walk'] == 1:
254
+        if dict['cur_ccH_targetHeight'] < dict['cam_walk_height']:
255
+            dist = dict['cam_walk_height'] - dict['cur_ccH_targetHeight']
256
+            
257
+            dict['cur_ccH_targetHeight'] = dict['cur_ccH_targetHeight'] + (dist * multer)
258
+            if dict['cur_ccH_targetHeight'] > dict['cam_walk_height']:
259
+                dict['cur_ccH_targetHeight'] = dict['cam_walk_height']
260
+                
261
+        cam.min = dict['cam_walk_min'] 
262
+        cam.max = dict['cam_walk_max']        
263
+        #ccH_targetHeight = .9
264
+    else:  
265
+
266
+        if dict['cur_ccH_targetHeight'] < dict['cch_targetHeight']:
267
+            dist = dict['cur_ccH_targetHeight'] - dict['cch_targetHeight']
268
+            dict['cur_ccH_targetHeight'] = dict['cur_ccH_targetHeight'] - (dist * multer)
269
+            if dict['cur_ccH_targetHeight'] > dict['cch_targetHeight'] - .001:
270
+                dict['cur_ccH_targetHeight'] = dict['cch_targetHeight']             
271
+
272
+        if dict['cur_ccH_targetHeight'] > dict['cch_targetHeight']:
273
+            dist = dict['cch_targetHeight'] - dict['cur_ccH_targetHeight'] 
274
+            dict['cur_ccH_targetHeight'] = dict['cur_ccH_targetHeight'] + (dist * multer)
275
+            if dict['cur_ccH_targetHeight'] < dict['cch_targetHeight'] + .001:
276
+                dict['cur_ccH_targetHeight'] = dict['cch_targetHeight']             
277
+        
278
+        
279
+    ccH_targetHeight = dict['cur_ccH_targetHeight']  
280
+    #print(dict['cur_ccH_targetHeight'])    
281
+    #dict['cur_ccH_targetHeight'] =            
282
+    #ccH_targetHeight = .3
283
+    ccH = camCube.worldPosition.z
284
+    pH = camCube.parent.worldPosition.z
285
+    ccheight = (round((ccH - pH), 2) - .4)
286
+    #print(ccheight, 'camera target height')
287
+    
288
+    localPos = camCube.localPosition.z
289
+    #print(localPos, 'local position')
290
+    if localPos != ccH_targetHeight:
291
+        num = ccH_targetHeight - localPos
292
+        camCube.localPosition.z += num
293
+    #if camHeightSet not in own:
294
+    if 1 == 1:    
295
+        num = ccH_targetHeight - ccheight
296
+    else:
297
+        own['camHeightSet'] = True    
298
+           
299
+    if dict['npause'] == False:
300
+        cont.activate(own.actuators['Camera']) 
301
+        controlcube['camera'] = 0    
302
+    
303
+    cur_lens = cam1.lens
304
+    cur_min = cam.min
305
+    cur_max = cam.max
306
+    #print(cur_lens)
307
+    inc = .025
308
+    if walk == 1:
309
+        #lens
310
+        if dict['walk_focal_length'] > cur_lens:
311
+            new_lens = cur_lens + inc
312
+        else:
313
+            new_lens = cur_lens - inc
314
+        if cur_lens  > (dict['walk_focal_length'] - .1) and cur_lens  < (dict['walk_focal_length'] + .1):
315
+            new_lens = dict['walk_focal_length']  
316
+            
317
+        #distance      
318
+        inc = .025   
319
+        if cur_min > (dict['cam_walk_min'] - inc):
320
+            new_min = cur_min - inc
321
+        if cur_min < (dict['cam_walk_min'] + inc):
322
+            new_min = cur_min + inc 
323
+        if cur_max > (dict['cam_walk_max'] - inc):
324
+            new_max = cur_min - inc
325
+        if cur_max < (dict['cam_walk_max'] + inc):
326
+            new_max = cur_min + inc           
327
+    else:
328
+        #lens
329
+        if dict['focal_length'] > cur_lens:
330
+            new_lens = cur_lens + inc
331
+        else:
332
+            new_lens = cur_lens - inc 
333
+        if cur_lens  > (dict['focal_length'] - .1) and cur_lens  < (dict['focal_length'] + .1):
334
+            new_lens = dict['focal_length'] 
335
+            
336
+        #distance  
337
+        inc = .025   
338
+        if cur_min > (dict['cam_min'] - inc):
339
+            new_min = cur_min - inc
340
+        if cur_min < (dict['cam_min'] + inc):
341
+            new_min = cur_min + inc 
342
+        if cur_max > (dict['cam_max'] - inc):
343
+            new_max = cur_min - inc
344
+        if cur_max < (dict['cam_max'] + inc):
345
+            new_max = cur_min + inc        
346
+            
347
+        
348
+            
349
+                                         
350
+        
351
+    focallength = new_lens
352
+    cam1.lens = focallength
353
+    cam2.lens = focallength
354
+    cam3.lens = focallength
355
+    try:
356
+        cam.min = new_min
357
+        cam.max = new_max  
358
+        #print(new_min, new_max)     
359
+    except:
360
+        pass    
361
+    
362
+                    
363
+main()

+ 143
- 0
config_sample.ini View File

@@ -0,0 +1,143 @@
1
+#shuvit settings configuration file
2
+
3
+#debug
4
+######
5
+
6
+#show framerate
7
+framerate = 0
8
+#show profile
9
+profile = 0
10
+#----------
11
+
12
+#resolution
13
+###########
14
+
15
+resx = 1920
16
+resy = 1080
17
+fullscreen_on = 1
18
+music_player = 0
19
+#----------
20
+
21
+#level
22
+######
23
+level = warehouse
24
+#------------
25
+
26
+#replay recorder
27
+###############
28
+
29
+recorder_on = 1
30
+#--------------
31
+
32
+#camera 
33
+#######
34
+cam_height = -0.4
35
+focal_length = 10
36
+cam_min = 1.4
37
+cam_max = 2.0
38
+cch_targetHeight = 0.5
39
+
40
+
41
+#character settings
42
+###################
43
+
44
+character = becky
45
+
46
+shirt_logo = 1
47
+
48
+shirt_color_r = 0.35
49
+shirt_color_g = 0
50
+shirt_color_b = 0
51
+
52
+shoe_color_r = 0.23
53
+shoe_color_g = 0
54
+shoe_color_b = 0
55
+#-----------------
56
+
57
+#deck settings
58
+##############
59
+deck_index = 2
60
+deck_color_r = 1
61
+deck_color_g = 1.0
62
+deck_color_b = 1
63
+trucks_r = 0
64
+trucks_g = 0.53
65
+trucks_b = 0
66
+
67
+wheel1_r = 0.08
68
+wheel1_g = 0.08
69
+wheel1_b = 0.08
70
+wheel2_r = 0.08
71
+wheel2_g = 0.08
72
+wheel2_b = 0.08
73
+wheel3_r = 0.08
74
+wheel3_g = 0.08
75
+wheel3_b = 0.08
76
+wheel4_r = 0.08
77
+wheel4_g = 0.08
78
+wheel4_b = 0.08
79
+#-------------------
80
+
81
+#2d filter settings
82
+###################
83
+
84
+#brightness / contrast
85
+bc = 1
86
+BC_BRIGHTNESS = 1.3
87
+BC_CONTRAST = 1.0
88
+
89
+#HDR
90
+hdr = 1
91
+avgL = 0.7
92
+HDRamount = 0.65
93
+
94
+#Ambient Occlusion
95
+ao = 1
96
+onlyAO = 0
97
+aowidth = 1.0
98
+aoradius = 16
99
+
100
+#Depth of Field
101
+dof_on = 1
102
+
103
+#Bloom
104
+bloom_on = 1
105
+
106
+#FXAA
107
+fxaa = 1
108
+FXAA_SPAN_MAX = 8.0
109
+#-------------------
110
+
111
+#sun settings
112
+#############
113
+sun_strength = 0.9
114
+ambient_strength = 0.2
115
+sun_rot_x = -0.05
116
+sun_rot_y = -0.05
117
+shadow_on = 0
118
+#------------
119
+
120
+#physics
121
+########
122
+JUMPHEIGHT = 800
123
+MAX_VEL = 6.7
124
+SPEEDUP = 0.055
125
+SPEEDPUMP = 0.14#.09
126
+SPEEDPUMPFAST = 0.16#.13
127
+PUMP_SPEED_SENS = 0.4
128
+PUMP_SENS = 0.98
129
+ACCEL = 10
130
+CRUISE = 9
131
+COUNTDOWN = 20#pump and speed stuff
132
+pump_downforce = -0.1
133
+
134
+man_sens_l = 0.03
135
+man_sens_r = 0.08
136
+man_sens_side = 0.035
137
+turn_rotation = 0.02
138
+turn_addx = 0.004
139
+turn_air_rotation = 0.07
140
+grass_mult = 0.98
141
+ylimit = 0.84
142
+antibounce = -10.0
143
+gravity = -11

+ 29
- 27
controller2.py View File

@@ -187,14 +187,14 @@ def main():
187 187
 
188 188
     #setable
189 189
     MAX_VEL = dict['MAX_VEL']
190
-    SPEEDUP = .055
191
-    SPEEDPUMP = .14 #.09
192
-    SPEEDPUMPFAST = .16 #.13
193
-    PUMP_SPEED_SENS = .4
194
-    PUMP_SENS = .98
195
-    ACCEL = 10
196
-    CRUISE = 9
197
-    COUNTDOWN = 20 #pump and speed stuff
190
+    SPEEDUP = dict['SPEEDUP']
191
+    SPEEDPUMP = dict['SPEEDPUMP']
192
+    SPEEDPUMPFAST = dict['SPEEDPUMPFAST']
193
+    PUMP_SPEED_SENS = dict['PUMP_SPEED_SENS']
194
+    PUMP_SENS = dict['PUMP_SENS']
195
+    ACCEL = dict['ACCEL']
196
+    CRUISE = dict['CRUISE']
197
+    COUNTDOWN = dict['COUNTDOWN'] #pump and speed stuff
198 198
     JUMPHEIGHT = dict['JUMPHEIGHT'] #775#750
199 199
     JUMPSTRENGTH = 0
200 200
     own['flip_manual_stance'] = 0
@@ -446,7 +446,7 @@ def main():
446 446
     #check manual
447 447
     ####
448 448
     #reg
449
-    if rUD > dict['man_sens_l'] and rUD < dict['man_sens_r'] and STANCE == 0 and rLR < .035 and rLR > -.035:
449
+    if rUD > dict['man_sens_l'] and rUD < dict['man_sens_r'] and STANCE == 0 and rLR < dict['man_sens_side'] and rLR > -dict['man_sens_side']:
450 450
         timer = own["reg_manual_timer"]
451 451
         timer = timer + 1
452 452
         own["reg_manual_timer"] = timer
@@ -464,7 +464,7 @@ def main():
464 464
           
465 465
     ####   
466 466
     #fak
467
-    if rUD > dict['man_sens_l'] and rUD < dict['man_sens_r'] and STANCE == 1 and rLR < .035 and rLR > -.035:
467
+    if rUD > dict['man_sens_l'] and rUD < dict['man_sens_r'] and STANCE == 1 and rLR < dict['man_sens_side'] and rLR > -dict['man_sens_side']:
468 468
         timer = own["fak_manual_timer"]
469 469
         timer = timer + 1
470 470
         own["fak_manual_timer"] = timer
@@ -480,7 +480,7 @@ def main():
480 480
      
481 481
     #####
482 482
     #reg nmanual
483
-    if rUD < -dict['man_sens_l'] and rUD > -dict['man_sens_r'] and STANCE == 0 and rLR < .035 and rLR > -.035:
483
+    if rUD < -dict['man_sens_l'] and rUD > -dict['man_sens_r'] and STANCE == 0 and rLR < dict['man_sens_side'] and rLR > -dict['man_sens_side']:
484 484
         timer = own["reg_nmanual_timer"]
485 485
         timer = timer + 1
486 486
         own["reg_nmanual_timer"] = timer
@@ -500,7 +500,7 @@ def main():
500 500
     #####
501 501
     #fak nmanual
502 502
     #print (rUD)
503
-    if rUD < -dict['man_sens_l'] and rUD > -dict['man_sens_r'] and STANCE == 1 and rLR < .035 and rLR > -.035:
503
+    if rUD < -dict['man_sens_l'] and rUD > -dict['man_sens_r'] and STANCE == 1 and rLR < dict['man_sens_side'] and rLR > -dict['man_sens_side']:
504 504
         timer = own["fak_nmanual_timer"]
505 505
         timer = timer + 1
506 506
         own["fak_nmanual_timer"] = timer
@@ -832,7 +832,7 @@ def main():
832 832
         velocity = own['velocity']
833 833
         #switch
834 834
         local = True
835
-        downforce = -.1        
835
+        downforce = dict['pump_downforce']       
836 836
         lF_air_frame = own['lF_air_frame']
837 837
         frames_since_ground = own['framenum'] - own['lF_air_frame']     
838 838
         if linVelocity.x < MAX_VEL and linVelocity.x >= -0 and STANCE == 1 and grindHit == False and frames_since_ground > 30 and own['last_manual_v2'] == 0:            
@@ -1588,6 +1588,7 @@ def main():
1588 1588
             distance = own.getDistanceTo(gray.hitPosition)
1589 1589
             since_grind_buf = 3
1590 1590
             if gray.hitObject != None and grindDar2.triggered == False and (frame - lgf) > since_grind_buf:
1591
+                #add or colliding
1591 1592
                 if distance < .5:  
1592 1593
                     own.alignAxisToVect(gray.hitNormal, 2, .1)
1593 1594
                 elif distance >= .5 and distance < 1.75:  
@@ -1817,14 +1818,16 @@ def main():
1817 1818
         speed = 20
1818 1819
         
1819 1820
     def turn():   
1820
-        rotamt = .02
1821
+        #rotamt = .02
1822
+        rotamt = dict['turn_rotation']
1821 1823
         linVelocity2 = own.getLinearVelocity(True)
1822
-        speed = .004
1824
+        #speed = .004
1825
+        speed = dict['turn_addx']
1823 1826
         manual = 0
1824 1827
         if own['manual_v2'] == 1:     
1825 1828
             manual = 1       
1826 1829
             if abs(linVelocity.x) < 2:
1827
-                speed = .005
1830
+                speed = dict['turn_addx'] + .001
1828 1831
                 
1829 1832
         jumpstance = own['jump_stance']
1830 1833
         if lLR > turnsens or lLR < -turnsens:
@@ -1893,19 +1896,17 @@ def main():
1893 1896
                 if STANCE == 1:   
1894 1897
                     own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)        
1895 1898
              
1896
-    #air
1899
+    #air   
1897 1900
         if r_ground.triggered == False and (lLR > turnsens or dict['kb_ra'] == 2) and (grindHit == False or (manual == 1 and grindHit == True)) and own["wallride"] == None:
1898
-            rotamt = .07
1899 1901
             if STANCE == 0:
1900
-                own.applyRotation([0,0,-rotamt], 1)
1902
+                own.applyRotation([0,0,-dict['turn_air_rotation']], 1)
1901 1903
             if STANCE == 1:
1902
-                own.applyRotation([0,0,-rotamt], 1) 
1904
+                own.applyRotation([0,0,-dict['turn_air_rotation']], 1) 
1903 1905
         if r_ground.triggered == False and (lLR < -turnsens or dict['kb_la'] == 2) and (grindHit == False or (manual == 1 and grindHit == True)) and own["wallride"] == None:
1904
-            rotamt = .07
1905 1906
             if STANCE == 0:
1906
-                own.applyRotation([0,0,rotamt], 1)
1907
+                own.applyRotation([0,0,dict['turn_air_rotation']], 1)
1907 1908
             if STANCE == 1:
1908
-                own.applyRotation([0,0,rotamt], 1)                      
1909
+                own.applyRotation([0,0,dict['turn_air_rotation']], 1)                      
1909 1910
 
1910 1911
     ###########
1911 1912
     def grindsound():
@@ -2333,7 +2334,7 @@ def main():
2333 2334
         try:
2334 2335
             if 'grass' in r_ground.hitObject:
2335 2336
                 linVel = own.getLinearVelocity(True)
2336
-                linvelx = linVel.x * .98
2337
+                linvelx = linVel.x * dict['grass_mult']
2337 2338
                 own.setLinearVelocity((linvelx, linVel.y, linVel.z), 1)
2338 2339
         except:
2339 2340
             pass    
@@ -3591,7 +3592,8 @@ def main():
3591 3592
         lgf = own['last_grind_frame']
3592 3593
         frame = own['framenum']
3593 3594
         frames_since_grinding = frame - lgf
3594
-        ylimit = .84
3595
+        #ylimit = .84
3596
+        ylimit = dict['ylimit']
3595 3597
         #print(ground_since, 'ground_since')
3596 3598
         if ground_since < 20 and ground_since > 1 and grindHit == 0 and own['jump_timer'] < 40:
3597 3599
             ylimit = ylimit + ((ground_since - 15) * -.005)
@@ -3931,7 +3933,7 @@ def main():
3931 3933
         if grindHit == False:
3932 3934
             cont.deactivate(own.actuators['grindoutRight'])
3933 3935
             cont.deactivate(own.actuators['grindoutLeft'])  
3934
-        if (grindHit == True and jumping == None and sincegrinding > 20 and ground_since > 20)or own['invert_on'] == True and own['last_grind'] == 1:
3936
+        if (LAST_GRIND == True and jumping == None and sincegrinding > 20 and ground_since > 20) or own['invert_on'] == True and LAST_GRIND == 1:
3935 3937
             outloc = 0.022
3936 3938
             bsoutloc = .07
3937 3939
             bsoutvel = .1
@@ -4341,7 +4343,7 @@ def main():
4341 4343
     own["sel"] = bkBut  
4342 4344
 
4343 4345
     if r_ground.triggered and own["jump_timer"] < 20:
4344
-        force2 = [0.0, 0, -10]
4346
+        force2 = [0.0, 0, dict['antibounce']]
4345 4347
         own.applyForce(force2, True)
4346 4348
     if (grindDar == False and r_ground.triggered and own['grindTouch'] == False) or own['jump_timer'] > 40:
4347 4349
         own['grindType'] = ''

+ 4
- 1
load_char.py View File

@@ -40,7 +40,10 @@ def main(cont):
40 40
     fileName = mainDir + "characters/" + str(dict["character"]) + '.blend'    
41 41
     
42 42
     path = bge.logic.expandPath(fileName)
43
-    bge.logic.LibLoad(path, 'Scene')  
43
+    try:
44
+        bge.logic.LibLoad(path, 'Scene')  
45
+    except:
46
+        pass    
44 47
     
45 48
     fileName = mainDir + "assets/" + 'bmx_player' + '.blend'    
46 49
     

+ 12
- 12
menuV3.py View File

@@ -904,7 +904,7 @@ def endpoint(funct, motion, dict, cont):
904 904
         if motion == 'inc':
905 905
             level = "pats"
906 906
             main_empty["level"] = "pats"
907
-            own["level"] = level
907
+            dict['level'] = level
908 908
             Settings.writeSettings()
909 909
             Settings.readSettings()
910 910
             #cont.activate(own.actuators['restart']) 
@@ -917,7 +917,7 @@ def endpoint(funct, motion, dict, cont):
917 917
         if motion == 'inc':
918 918
             level = "j_scene"
919 919
             main_empty["level"] = "j_scene"
920
-            own["level"] = level
920
+            dict['level'] = level
921 921
             Settings.writeSettings()
922 922
             Settings.readSettings()
923 923
             #cont.activate(own.actuators['restart']) 
@@ -930,7 +930,7 @@ def endpoint(funct, motion, dict, cont):
930 930
         if motion == 'inc':
931 931
             level = "lot"
932 932
             main_empty["level"] = "lot"
933
-            own["level"] = level
933
+            dict['level'] = level
934 934
             Settings.writeSettings()
935 935
             Settings.readSettings()
936 936
             #cont.activate(own.actuators['restart']) 
@@ -943,7 +943,7 @@ def endpoint(funct, motion, dict, cont):
943 943
         if motion == 'inc':
944 944
             level = "train"
945 945
             main_empty["level"] = "train"
946
-            own["level"] = level
946
+            dict['level'] = level
947 947
             Settings.writeSettings()
948 948
             Settings.readSettings()
949 949
             #cont.activate(own.actuators['restart']) 
@@ -956,7 +956,7 @@ def endpoint(funct, motion, dict, cont):
956 956
         if motion == 'inc':
957 957
             level = "spine"
958 958
             main_empty["level"] = "spine"
959
-            own["level"] = level
959
+            dict['level'] = level
960 960
             Settings.writeSettings()
961 961
             Settings.readSettings()
962 962
             #cont.activate(own.actuators['restart']) 
@@ -969,7 +969,7 @@ def endpoint(funct, motion, dict, cont):
969 969
         if motion == 'inc':
970 970
             level = "warehouse"
971 971
             main_empty["level"] = "warehouse"
972
-            own["level"] = level
972
+            dict['level'] = level
973 973
             Settings.writeSettings()
974 974
             Settings.readSettings()
975 975
             #cont.activate(own.actuators['restart']) 
@@ -982,7 +982,7 @@ def endpoint(funct, motion, dict, cont):
982 982
         if motion == 'inc':
983 983
             level = "shop"
984 984
             main_empty["level"] = "shop"
985
-            own["level"] = level
985
+            dict['level'] = level
986 986
             Settings.writeSettings()
987 987
             Settings.readSettings()
988 988
             #cont.activate(own.actuators['restart']) 
@@ -993,9 +993,9 @@ def endpoint(funct, motion, dict, cont):
993 993
             
994 994
     if funct == 'SC':
995 995
         if motion == 'inc':
996
-            level = "SC"
997
-            main_empty["level"] = "SC"
998
-            own["level"] = level
996
+            level = "sc"
997
+            main_empty["level"] = "sc"
998
+            dict['level'] = level
999 999
             Settings.writeSettings()
1000 1000
             Settings.readSettings()
1001 1001
             #cont.activate(own.actuators['restart']) 
@@ -1008,7 +1008,7 @@ def endpoint(funct, motion, dict, cont):
1008 1008
         if motion == 'inc':
1009 1009
             level = "user1"
1010 1010
             main_empty["level"] = "user1"
1011
-            own["level"] = level
1011
+            dict['level'] = level
1012 1012
             Settings.writeSettings()
1013 1013
             Settings.readSettings()
1014 1014
             #cont.activate(own.actuators['restart']) 
@@ -1021,7 +1021,7 @@ def endpoint(funct, motion, dict, cont):
1021 1021
         if motion == 'inc':
1022 1022
             level = "user2"
1023 1023
             main_empty["level"] = "user2"
1024
-            own["level"] = level
1024
+            dict['level'] = level
1025 1025
             Settings.writeSettings()
1026 1026
             Settings.readSettings()
1027 1027
             #cont.activate(own.actuators['restart']) 

+ 2
- 16
npause.py View File

@@ -11,7 +11,6 @@ def main():
11 11
 
12 12
     cont = bge.logic.getCurrentController()
13 13
     scene = bge.logic.getCurrentScene()
14
-    #own = cont.owner
15 14
     dict = bge.logic.globalDict 
16 15
     
17 16
     skater = scene.objects["Char4"]
@@ -23,7 +22,6 @@ def main():
23 22
     freecam = camList["freecam"] 
24 23
     mcam = camList['Camera.003']   
25 24
     
26
-    #freecam = scene.objects['freecam']
27 25
     cube = scene.objects['control_cube.002']
28 26
     
29 27
     try:
@@ -75,13 +73,10 @@ def main():
75 73
         cont.activate(cont.actuators['empty'])
76 74
         if mcam['playback'] == False:
77 75
             cont.activate(cont.actuators['add_overlay']) 
78
-            #pass
79
-        #printplaying()
80 76
         cont.activate(cont.actuators['remove_stance'])  
81 77
         cube['camera'] = 2
82 78
         cube['camnum'] = 2 
83 79
         scene.active_camera = freecam 
84
-        #print('set freecam', scene.active_camera)
85 80
         freecam.lens = mcam['focal_length'] 
86 81
         freecam.worldPosition = mcam.worldPosition
87 82
         freecam.worldOrientation = mcam.worldOrientation                      
@@ -110,22 +105,16 @@ def main():
110 105
             if trucks.isPlayingAction(layer):    
111 106
                 trucks.stopAction(layer)
112 107
         menuV3.main(cont)                                                    
113
-        
114
-        
115
-        
108
+                
116 109
     #exit pause     
117 110
     if pause_state == 0 and last_pause == 1:
118
-        #print("unpause")
119 111
         Settings.writeSettings()
120 112
         own.restoreDynamics()
121
-        #own['camera'] = 0
122
-        #own.setlinearVelocity([0,0,0],1] 
123
-        
113
+
124 114
         if own['walk'] == False:
125 115
             cont.activate(cont.actuators['roll'])
126 116
         else:
127 117
             cont.activate(cont.actuators['walk'])    
128
-        #print("pre_pause_linvel = ", own['pre_pause_linvel'])
129 118
         try:
130 119
             own.setLinearVelocity(own['pre_pause_linvel'], 1) 
131 120
         except:
@@ -139,9 +128,6 @@ def main():
139 128
             cont.activate(cont.actuators['remove_overlay']) 
140 129
         else:
141 130
             cont.activate(cont.actuators['add_overlay'])                                   
142
-    #print(pause_state)
143 131
     dict['last_npause'] = pause_state
144
-    #print(scene.active_camera, cube['camera'])
145
-
146 132
     
147 133
 main()

+ 8
- 2
scene_init.py View File

@@ -37,7 +37,7 @@ def main():
37 37
     # set parent
38 38
     obj.setParent( parent, compound, ghost)  
39 39
   
40
-    
40
+    scene.gravity = [0,0,dict['gravity']]    
41 41
     for i in scenes:
42 42
         if i.name == "main":
43 43
             main = i
@@ -113,7 +113,13 @@ def main():
113 113
 #    if dict['shadow_on'] == 1:
114 114
 #        bge.render.setGLSLMaterialSetting("shadows", 1) 
115 115
 #    else:
116
-#        bge.render.setGLSLMaterialSetting("shadows", 0)         
116
+#        bge.render.setGLSLMaterialSetting("shadows", 0)  
117
+
118
+    if dict['music_player'] == 1:
119
+        dict['music_start'] =  True   
120
+        print('starting music') 
121
+    else:
122
+        print('not starting music', dict['music_player'])        
117 123
         
118 124
     scene.world.envLightEnergy = dict['ambient_strength']   
119 125
     

+ 10
- 8
walk.py View File

@@ -27,6 +27,7 @@ try:
27 27
     own['walk_timer'] = own['walk_timer'] +1
28 28
 except:
29 29
     own['walk_timer'] = 1
30
+    own['walk_targ_speed'] = 2.0
30 31
 
31 32
 truckon = 450
32 33
 deckon = 460
@@ -86,7 +87,7 @@ noidle = 0
86 87
 try:
87 88
     walk_inc = own['walk_inc'] 
88 89
 except:
89
-    own['walk_inc'] = .05
90
+    own['walk_inc'] = .01
90 91
     walk_inc = own['walk_inc']  
91 92
     own['walk_jump_timer'] = 0   
92 93
 if own['stair_counter'] != 0:
@@ -360,9 +361,9 @@ else:
360 361
     cont.deactivate(camobj.actuators['camUp'])     
361 362
                 
362 363
 #----------------
363
-camera.height = .01 #.9
364
-camera.min = 1.75
365
-camera.max = 2.25
364
+#camera.height = .01 #.9
365
+#camera.min = 1.75
366
+#camera.max = 2.25
366 367
 lasty = own['lasty']     
367 368
 
368 369
 def onboard():
@@ -530,7 +531,8 @@ def checkidle():
530 531
     if idle.positive:
531 532
         own["walk_idle_frame"] = 0
532 533
         cont.deactivate(camobj.actuators['idle_camRight'])  
533
-        camera.height = .5
534
+        #camera.height = .5
535
+        camera.height = dict['cam_idle_height']
534 536
     else: 
535 537
         if idle_frame == 0:
536 538
             own["walk_idle_frame"] = own["framenum"] 
@@ -538,9 +540,9 @@ def checkidle():
538 540
         
539 541
         if (diff > 700 and idle_frame != 0 and dropinCol.positive == False and own['walk'] != 0) or own['sit'] == 1:
540 542
             cont.activate(camobj.actuators['idle_camRight'])  
541
-            camera.height = .9   
542
-            camera.min = 2
543
-            camera.max = 2.50
543
+            #camera.height = .9   
544
+            #camera.min = 2
545
+            #camera.max = 2.50
544 546
             own['walk_idling'] = 1
545 547
         else:
546 548
             own['walk_idling'] = 0    

Loading…
Cancel
Save