Browse Source

12-28-17a

shuvit 6 years ago
parent
commit
687e166e67
4 changed files with 2647 additions and 25 deletions
  1. 26
    25
      controller2.py
  2. 1308
    0
      controller2b.py
  3. 1308
    0
      controller2c.py
  4. 5
    0
      test2.sh

+ 26
- 25
controller2.py View File

@@ -1,10 +1,9 @@
1
-###########################
2
-#shuvit game
3
-#open source skateboarding
4
-#shuvit.org
5
-#info@shuvit.org
6
-###########################
7
-
1
+#scale = .3
2
+#action layers
3
+#0-14 rolling
4
+#grablay = 400
5
+#fliplay = 500
6
+#grindlay = 700
8 7
 os = 'Windows'
9 8
 from sys import platform
10 9
 if platform != "win32":
@@ -2094,7 +2093,7 @@ def grind():
2094 2093
     lif = frame - own['last_invert_frame']
2095 2094
     if own['LAST_GRIND'] == False and grindHit == True:
2096 2095
         own['grindstartFrame'] = own['framenum']
2097
-    print(own['grindstartFrame'])    
2096
+    #print(own['grindstartFrame'])    
2098 2097
     if grindHit == True and own['invert_on'] == 0 and own['footplant_on'] == False and own['manual'] == 0 and lif > 40 and own['dropinTimer'] < 30:  
2099 2098
         gblend = 1    
2100 2099
         if LAST_GRIND == 0:
@@ -2878,7 +2877,7 @@ if (rTrig > 0.02 and GRAB_ON == False and r_ground.triggered == 1) or (lTrig > 0
2878 2877
 else:
2879 2878
     own["lastPump"] = False 
2880 2879
     own["Pump"] = False     
2881
-     
2880
+own['jump_stance'] = STANCE     
2882 2881
 if rUD > .02:    
2883 2882
     grindpos = own['grindpos']   
2884 2883
     jumpstance = own["jump_stance"]
@@ -2933,19 +2932,15 @@ if rUD > .02:
2933 2932
                 grindtype("fak_tailg")   
2934 2933
           
2935 2934
         
2936
-elif q5oncd > 0:
2935
+if q5oncd > 0:
2937 2936
     q5on = 0
2938 2937
     q5oncd = q5oncd - 1
2939
-    own["Q5oncd"] = q5oncd
2940
-    killact(65)
2941
-    killact(66)
2942
-    killact(67)
2943
-    killact(68) 
2938
+    own["Q5oncd"] = q5oncd 
2944 2939
     own["last_Opos"] = False
2945 2940
 #q1    
2946 2941
 if rUD < -0.070:
2947 2942
     if q2on == 0 and q8on == 0:
2948
-        #print("q1on")
2943
+        print("q1on")
2949 2944
         q1on = 1
2950 2945
         q1oncd = countdown
2951 2946
         own["Q1oncd"] = q1oncd
@@ -3001,17 +2996,21 @@ if rUD < -0.020:
3001 2996
                     grindtype("reg_noseslide")
3002 2997
                 if STANCE == 1:
3003 2998
                     grindtype("fak_noseslide")               
2999
+
3000
+if rUD > -0.020 and rUD <= .020 and LAST_GRIND == False:
3001
+    if own['grindpos'] == 'reg_5050':
3002
+        grindtype("reg_5050")
3003
+    if own['grindpos'] == 'fak_5050':
3004
+        grindtype("fak_5050")
3005
+        
3006
+    
3004 3007
    
3005
-elif q1oncd > 0:
3008
+if q1oncd > 0:
3006 3009
     q1on = 0
3007 3010
     q1oncd = q1oncd - 1
3008 3011
     own["Q1oncd"] = q1oncd
3009
-    killact(73)
3010
-    killact(74)
3011
-    killact(71)
3012
-    killact(72)
3013 3012
     own["last_nOpos"] = False   
3014
-       
3013
+#print(q1oncd)       
3015 3014
 #q7
3016 3015
 if rLR < -0.070:
3017 3016
     if q8on == 0 and q6on == 0:
@@ -3927,6 +3926,7 @@ def grind_turn():
3927 3926
         cont.deactivate(own.actuators['grindoutRight'])
3928 3927
         cont.deactivate(own.actuators['grindoutLeft'])   
3929 3928
     if grindHit == True and jumping == None and sincegrinding > 20:
3929
+    #if grindHit == True and jumping == None:
3930 3930
         outloc = 0.022
3931 3931
         bsoutloc = .07
3932 3932
         bsoutvel = .1
@@ -4314,7 +4314,8 @@ own["sel"] = bkBut
4314 4314
 if r_ground.triggered and own["jump_timer"] < 20:
4315 4315
     force2 = [0.0, 0, -10]
4316 4316
     own.applyForce(force2, True)
4317
-
4318
-if grindDar == False:
4317
+#print('grindtouch = ',  own['grindTouch'])
4318
+if grindDar == False and r_ground.triggered and own['grindTouch'] == False:
4319 4319
     own['grindType'] = ''
4320
-    
4320
+
4321
+

+ 1308
- 0
controller2b.py View File

@@ -0,0 +1,1308 @@
1
+os = 'Windows'
2
+from sys import platform
3
+if platform != "win32":
4
+ os = 'Linux'
5
+def onWindows():
6
+ return os == 'Windows'
7
+import bge
8
+import GameLogic
9
+import ctypes
10
+#import bpy
11
+import random
12
+
13
+#build global dict (move this to separate script that runs once)
14
+scene = bge.logic.getCurrentScene()
15
+objList = scene.objects
16
+
17
+reduction = 400000
18
+axisTh = 0.03 
19
+
20
+############
21
+##vibration#
22
+############
23
+## Define necessary structures
24
+#class XINPUT_VIBRATION(ctypes.Structure):
25
+#    _fields_ = [("wLeftMotorSpeed", ctypes.c_ushort), ("wRightMotorSpeed", ctypes.c_ushort)]
26
+#xinput = ctypes.windll.xinput1_3 # Load Xinput.dll
27
+## Set up function argument types and return type
28
+#XInputSetState = xinput.XInputSetState
29
+#XInputSetState.argtypes = [ctypes.c_uint, ctypes.POINTER(XINPUT_VIBRATION)]
30
+#XInputSetState.restype = ctypes.c_uint
31
+## Now we're ready to call it. Set left motor to 100%, right motor to 50%
32
+## for controller 0
33
+##vibration = XINPUT_VIBRATION(65535, 32768)
34
+##XInputSetState(0, ctypes.byref(vibration))
35
+## You can also create a helper function like this:
36
+#def set_vibration(controller, left_motor, right_motor):
37
+#    vibration = XINPUT_VIBRATION(int(left_motor * 65535), int(right_motor * 65535))
38
+#    XInputSetState(controller, ctypes.byref(vibration))  
39
+## ... and use it like so
40
+##set_vibration(0, 0.2, 0.2)
41
+################
42
+##end vibration#
43
+################
44
+
45
+
46
+cont = GameLogic.getCurrentController() 
47
+obj = bge.logic.getCurrentScene().objects
48
+char = bge.constraints.getCharacter
49
+own = cont.owner
50
+stance = own['stance']
51
+STANCE = own['stance']
52
+r_ground = cont.sensors["r_Ground"]
53
+#Sensor logic bricks connected to the python Controller  
54
+aXis = cont.sensors["sControla.001"]
55
+bUtt = cont.sensors["sControlb.001"]
56
+linvel = own.getLinearVelocity(True)
57
+lasta = own['lasta']
58
+lastx = own['lastx']
59
+last_sit = own['sit']
60
+
61
+try:
62
+    own['walk_timer'] = own['walk_timer'] +1
63
+except:
64
+    own['walk_timer'] = 1
65
+
66
+truckon = 30
67
+deckon = 30
68
+
69
+onW = onWindows()
70
+
71
+# windows stuff
72
+lar_lts = 0
73
+uad_lts = 1
74
+lt = 4 if onW else 2
75
+lar_rts = 2 if onW else 3
76
+uad_rts = 3 if onW else 4
77
+rt = 5
78
+
79
+a_but = 0 if onW else 0
80
+b_but = 1 if onW else 1
81
+x_but = 2 if onW else 2
82
+y_but = 3 if onW else 3
83
+l_bump = 9 if onW else 4
84
+r_bump = 10 if onW else 5
85
+bk_but = 4 if onW else 6
86
+st_but = 6 if onW else 7
87
+xb_but = 5 if onW else 8
88
+lts_pr = 7 if onW else 9
89
+rts_pr = 8 if onW else 10
90
+l_dp = 13 if onW else 11
91
+r_dp = 14 if onW else 12
92
+u_dp = 11 if onW else 13
93
+d_dp = 12 if onW else 14
94
+
95
+lLR = aXis.axisValues[lar_lts] / reduction
96
+lUD = aXis.axisValues[uad_lts] / reduction
97
+rLR = aXis.axisValues[lar_rts] / reduction
98
+rUD = aXis.axisValues[uad_rts] / reduction
99
+lTrig = aXis.axisValues[lt] / reduction
100
+rTrig = aXis.axisValues[rt] / reduction
101
+aBut = bUtt.getButtonStatus(a_but)
102
+bBut = bUtt.getButtonStatus(b_but)
103
+xBut = bUtt.getButtonStatus(x_but)
104
+yBut = bUtt.getButtonStatus(y_but)
105
+lBump = bUtt.getButtonStatus(l_bump)
106
+rBump = bUtt.getButtonStatus(r_bump)
107
+bkBut = bUtt.getButtonStatus(bk_but)
108
+stBut = bUtt.getButtonStatus(st_but)
109
+xbBut = bUtt.getButtonStatus(xb_but)
110
+ltsBut = bUtt.getButtonStatus(lts_pr)
111
+rtsBut = bUtt.getButtonStatus(rts_pr)
112
+ldPad = bUtt.getButtonStatus(l_dp)
113
+rdPad = bUtt.getButtonStatus(r_dp)
114
+udPad = bUtt.getButtonStatus(u_dp)
115
+ddPad = bUtt.getButtonStatus(d_dp)
116
+
117
+#user
118
+sens = .04
119
+fliplay = 30
120
+dropinCol = own.sensors['dropinCol']
121
+
122
+#no input
123
+def cutOff():
124
+    
125
+ if (abs(lLR) < axisTh 
126
+     and abs(lUD) < axisTh 
127
+     and abs(rLR) < axisTh 
128
+     and abs(rUD) < axisTh
129
+     and aBut == False):
130
+         
131
+  return True
132
+skater = scene.objects["Char4"]
133
+deck = scene.objects["deck"]
134
+trucks = scene.objects["trucks"]
135
+
136
+throw_deck_empty = scene.objects["throw_deck_empty"]
137
+wheel1 = scene.objects["rollen.000"]
138
+wheel2 = scene.objects["rollen.001"]
139
+wheel3 = scene.objects["rollen.002"]
140
+wheel4 = scene.objects["rollen.003"]
141
+camobj = scene.objects["Camera.003"]
142
+camera = cont.actuators["Camera"]
143
+replayCam = cont.actuators["replayCam"]
144
+timer = own['dropinTimer']
145
+cam = scene.objects["Camera.003"]
146
+freecam = scene.objects["freecam"]
147
+followcam = scene.objects["followcam"]
148
+
149
+noidle = 0
150
+
151
+playing_deck = deck.isPlayingAction(deckon)
152
+playing_trucks = trucks.isPlayingAction(truckon)
153
+if playing_deck == 1 or playing_trucks == 1:
154
+    noidle = 1
155
+
156
+if own["stance"] == None:
157
+    own["stance"] = True
158
+STANCE = own["stance"]
159
+def killact(layer):
160
+    if skater.isPlayingAction(layer):
161
+        skater.stopAction(layer)
162
+    if deck.isPlayingAction(layer):    
163
+        deck.stopAction(layer)
164
+    if trucks.isPlayingAction(layer):    
165
+        trucks.stopAction(layer)
166
+def killall():
167
+    for x in range(5000):
168
+        skater.stopAction(x)
169
+        deck.stopAction(x)
170
+        trucks.stopAction(x)
171
+def trucksisplaying():
172
+    for x in range(5000):
173
+        if deck.isPlayingAction(x):
174
+            print("deck is playing:", x)
175
+#trucksisplaying() 
176
+
177
+def printplaying():
178
+    splaying_layers = "S: "
179
+    playing_layers = "D: "
180
+    tplaying_layers = "T: "
181
+    for x in range(9900):
182
+        if skater.isPlayingAction(x):
183
+        #if trucks.isPlayingAction(x):
184
+        #if skater.isPlayingAction(x):                        
185
+            splaying_layers += str(x)
186
+            splaying_layers += " "        
187
+        if deck.isPlayingAction(x):
188
+        #if trucks.isPlayingAction(x):
189
+        #if skater.isPlayingAction(x):                        
190
+            playing_layers += str(x)
191
+            playing_layers += " "
192
+        if trucks.isPlayingAction(x):
193
+        #if trucks.isPlayingAction(x):
194
+        #if skater.isPlayingAction(x):                        
195
+            tplaying_layers += str(x)
196
+            tplaying_layers += " "            
197
+    print(splaying_layers, playing_layers, tplaying_layers) 
198
+#printplaying() 
199
+##
200
+if r_ground.positive and xBut == False and lastx == False:
201
+    killact(10)
202
+    #killact(11)
203
+    killact(12)
204
+    killact(13)              
205
+######################################  
206
+#walk out
207
+#print(own['walk_timer'])
208
+#if own['walk_timer'] < 5:
209
+#    
210
+#    if stance == 0 and skater.isPlayingAction(fliplay) == False:
211
+#        
212
+#        if own['throw_deck'] == True:
213
+#            print("walk out1")
214
+#            skater.playAction("reg_nwalk_nb.001", 15,35, layer=29, play_mode=0, speed=.5)
215
+#        else:
216
+#            print("walk out2")
217
+#            skater.playAction("walk.000", 15,35, layer=29, play_mode=0, speed=.5)
218
+#        deck.playAction("a_reg_walk", 0,35, layer=17, play_mode=0)
219
+#        trucks.playAction("a_reg_walk", 0,35, layer=17, play_mode=0)    
220
+    
221
+
222
+#idle      
223
+if stance == 0 and skater.isPlayingAction(fliplay) == False and yBut == False and r_ground.triggered and xBut == False and noidle == 0 and own['walk_idling'] == 0 and own['sit'] == 0:
224
+    own['requestAction'] = 'reg_idle'
225
+    if own['throw_deck'] == True:
226
+        own['requestAction'] = 'reg_idle_nb'
227
+        skater.playAction("reg_idle1", 1,120, layer=3, play_mode=1, speed=.5)
228
+    else:
229
+        #cont.activate(skater.actuators['aRest'])
230
+        skater.playAction("reg_idle1", 1,120, layer=3, play_mode=1, speed=.5)
231
+        deck.playAction("a_reg_idle1", 1,120, layer=3, play_mode=1, speed=.5)
232
+        trucks.playAction("a_reg_idle1", 1,120, layer=3, play_mode=1, speed=.5) 
233
+if stance == 1 and skater.isPlayingAction(fliplay) == False and yBut == False and r_ground.triggered and xBut == False and noidle == 0 and own['walk_idling'] == 0 and own['sit'] == 0:
234
+    own['requestAction'] = 'fak_idle'
235
+    if own['throw_deck'] == True:
236
+        own['requestAction'] = 'fak_idle_nb'
237
+        skater.playAction("fak_idle1", 1,120, layer=3, play_mode=1, speed=.5)
238
+    else:
239
+        #cont.activate(skater.actuators['aRest'])
240
+        skater.playAction("fak_idle1", 1,120, layer=3, play_mode=1, speed=.5)
241
+        deck.playAction("a_fak_idle1", 1,120, layer=3, play_mode=1, speed=.5)
242
+        trucks.playAction("a_fak_idle1", 1,120, layer=3, play_mode=1, speed=.5) 
243
+
244
+if lUD < -sens:
245
+    lup = 1
246
+else:
247
+    lup = 0
248
+if lUD > sens:
249
+    ldown = 1
250
+else:
251
+    ldown = 0    
252
+    
253
+#walking
254
+
255
+#new walking
256
+#if (lup == 1 and aBut == 0 and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0):
257
+vel = own.getLinearVelocity(True)
258
+if own['walk_timer'] < 50:
259
+    velx = vel.x * .95             
260
+    own.setLinearVelocity([velx, 0, vel.z], True)
261
+else:
262
+    own.setLinearVelocity([0, 0, vel.z], True)
263
+    #print("set 0 vel")
264
+    
265
+if (lup == 1 and aBut == 0 and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0):    
266
+    own['walking'] = "regular"
267
+    walking = "regular"
268
+elif lup == 1 and aBut == 1 and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0:
269
+    own['walking'] = "fast"
270
+    walking = "fast"
271
+else:
272
+    own['walking'] = None
273
+    walking = None
274
+#print(own['walk_timer'])    
275
+if walking == "regular":
276
+    cont.deactivate(own.actuators['forward2']) 
277
+    cont.deactivate(own.actuators['backward2'])    
278
+    if stance == 0:
279
+        cont.activate(own.actuators['forward'])
280
+    else:
281
+        cont.activate(own.actuators['backward'])
282
+if walking == "fast":
283
+    cont.deactivate(own.actuators['forward']) 
284
+    cont.deactivate(own.actuators['backward'])    
285
+    if stance == 0:
286
+        cont.activate(own.actuators['forward2'])
287
+    else:
288
+        cont.activate(own.actuators['backward2'])            
289
+        
290
+
291
+if walking == None:
292
+    cont.deactivate(own.actuators['forward2']) 
293
+    cont.deactivate(own.actuators['backward2'])
294
+    cont.deactivate(own.actuators['forward']) 
295
+    cont.deactivate(own.actuators['backward'])        
296
+    if own['walk_timer'] < 50:
297
+        velx = vel.x * .95             
298
+        own.setLinearVelocity([velx, 0, vel.z], True)
299
+    else:
300
+        own.setLinearVelocity([0, 0, vel.z], True)
301
+        #print("set 0 vel")    
302
+                
303
+    
304
+#old walking
305
+if (lup == 1 and aBut == 0 and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0):
306
+    own.actuators["walkondirt"].volume = .2
307
+    own.actuators["walkondirt"].pitch = 1
308
+    cont.activate(own.actuators["walkondirt"])
309
+    if lasta == 1:
310
+        #cont.deactivate(own.actuators['forward2']) 
311
+        #cont.deactivate(own.actuators['backward2'])
312
+        killact(6)
313
+        killact(7)
314
+        killact(8)
315
+        killact(9)
316
+        killact(17)
317
+        killact(18)                
318
+    if stance == 0 and skater.isPlayingAction(fliplay) == False:             
319
+        #cont.activate(own.actuators['forward'])
320
+        #cont.activate(skater.actuators['aWalk'])
321
+        #cont.activate(deck.actuators['a_reg_walk'])
322
+        #cont.activate(deck.actuators['a_reg_walk'])
323
+        #without deck
324
+        if own['throw_deck'] == True:
325
+            own['requestAction'] = 'reg_walk_nb'
326
+            #skater.playAction("reg_nwalk_nb.001", 0,35, layer=24, play_mode=1, speed=.5)
327
+        else:
328
+            own['requestAction'] = 'reg_walk'
329
+#            skater.playAction("reg_nwalk", 0,35, layer=24, play_mode=1, speed=.5)
330
+#        deck.playAction("a_reg_nwalk", 0,35, layer=16, play_mode=1, speed=.5)
331
+#        trucks.playAction("a_reg_nwalk", 0,35, layer=16, play_mode=1, speed=.5)
332
+        killact(25) 
333
+        killact(305)
334
+        killact(306)                
335
+    if stance == 1 and skater.isPlayingAction(fliplay) == False:        
336
+        #cont.activate(own.actuators['backward'])
337
+        #cont.activate(skater.actuators['aWalk_fak'])
338
+        #cont.activate(deck.actuators['a_fak_walk'])
339
+        #cont.activate(trucks.actuators['a_fak_walk'])
340
+        #without deck
341
+        if own['throw_deck'] == True:
342
+            own['requestAction'] = 'fak_walk_nb'
343
+            #skater.playAction("fak_nwalk_nb.001", 0,35, layer=25, play_mode=1, speed=.5)
344
+        else:
345
+            own['requestAction'] = 'fak_walk'
346
+#            skater.playAction("fak_nwalk", 0,35, layer=25, play_mode=1, speed=.5)    
347
+#        deck.playAction("a_fak_nwalk", 0,35, layer=15, play_mode=1, speed=.5)
348
+#        trucks.playAction("a_fak_nwalk", 0,35, layer=15, play_mode=1, speed=.5)        
349
+elif lup == 1 and aBut == 1 and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0:
350
+    own.actuators["walkondirt"].volume = .2
351
+    own.actuators["walkondirt"].pitch = 1.3
352
+    cont.activate(own.actuators["walkondirt"])
353
+    if stance == 0 and skater.isPlayingAction(fliplay) == False:        
354
+        #cont.activate(own.actuators['forward2'])
355
+        #cont.activate(skater.actuators['aWalk'])
356
+        if own['throw_deck'] == True:
357
+            own['requestAction'] = 'reg_walkFast_nb'
358
+            skater.playAction("reg_nwalk_nb.001", 0,35, layer=25, play_mode=1, speed=1)
359
+        else:
360
+            own['requestAction'] = 'reg_walkFast'
361
+#            skater.playAction("reg_nwalk", 0,35, layer=25, play_mode=1, speed=1)         
362
+#        
363
+#        deck.playAction("a_reg_nwalk", 0,35, layer=305, play_mode=1, speed=1)
364
+#        trucks.playAction("a_reg_nwalk", 0,35, layer=306, play_mode=1, speed=1)
365
+    else:
366
+        killact(25) 
367
+        killact(305)
368
+        killact(306)           
369
+    if stance == 1 and skater.isPlayingAction(fliplay) == False:        
370
+        #cont.activate(own.actuators['backward2'])
371
+        #cont.activate(skater.actuators['aWalk_fak'])
372
+        if own['throw_deck'] == True:
373
+            own['requestAction'] = 'fak_walkFast_nb'
374
+            skater.playAction("fak_nwalk_nb.001", 0,35, layer=24, play_mode=1, speed=1)           
375
+        else:
376
+            own['requestAction'] = 'fak_walkFast'
377
+#            skater.playAction("fak_nwalk", 0,35, layer=24, play_mode=1, speed=1)                       
378
+#        deck.playAction("a_fak_nwalk", 0,35, layer=15, play_mode=1, speed=1)
379
+#        trucks.playAction("a_fak_nwalk", 0,35, layer=15, play_mode=1, speed=1)             
380
+else:
381
+    vel = own.getLinearVelocity(True)
382
+    cont.deactivate(own.actuators["walkondirt"])
383
+    if stance == 0:
384
+        #cont.deactivate(own.actuators['forward'])
385
+        #cont.deactivate(own.actuators['forward2'])
386
+        cont.deactivate(skater.actuators['aWalk'])
387
+        cont.deactivate(deck.actuators['a_reg_walk'])
388
+        cont.deactivate(trucks.actuators['a_reg_walk'])        
389
+        killact(4)
390
+        killact(5)
391
+        killact(6)
392
+        killact(7)
393
+        killact(15)
394
+        killact(16)
395
+        killact(17)
396
+        killact(18)
397
+        killact(24)
398
+        killact(25) 
399
+        killact(305)
400
+        killact(306)         
401
+#        if own['walk_timer'] < 50:
402
+#            velx = vel.x * .95             
403
+#            #own.setLinearVelocity([velx, 0, vel.z], True)
404
+#            
405
+#        else:
406
+#            if r_ground.triggered:
407
+#                own.setLinearVelocity([0, 0, vel.z], True)
408
+#            #velz = vel.z
409
+#            #print(velz)
410
+#            #own.localLinearVelocity[0, 0, velz]
411
+    if stance == 1:
412
+        #cont.deactivate(own.actuators['backward'])
413
+        #cont.deactivate(own.actuators['backward2'])
414
+        cont.deactivate(skater.actuators['aWalk_fak'])
415
+        cont.deactivate(deck.actuators['a_fak_walk'])
416
+        cont.deactivate(trucks.actuators['a_fak_walk'])        
417
+        killact(4)
418
+        killact(5)
419
+        killact(6)
420
+        killact(7)
421
+        killact(15)
422
+        killact(16)
423
+        killact(17)
424
+        killact(18)
425
+        killact(24)
426
+        killact(25) 
427
+        killact(305)
428
+        killact(306)             
429
+#        if own['walk_timer'] < 50:
430
+#            velx = vel.x * .95             
431
+#            #own.setLinearVelocity([velx, 0, vel.z], True)
432
+#        else:
433
+#            own.setLinearVelocity([0, 0, vel.z], True)
434
+#in air        
435
+if lup == 1 and r_ground.positive == False:
436
+    
437
+    if stance == 0:
438
+        cont.deactivate(own.actuators['forward'])
439
+        cont.deactivate(own.actuators['forward2'])
440
+        cont.deactivate(skater.actuators['aWalk'])
441
+        killact(4)
442
+        killact(5)
443
+        killact(6)
444
+        killact(7)        
445
+        velx = linvel.x - 1
446
+        own.setLinearVelocity([-1.5, linvel.y, linvel.z], 1)
447
+        #cont.activate(own.actuators['forward2'])
448
+    if stance == 1:    
449
+        cont.deactivate(own.actuators['backward'])
450
+        cont.deactivate(own.actuators['backward2'])
451
+        cont.deactivate(skater.actuators['aWalk_fak'])
452
+        killact(4)
453
+        killact(5)
454
+        killact(6)
455
+        killact(7)        
456
+        velx = linvel.x + 1
457
+        own.setLinearVelocity([1.5, linvel.y, linvel.z], 1) 
458
+        #cont.activate(own.actuators['backward2'])       
459
+#---------------
460
+if rLR > .05:
461
+    cont.activate(camobj.actuators['camRight'])
462
+else:
463
+    cont.deactivate(camobj.actuators['camRight'])    
464
+if rLR < -.05:
465
+    cont.activate(camobj.actuators['camLeft'])
466
+else:
467
+    cont.deactivate(camobj.actuators['camLeft'])     
468
+if rUD > .05:
469
+    cont.activate(camobj.actuators['camDown'])
470
+else:
471
+    cont.deactivate(camobj.actuators['camDown'])     
472
+if rUD < -.05:
473
+    cont.activate(camobj.actuators['camUp'])
474
+else:
475
+    cont.deactivate(camobj.actuators['camUp'])     
476
+                
477
+#----------------
478
+camera.height = .9 #-.4
479
+camera.min = 1.5
480
+camera.max = 2
481
+#camera.object = "Char4:Mhair01"
482
+#camera.damping = 0
483
+#camera.axis = 4 
484
+lasty = own['lasty']     
485
+#if yBut == False and lasty == True:
486
+
487
+#    if own['walk'] == 1: 
488
+#        killact(fliplay) 
489
+        #killall() 
490
+    #camera.damping = 0     
491
+    #camera.axis = 4            
492
+#print(stance)
493
+
494
+
495
+def onboard():
496
+#    pass
497
+    if own['walk'] == 0:
498
+        print("start walking")
499
+        if own['framenum'] > 100 and own['fall'] == False:
500
+            #pass
501
+            cont.activate(own.actuators['pop'])
502
+        own['getoffboard'] = False
503
+        #set_vibration(0, 0.0, 0.0)
504
+        fliplay = 301
505
+        fliplay2 = 302 
506
+        fliplay3 = 303
507
+        try:
508
+            vel = own['offboard_vel']
509
+            #velx = vel.x *2
510
+            vel = [velx, vel.y, vel.z]
511
+            #vel = vel * 4
512
+            #vel = [-100, 0, 0]
513
+            #print(vel)
514
+            #own.localLinearVelocity = vel
515
+            #JUMPHEIGHT = 1100
516
+            #force = [600, 0.0, 10]
517
+            # use local axis
518
+            #local = True
519
+            # apply force
520
+            #own.applyForce(force, local)            
521
+        except: 
522
+            pass
523
+         
524
+        if STANCE == 0:
525
+            #killact(3)
526
+            #killact(4)
527
+            killall()
528
+            skater.stopAction(fliplay)
529
+            deck.stopAction(deckon)
530
+            trucks.stopAction(truckon)             
531
+#            skater.playAction("nreg_offboard", 1,30, layer=fliplay, priority=0, play_mode=0, speed=1.5)
532
+#            deck.playAction("a_reg_offboard", 1,30, layer=deckon, priority=0, play_mode=0, speed=1.5)
533
+#            trucks.playAction("c_reg_offboard", 1,30, layer=truckon, priority=0, play_mode=0, speed=1.5)
534
+            skater.playAction("reg_noffboard", 0,26, layer=fliplay, priority=0, play_mode=0, speed=.5)
535
+            deck.playAction("a_reg_noffboard", 0,26, layer=deckon, priority=0, play_mode=0, speed=.5)
536
+            trucks.playAction("a_reg_noffboard", 0,26, layer=truckon, priority=0, play_mode=0, speed=.5)            
537
+        if STANCE == 1:
538
+            killact(3)
539
+            killact(4)
540
+            killall()
541
+            skater.stopAction(fliplay)
542
+            deck.stopAction(deckon)
543
+            trucks.stopAction(truckon)             
544
+            skater.playAction("nfak_offboard", 1,30, layer=fliplay, priority=0, play_mode=0, speed=1.5)
545
+            deck.playAction("a_fak_offboard", 1,30, layer=deckon, priority=0, play_mode=0, speed=1.5)
546
+            trucks.playAction("a_fak_offboard", 1,30, layer=truckon, priority=0, play_mode=0, speed=1.5)             
547
+def jump():
548
+    if xBut == True:
549
+        if own['lastx'] == 0:
550
+            killact(3)
551
+            killact(4)
552
+            killact(5)
553
+            killact(6)
554
+            killact(7) 
555
+            #why does this layer have to be so high?      
556
+            if STANCE == 0:  
557
+                own['requestAction'] ='reg_jump'   
558
+#                skater.playAction("reg_jump", 1,35, layer=400, priority=0, play_mode=0, speed=.5)
559
+#                deck.playAction("a_reg_jump2", 1,35, layer=400, priority=0, play_mode=0, speed=.5)
560
+#                trucks.playAction("a_reg_jump2", 1,35, layer=400, priority=0, play_mode=0, speed=.5)
561
+            if STANCE == 1:
562
+                own['requestAction'] ='fak_jump'
563
+                #skater.playAction("fak_jump", 1,35, layer=400, priority=0, play_mode=0, speed=.5)    
564
+            #deck.playAction("a_reg_jump", 1,30, layer=11, play_mode=0, speed=.5)
565
+            #trucks.playAction("a_reg_jump", 1,30, layer=12, priority=0, play_mode=0, speed=1)             
566
+            JUMPHEIGHT = 1100
567
+            force = [ 0.0, 0.0, JUMPHEIGHT]
568
+            # use local axis
569
+            local = False
570
+            # apply force
571
+            own.applyForce(force, local)
572
+        own['lastx'] = 1
573
+    else:
574
+        own['lastx'] = 0
575
+def dropin():
576
+    if dropinCol.positive == True:
577
+        #print("DROPIN") 
578
+        pass       
579
+        
580
+def getonboard():
581
+    getonboard = own['getonboard']
582
+    fliplay2 = 50#8560
583
+    if yBut == True:
584
+        #camera.height = -.4
585
+        #camera.min = 1.5
586
+        #camera.max = 2 #2
587
+        #camera.damping = .99
588
+        #camera.axis = 0
589
+        
590
+        #cont.deactivate(cam.actuators['replayCam'])
591
+        #cont.deactivate(cam.actuators['Camera'])
592
+        #camera.height = 10 #-.5
593
+        #print("high cam")
594
+        #camera.min = .75
595
+        #camera.max = 1.25
596
+        #cont.activate(cam.actuators['Camera']) 
597
+        
598
+        deckact = deck.actuators["Visibility"]
599
+        trucksact = trucks.actuators["Visibility"]
600
+        wheel1act = wheel1.actuators["Visibility"]
601
+        wheel2act = wheel2.actuators["Visibility"]
602
+        wheel3act = wheel3.actuators["Visibility"]
603
+        wheel4act = wheel4.actuators["Visibility"]        
604
+        deckact.visibility = True
605
+        trucksact.visibility = True
606
+        wheel1act.visibility = True
607
+        wheel2act.visibility = True
608
+        wheel3act.visibility = True
609
+        wheel4act.visibility = True  
610
+        cont.activate(deck.actuators['Visibility'])
611
+        cont.activate(trucks.actuators['Visibility'])
612
+        cont.activate(wheel1.actuators['Visibility'])
613
+        cont.activate(wheel2.actuators['Visibility'])
614
+        cont.activate(wheel3.actuators['Visibility'])
615
+        cont.activate(wheel4.actuators['Visibility']) 
616
+        own['throw_deck'] = False 
617
+        throw_deck_empty = scene.objects["throw_deck_empty"]
618
+        throw_deck_empty['kill_deck'] = 1 
619
+        fliplay3 = fliplay2 + 1  
620
+        if STANCE == 0 and dropinCol.positive == True: 
621
+            cont.deactivate(skater.actuators['aRest'])
622
+            cont.deactivate(skater.actuators['aRest_fak'])
623
+            killact(4)
624
+            killact(5)
625
+            killact(6)
626
+            killact(7)                        
627
+            skater.playAction("nreg_dropin", 50,60, layer=fliplay2, priority=0, play_mode=1, speed=.5)
628
+            deck.playAction("a_reg_dropin", 50,60, layer=fliplay2, priority=0, play_mode=1, speed=.5)
629
+            trucks.playAction("a_reg_dropin", 50,60, layer=fliplay2, priority=0, play_mode=1, speed=.5)
630
+            if lasty == False:
631
+                skater.playAction("nreg_dropin", 30,50, layer=fliplay3, priority=0, play_mode=0, speed=.75)
632
+                deck.playAction("a_reg_dropin", 30,50, layer=fliplay3, priority=0, play_mode=0, speed=.75)
633
+                trucks.playAction("a_reg_dropin", 30,50, layer=fliplay3, priority=0, play_mode=0, speed=.75)                
634
+                
635
+        if STANCE == 1 and dropinCol.positive == True: 
636
+            cont.deactivate(skater.actuators['aRest'])
637
+            cont.deactivate(skater.actuators['aRest_fak'])
638
+            killact(4)
639
+            killact(5)
640
+            killact(6)
641
+            killact(7)                        
642
+            skater.playAction("nfak_dropin", 50,60, layer=fliplay2, priority=0, play_mode=1, speed=.5)
643
+            deck.playAction("a_fak_dropin", 50,60, layer=fliplay2, priority=0, play_mode=1, speed=.5)
644
+            trucks.playAction("a_fak_dropin", 50,60, layer=fliplay2, priority=0, play_mode=1, speed=.5)
645
+            if lasty == False:
646
+                skater.playAction("nfak_dropin", 30,50, layer=fliplay3, priority=0, play_mode=0, speed=.75)
647
+                deck.playAction("a_fak_dropin", 30,50, layer=fliplay3, priority=0, play_mode=0, speed=.75)
648
+                trucks.playAction("a_fak_dropin", 30,50, layer=fliplay3, priority=0, play_mode=0, speed=.75)                      
649
+    if getonboard == 1:
650
+        fliplay3 = 6000 
651
+        onboard_speed = .1   
652
+#        if STANCE == 1:
653
+#            skater.playAction("nfak_dropin", 60,80, layer=fliplay3, priority=0, play_mode=0, speed=onboard_speed)
654
+#            deck.playAction("a_fak_dropin", 60,80, layer=fliplay3, priority=0, play_mode=0, speed=onboard_speed)
655
+#            trucks.playAction("a_fak_dropin", 60,80, layer=fliplay3, priority=0, play_mode=0, speed=onboard_speed)
656
+#        if STANCE == 0:
657
+#            skater.playAction("nreg_dropin", 60,80, layer=fliplay3, priority=0, play_mode=0, speed=onboard_speed)
658
+#            deck.playAction("a_reg_dropin", 60,80, layer=fliplay3, priority=0, play_mode=0, speed=onboard_speed)
659
+#            trucks.playAction("a_reg_dropin", 60,80, layer=fliplay3, priority=0, play_mode=0, speed=onboard_speed)                                    
660
+        own['getonboard'] = 0 
661
+    if yBut == False and lasty == True:
662
+        own['getonboard'] = 1
663
+        #camera.height = -.5
664
+        #camera.min = .75
665
+        #camera.max = 1.25         
666
+
667
+def nextframe():
668
+    framenumber = own["framenum"]
669
+    framenumber = framenumber + 1
670
+    if framenumber == 900000:
671
+        framenumber = 0
672
+    own["framenum"] = framenumber
673
+    own['last_walk_frame'] = framenumber
674
+            
675
+def checkidle():
676
+    idle = cont.sensors["idle"]
677
+    #print(idle.positive)
678
+    idle_frame = own["walk_idle_frame"]
679
+    if idle.positive:
680
+        own["walk_idle_frame"] = 0
681
+        cont.deactivate(camobj.actuators['idle_camRight'])  
682
+        camera.height = .5
683
+    else: 
684
+        if idle_frame == 0:
685
+            own["walk_idle_frame"] = own["framenum"] 
686
+        diff = own["framenum"] - idle_frame
687
+        
688
+        if (diff > 700 and idle_frame != 0 and dropinCol.positive == False and own['walk'] != 0) or own['sit'] == 1:
689
+            #print("you are idle", diff)  
690
+            cont.activate(camobj.actuators['idle_camRight'])  
691
+            camera.height = .9   
692
+            camera.min = 2
693
+            camera.max = 2.50
694
+            own['walk_idling'] = 1
695
+        else:
696
+            own['walk_idling'] = 0    
697
+            
698
+def idle_anim():
699
+    if own['walk_idling'] == 1 and own['sit'] == 0:
700
+        walk_idle_frame = own['walk_idle_frame']
701
+        #print("walk_idling")
702
+        mod_num = (own["framenum"] - walk_idle_frame) % 240
703
+        #print(walk_idle_frame, mod_num)
704
+        #killact(3)
705
+        if mod_num == 0:
706
+            if own['idle_skipper'] > 0:
707
+               own['idle_skipper'] -= 1 
708
+            ran_num = random.randint(1, 8)
709
+            #print(ran_num, "modding")
710
+            if own['last_idle_num'] == ran_num:
711
+                ran_num = 1
712
+            if own['idle_skipper'] == 0:
713
+                own['last_idle_num'] = ran_num
714
+                if ran_num == 1 or ran_num > 7:    
715
+                    killact(3)
716
+                    if STANCE == 0 and own['throw_deck'] == 0:
717
+                        skater.playAction("reg_idle1", 1,120, layer=3, play_mode=0, speed=.5)
718
+                        deck.playAction("a_reg_idle1", 1,120, layer=3, play_mode=0, speed=.5)
719
+                        trucks.playAction("a_reg_idle1", 1,120, layer=3, play_mode=0, speed=.5)
720
+                    elif STANCE == 0 and own['throw_deck'] == 1:
721
+                        skater.playAction("reg_idle1", 1,120, layer=3, play_mode=0, speed=.5)
722
+                    elif STANCE == 1 and own['throw_deck'] == 0:
723
+                        skater.playAction("fak_idle1", 1,120, layer=3, play_mode=0, speed=.5)
724
+                        deck.playAction("a_fak_idle1", 1,120, layer=3, play_mode=0, speed=.5)
725
+                        trucks.playAction("a_fak_idle1", 1,120, layer=3, play_mode=0, speed=.5) 
726
+                    elif STANCE == 1 and own['throw_deck'] == 1:
727
+                        skater.playAction("fak_idle1", 1,120, layer=3, play_mode=0, speed=.5)
728
+                                                                           
729
+                elif ran_num == 2:    
730
+                    killact(3)
731
+                    if STANCE == 0 and own['throw_deck'] == 0:
732
+                        skater.playAction("reg_idle2_", 1,120, layer=3, play_mode=0, speed=.5)
733
+                        deck.playAction("a_reg_idle2", 1,120, layer=3, play_mode=0, speed=.5)
734
+                        trucks.playAction("a_reg_idle2", 1,120, layer=3, play_mode=0, speed=.5)
735
+                    elif STANCE == 0 and own['throw_deck'] == 1:
736
+                        skater.playAction("reg_idle2_nb", 1,120, layer=3, play_mode=0, speed=.5)
737
+                    elif STANCE == 1 and own['throw_deck'] == 0:
738
+                        skater.playAction("fak_idle1", 1,120, layer=3, play_mode=0, speed=.5)
739
+                        deck.playAction("a_fak_idle1", 1,120, layer=3, play_mode=0, speed=.5)
740
+                        trucks.playAction("a_fak_idle1", 1,120, layer=3, play_mode=0, speed=.5) 
741
+                    elif STANCE == 1 and own['throw_deck'] == 1:
742
+                        skater.playAction("fak_idle1", 1,120, layer=3, play_mode=0, speed=.5)  
743
+                elif ran_num == 3:    
744
+                    killact(3)
745
+                    if STANCE == 0 and own['throw_deck'] == 0:
746
+                        skater.playAction("reg_idle3", 1,240, layer=3, play_mode=0, speed=.5)
747
+                        deck.playAction("a_reg_idle3", 1,240, layer=3, play_mode=0, speed=.5)
748
+                        trucks.playAction("a_reg_idle3", 1,240, layer=3, play_mode=0, speed=.5)
749
+                    elif STANCE == 0 and own['throw_deck'] == 1:
750
+                        skater.playAction("reg_idle3", 1,240, layer=3, play_mode=0, speed=.5)
751
+                    elif STANCE == 1 and own['throw_deck'] == 0:
752
+                        skater.playAction("fak_idle1", 1,240, layer=3, play_mode=0, speed=.5)
753
+                        deck.playAction("a_fak_idle1", 1,240, layer=3, play_mode=0, speed=.5)
754
+                        trucks.playAction("a_fak_idle1", 1,240, layer=3, play_mode=0, speed=.5) 
755
+                    elif STANCE == 1 and own['throw_deck'] == 1:
756
+                        skater.playAction("fak_idle1", 1,240, layer=3, play_mode=0, speed=.5)
757
+                    own['idle_skipper'] = 2 
758
+                elif ran_num == 4:    
759
+                    killact(3)
760
+                    if STANCE == 0 and own['throw_deck'] == 0:
761
+                        skater.playAction("reg_idle4", 1,120, layer=3, play_mode=0, speed=.5)
762
+                        deck.playAction("a_reg_idle4", 1,120, layer=3, play_mode=0, speed=.5)
763
+                        trucks.playAction("a_reg_idle4", 1,120, layer=3, play_mode=0, speed=.5)
764
+                    elif STANCE == 0 and own['throw_deck'] == 1:
765
+                        skater.playAction("reg_idle4", 1,120, layer=3, play_mode=0, speed=.5)
766
+                    elif STANCE == 1 and own['throw_deck'] == 0:
767
+                        skater.playAction("fak_idle4", 1,120, layer=3, play_mode=0, speed=.5)
768
+                        deck.playAction("a_fak_idle4", 1,120, layer=3, play_mode=0, speed=.5)
769
+                        trucks.playAction("a_fak_idle4", 1,120, layer=3, play_mode=0, speed=.5) 
770
+                    elif STANCE == 1 and own['throw_deck'] == 1:
771
+                        skater.playAction("fak_idle4", 1,120, layer=3, play_mode=0, speed=.5) 
772
+                elif ran_num == 5:    
773
+                    killact(3)
774
+                    if STANCE == 0 and own['throw_deck'] == 0:
775
+                        skater.playAction("reg_idle5", 1,120, layer=3, play_mode=0, speed=.5)
776
+                        deck.playAction("a_reg_idle5", 1,120, layer=3, play_mode=0, speed=.5)
777
+                        trucks.playAction("a_reg_idle5", 1,120, layer=3, play_mode=0, speed=.5)
778
+                    elif STANCE == 0 and own['throw_deck'] == 1:
779
+                        skater.playAction("reg_idle5", 1,120, layer=3, play_mode=0, speed=.5)
780
+                    elif STANCE == 1 and own['throw_deck'] == 0:
781
+                        skater.playAction("fak_idle5", 1,120, layer=3, play_mode=0, speed=.5)
782
+                        deck.playAction("a_fak_idle5", 1,120, layer=3, play_mode=0, speed=.5)
783
+                        trucks.playAction("a_fak_idle5", 1,120, layer=3, play_mode=0, speed=.5) 
784
+                    elif STANCE == 1 and own['throw_deck'] == 1:
785
+                        skater.playAction("fak_idle5", 1,120, layer=3, play_mode=0, speed=.5)
786
+                elif ran_num == 6:    
787
+                    killact(3)
788
+                    if STANCE == 0 and own['throw_deck'] == 0:
789
+                        skater.playAction("reg_idle6", 1,120, layer=3, play_mode=0, speed=.5)
790
+                        deck.playAction("a_reg_idle6", 1,120, layer=3, play_mode=0, speed=.5)
791
+                        trucks.playAction("a_reg_idle6", 1,120, layer=3, play_mode=0, speed=.5)
792
+                    elif STANCE == 0 and own['throw_deck'] == 1:
793
+                        skater.playAction("reg_idle6", 1,120, layer=3, play_mode=0, speed=.5)
794
+                    elif STANCE == 1 and own['throw_deck'] == 0:
795
+                        skater.playAction("fak_idle6", 1,120, layer=3, play_mode=0, speed=.5)
796
+                        deck.playAction("a_fak_idle6", 1,120, layer=3, play_mode=0, speed=.5)
797
+                        trucks.playAction("a_fak_idle6", 1,120, layer=3, play_mode=0, speed=.5) 
798
+                    elif STANCE == 1 and own['throw_deck'] == 1:
799
+                        skater.playAction("fak_idle6", 1,120, layer=3, play_mode=0, speed=.5) 
800
+                elif ran_num == 7:    
801
+                    killact(3)
802
+                    if STANCE == 0 and own['throw_deck'] == 0:
803
+                        skater.playAction("reg_idle7", 1,120, layer=3, play_mode=0, speed=.5)
804
+                        deck.playAction("a_reg_idle7", 1,120, layer=3, play_mode=0, speed=.5)
805
+                        trucks.playAction("a_reg_idle7", 1,120, layer=3, play_mode=0, speed=.5)
806
+                    elif STANCE == 0 and own['throw_deck'] == 1:
807
+                        skater.playAction("reg_idle7", 1,120, layer=3, play_mode=0, speed=.5)
808
+                    elif STANCE == 1 and own['throw_deck'] == 0:
809
+                        skater.playAction("fak_idle6", 1,120, layer=3, play_mode=0, speed=.5)
810
+                        deck.playAction("a_fak_idle6", 1,120, layer=3, play_mode=0, speed=.5)
811
+                        trucks.playAction("a_fak_idle6", 1,120, layer=3, play_mode=0, speed=.5) 
812
+                    elif STANCE == 1 and own['throw_deck'] == 1:
813
+                        skater.playAction("fak_idle6", 1,120, layer=3, play_mode=0, speed=.5)                                                                                                                                 
814
+
815
+def reset_pos():
816
+    #reset
817
+    if ddPad == 1:
818
+        
819
+        spawn_pos = own['spawn_pos']
820
+        spawn_rot = own['spawn_rot']
821
+        #spawnz = spawn_pos[2] + .1
822
+        try:
823
+            own.worldPosition = (spawn_pos[0], spawn_pos[1], spawnz)
824
+            own.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
825
+        except:    
826
+            own.worldPosition = (0, 0, .1)
827
+            own.worldOrientation = [[1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]    
828
+        if own["spawn_stance"] == 1:
829
+            own.setLinearVelocity([.1,0,0], 1)
830
+            #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
831
+            #lx = cam.localPosition[1] 
832
+            #lx = lx - 4
833
+            #cam.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
834
+            #cam.localPosition[1] = lx
835
+         
836
+        else: 
837
+            own.setLinearVelocity([-.1,0,0], 1)         
838
+            #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
839
+            #lx = cam.localPosition[1]
840
+            #lx = lx - 4
841
+            #cam.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
842
+            #cam.localPosition[1] = lx
843
+    if udPad == 1:
844
+        own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]] 
845
+        own['spawn_rot'] = [[own.worldOrientation[0][0],own.worldOrientation[0][1],own.worldOrientation[0][2]], [own.worldOrientation[1][0],own.worldOrientation[1][1],own.worldOrientation[1][2]], own.worldOrientation[2][2]]
846
+        stance = own["stance"]
847
+        own["spawn_stance"] = stance    
848
+def falldeck():
849
+    #print("falldeck")
850
+    throw_deck_empty = scene.objects["throw_deck_empty"]
851
+    deckact = deck.actuators["Visibility"]
852
+    trucksact = trucks.actuators["Visibility"]
853
+    wheel1act = wheel1.actuators["Visibility"]
854
+    wheel2act = wheel2.actuators["Visibility"]
855
+    wheel3act = wheel3.actuators["Visibility"]
856
+    wheel4act = wheel4.actuators["Visibility"]
857
+            
858
+    if own['throw_deck'] == False:
859
+        own['throw_deck'] = True
860
+        deckact.visibility = False
861
+        trucksact.visibility = False
862
+        wheel1act.visibility = False
863
+        wheel2act.visibility = False
864
+        wheel3act.visibility = False
865
+        wheel4act.visibility = False
866
+        act = throw_deck_empty.actuators['throw_dec_act']
867
+        if STANCE == True:
868
+            #skater.playAction("fak_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
869
+            act.linearVelocity = [0.0, 1.0, 1.0]
870
+        if STANCE == False:
871
+            #skater.playAction("reg_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)  
872
+            act.linearVelocity = [0.0, 1.0, -1.0]  
873
+        cont.activate(act)
874
+    else:
875
+        own['throw_deck'] = False    
876
+        deckact.visibility = True
877
+        trucksact.visibility = True
878
+        wheel1act.visibility = True
879
+        wheel2act.visibility = True
880
+        wheel3act.visibility = True
881
+        wheel4act.visibility = True
882
+        throw_deck_empty['kill_deck'] = 1 
883
+        #print("trying to kill deck")     
884
+    cont.activate(deck.actuators['Visibility'])
885
+    cont.activate(trucks.actuators['Visibility'])
886
+    cont.activate(wheel1.actuators['Visibility'])
887
+    cont.activate(wheel2.actuators['Visibility'])
888
+    cont.activate(wheel3.actuators['Visibility'])
889
+    cont.activate(wheel4.actuators['Visibility']) 
890
+
891
+def throwdeck():
892
+    throw_deck_empty = scene.objects["throw_deck_empty"]
893
+    deckact = deck.actuators["Visibility"]
894
+    trucksact = trucks.actuators["Visibility"]
895
+    wheel1act = wheel1.actuators["Visibility"]
896
+    wheel2act = wheel2.actuators["Visibility"]
897
+    wheel3act = wheel3.actuators["Visibility"]
898
+    wheel4act = wheel4.actuators["Visibility"]
899
+            
900
+    if own['throw_deck'] == False:
901
+        own['throw_deck'] = True
902
+        deckact.visibility = False
903
+        trucksact.visibility = False
904
+        wheel1act.visibility = False
905
+        wheel2act.visibility = False
906
+        wheel3act.visibility = False
907
+        wheel4act.visibility = False
908
+        act = throw_deck_empty.actuators['throw_dec_act']
909
+        if STANCE == True:
910
+            skater.playAction("fak_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
911
+            act.linearVelocity = [0.0, 5.0, 5.0]
912
+        if STANCE == False:
913
+            skater.playAction("reg_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)  
914
+            act.linearVelocity = [0.0, 5.0, -5.0]  
915
+        cont.activate(act)
916
+    else:
917
+        own['throw_deck'] = False    
918
+        deckact.visibility = True
919
+        trucksact.visibility = True
920
+        wheel1act.visibility = True
921
+        wheel2act.visibility = True
922
+        wheel3act.visibility = True
923
+        wheel4act.visibility = True
924
+        throw_deck_empty['kill_deck'] = 1 
925
+        #print("trying to kill deck")     
926
+    cont.activate(deck.actuators['Visibility'])
927
+    cont.activate(trucks.actuators['Visibility'])
928
+    cont.activate(wheel1.actuators['Visibility'])
929
+    cont.activate(wheel2.actuators['Visibility'])
930
+    cont.activate(wheel3.actuators['Visibility'])
931
+    cont.activate(wheel4.actuators['Visibility'])    
932
+        
933
+def throwdeck_trigger():
934
+    lastb = own['lastb']
935
+    throw_deck_empty = scene.objects["throw_deck_empty"]
936
+    if bBut == False:
937
+        throw_deck_empty['kill_deck'] = 0
938
+    if bBut == False and own['lastb'] == True:        
939
+        #print("throw deck")
940
+        throwdeck()        
941
+              
942
+def fall():
943
+    if own['fall'] == True:
944
+        falldeck()
945
+        if STANCE == 1:
946
+            own.setLinearVelocity([3,2,0], True)
947
+        else:
948
+            own.setLinearVelocity([-3,-2,0], True)    
949
+        own['fall'] = False
950
+
951
+def sit():
952
+    #turn off sit
953
+    if lup == 1 or ldown == 1 or lUD > sens or lUD < -sens:
954
+        if own['sit'] == 1:
955
+            killact(300)
956
+            killact(299)
957
+        own['sit'] = 0
958
+
959
+    if aBut == False and lasta == True:
960
+        #print(lasta)
961
+        try:
962
+            #print(r_ground.hitObject)
963
+            if 'sit' in r_ground.hitObject:
964
+                print("sit")
965
+                own['sit'] = 1
966
+                #killall()
967
+                killact(3)
968
+                if STANCE == 0:
969
+                    skater.playAction("reg_sit", 1,65, layer=300, play_mode=0, speed=1)
970
+                    deck.playAction("a_reg_sit", 1,65, layer=300, play_mode=0, speed=1)
971
+                    trucks.playAction("a_reg_sit", 1,65, layer=300, play_mode=0, speed=1)
972
+                elif STANCE == 1:
973
+                    skater.playAction("fak_sit", 1,65, layer=300, play_mode=0, speed=1)
974
+                    deck.playAction("a_fak_sit", 1,65, layer=300, play_mode=0, speed=1)
975
+                    trucks.playAction("a_fak_sit", 1,65, layer=300, play_mode=0, speed=1)                                         
976
+    #if own['sit'] == 1 and last_sit == 0:
977
+                 
978
+                     
979
+                
980
+        except:
981
+            #print("sit broke")
982
+            pass    
983
+    if own['sit'] == 1:
984
+        try:
985
+            killact(3)
986
+            sit_vect = r_ground.hitObject.getAxisVect( [0, 1, 0])
987
+            if STANCE == 0:
988
+                own.alignAxisToVect(-sit_vect, 0, .2)
989
+                skater.playAction("reg_sit", 65,65, layer=299, play_mode=1, speed=1)
990
+                deck.playAction("a_reg_sit", 65,65, layer=299, play_mode=1, speed=1)
991
+                trucks.playAction("a_reg_sit", 65,65, layer=299, play_mode=1, speed=1)                                 
992
+                
993
+            elif STANCE == 1:
994
+                own.alignAxisToVect(sit_vect, 0, .2) 
995
+                skater.playAction("fak_sit", 65,65, layer=299, play_mode=1, speed=1)
996
+                deck.playAction("a_fak_sit", 65,65, layer=299, play_mode=1, speed=1)
997
+                trucks.playAction("a_fak_sit", 65,65, layer=299, play_mode=1, speed=1)                    
998
+        except:
999
+            pass    
1000
+
1001
+                      
1002
+def switchcam():
1003
+    if ltsBut == False and own['lastlts'] == True and rtsBut == False:
1004
+        if own['camera'] == 1:
1005
+            own['camera'] = 0
1006
+        else:
1007
+            own['camera'] = 1
1008
+    if rtsBut == False and own['lastrts'] == True and ltsBut == False:
1009
+        if own['camera'] == 2:
1010
+            own['camera'] = 0
1011
+        else:
1012
+            own['camera'] = 2 
1013
+#followcam 
1014
+def move_followcam():
1015
+    if own['camera'] == 2:
1016
+        #if rtsBut == False and own['lastrts'] == True:
1017
+        if own['lastbkBut'] == True and bkBut == False:
1018
+            print("activate move followcam") 
1019
+            if own['move_followcam'] == False:
1020
+                own['move_followcam'] = True
1021
+            else:
1022
+                own['move_followcam'] = False                       
1023
+        if own['move_followcam'] == True:
1024
+            #act = followcam.actuators[
1025
+            camspeed1 = .015
1026
+            camspeed2 = .055
1027
+            camrot1 = .005
1028
+            camrot2 = .02
1029
+            #up
1030
+            if lUD < -0.080:
1031
+                followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
1032
+                cont.activate(followcam.actuators["up"])
1033
+                print("fastup")
1034
+            else:
1035
+                cont.deactivate(followcam.actuators["up"])    
1036
+#            #down    
1037
+            if lUD > .080:
1038
+                followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
1039
+                cont.activate(followcam.actuators["down"])
1040
+            else:
1041
+                cont.deactivate(followcam.actuators["down"])                    
1042
+#            #left
1043
+            if lLR < -0.080:
1044
+                followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]                
1045
+                cont.activate(followcam.actuators["left"])
1046
+            else:
1047
+                cont.deactivate(followcam.actuators["left"])                    
1048
+#            #right
1049
+            if lLR > 0.080:         
1050
+                followcam.actuators["right"].dLoc = [camspeed2, 0, 0]                
1051
+                cont.activate(followcam.actuators["right"])
1052
+            else:
1053
+                cont.deactivate(followcam.actuators["right"])  
1054
+            #up
1055
+            if rUD < -0.080:
1056
+                followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
1057
+                cont.activate(followcam.actuators["rotup"])
1058
+                #print("uppppppppppppppppppppppppppp")
1059
+            else:
1060
+                cont.deactivate(followcam.actuators["rotup"])    
1061
+#            #down    
1062
+            if rUD > .080:
1063
+                followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]                
1064
+                cont.activate(followcam.actuators["rotdown"])
1065
+            else:
1066
+                cont.deactivate(followcam.actuators["rotdown"])                    
1067
+#            #left
1068
+            if rLR < -0.080:
1069
+                followcam.actuators["rotleft"].dRot = [0, 0, camrot2]                
1070
+                cont.activate(followcam.actuators["rotleft"])
1071
+            else:
1072
+                cont.deactivate(followcam.actuators["rotleft"])                    
1073
+#            #right
1074
+            if rLR > 0.080:         
1075
+                followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
1076
+                cont.activate(followcam.actuators["rotright"])
1077
+            else:
1078
+                cont.deactivate(followcam.actuators["rotright"]) 
1079
+
1080
+#*********************************************                
1081
+                
1082
+            if lUD > -0.080 and lUD < -0.030:
1083
+                followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
1084
+                cont.activate(followcam.actuators["up"])
1085
+                #print(lUD)
1086
+            else:
1087
+                cont.deactivate(followcam.actuators["up"])    
1088
+#            #down    
1089
+            if lUD < .080 and lUD > .03:
1090
+                followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]                
1091
+                cont.activate(followcam.actuators["down"])
1092
+            else:
1093
+                cont.deactivate(followcam.actuators["down"])                    
1094
+#            #left
1095
+            if lLR > -0.080 and lLR < -0.030:
1096
+                followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]                
1097
+                cont.activate(followcam.actuators["left"])
1098
+            else:
1099
+                cont.deactivate(followcam.actuators["left"])                    
1100
+#            #right
1101
+            if lLR < .080 and lLR > .03:       
1102
+                followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
1103
+                cont.activate(followcam.actuators["right"])
1104
+            else:
1105
+                cont.deactivate(followcam.actuators["right"])  
1106
+            #up
1107
+            if rUD > -0.080 and rUD < -0.030:
1108
+                followcam.actuators["rotup"].dRot = [camrot1, 0, 0]                
1109
+                cont.activate(followcam.actuators["rotup"])
1110
+            else:
1111
+                cont.deactivate(followcam.actuators["rotup"])    
1112
+#            #down    
1113
+            if rUD < .080 and rUD > .03:
1114
+                followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]                
1115
+                cont.activate(followcam.actuators["rotdown"])
1116
+            else:
1117
+                cont.deactivate(followcam.actuators["rotdown"])                    
1118
+#            #left
1119
+            if rLR > -0.080 and rLR < -0.030:
1120
+                followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
1121
+                cont.activate(followcam.actuators["rotleft"])
1122
+            else:
1123
+                cont.deactivate(followcam.actuators["rotleft"])                    
1124
+#            #right
1125
+            if rLR < .080 and rLR > .03:         
1126
+                followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
1127
+                cont.activate(followcam.actuators["rotright"])
1128
+            else:
1129
+                cont.deactivate(followcam.actuators["rotright"])                       
1130
+def move_flycam():
1131
+    if own['camera'] == 1:
1132
+        #if rtsBut == False and own['lastrts'] == True:
1133
+        if own['lastbkBut'] == True and bkBut == False: 
1134
+            if own['move_freecam'] == False:
1135
+                own['move_freecam'] = True
1136
+            else:
1137
+                own['move_freecam'] = False                       
1138
+        if own['move_freecam'] == True:
1139
+            #act = freecam.actuators[
1140
+            camspeed1 = .015
1141
+            camspeed2 = .055
1142
+            camrot1 = .005
1143
+            camrot2 = .02
1144
+            #up
1145
+            if lUD < -0.080:
1146
+                freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
1147
+                cont.activate(freecam.actuators["up"])
1148
+                #print("fastup")
1149
+            else:
1150
+                cont.deactivate(freecam.actuators["up"])    
1151
+#            #down    
1152
+            if lUD > .080:
1153
+                freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
1154
+                cont.activate(freecam.actuators["down"])
1155
+            else:
1156
+                cont.deactivate(freecam.actuators["down"])                    
1157
+#            #left
1158
+            if lLR < -0.080:
1159
+                freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]                
1160
+                cont.activate(freecam.actuators["left"])
1161
+            else:
1162
+                cont.deactivate(freecam.actuators["left"])                    
1163
+#            #right
1164
+            if lLR > 0.080:         
1165
+                freecam.actuators["right"].dLoc = [camspeed2, 0, 0]                
1166
+                cont.activate(freecam.actuators["right"])
1167
+            else:
1168
+                cont.deactivate(freecam.actuators["right"])  
1169
+            #up
1170
+            if rUD < -0.080:
1171
+                freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
1172
+                cont.activate(freecam.actuators["rotup"])
1173
+            else:
1174
+                cont.deactivate(freecam.actuators["rotup"])    
1175
+#            #down    
1176
+            if rUD > .080:
1177
+                freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]                
1178
+                cont.activate(freecam.actuators["rotdown"])
1179
+            else:
1180
+                cont.deactivate(freecam.actuators["rotdown"])                    
1181
+#            #left
1182
+            if rLR < -0.080:
1183
+                freecam.actuators["rotleft"].dRot = [0, 0, camrot2]                
1184
+                cont.activate(freecam.actuators["rotleft"])
1185
+            else:
1186
+                cont.deactivate(freecam.actuators["rotleft"])                    
1187
+#            #right
1188
+            if rLR > 0.080:         
1189
+                freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
1190
+                cont.activate(freecam.actuators["rotright"])
1191
+            else:
1192
+                cont.deactivate(freecam.actuators["rotright"]) 
1193
+
1194
+#*********************************************                
1195
+                
1196
+            if lUD > -0.080 and lUD < -0.030:
1197
+                freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
1198
+                cont.activate(freecam.actuators["up"])
1199
+                #print(lUD)
1200
+            else:
1201
+                cont.deactivate(freecam.actuators["up"])    
1202
+#            #down    
1203
+            if lUD < .080 and lUD > .03:
1204
+                freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]                
1205
+                cont.activate(freecam.actuators["down"])
1206
+            else:
1207
+                cont.deactivate(freecam.actuators["down"])                    
1208
+#            #left
1209
+            if lLR > -0.080 and lLR < -0.030:
1210
+                freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]                
1211
+                cont.activate(freecam.actuators["left"])
1212
+            else:
1213
+                cont.deactivate(freecam.actuators["left"])                    
1214
+#            #right
1215
+            if lLR < .080 and lLR > .03:       
1216
+                freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
1217
+                cont.activate(freecam.actuators["right"])
1218
+            else:
1219
+                cont.deactivate(freecam.actuators["right"])  
1220
+            #up
1221
+            if rUD > -0.080 and rUD < -0.030:
1222
+                freecam.actuators["rotup"].dRot = [camrot1, 0, 0]                
1223
+                cont.activate(freecam.actuators["rotup"])
1224
+            else:
1225
+                cont.deactivate(freecam.actuators["rotup"])    
1226
+#            #down    
1227
+            if rUD < .080 and rUD > .03:
1228
+                freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]                
1229
+                cont.activate(freecam.actuators["rotdown"])
1230
+            else:
1231
+                cont.deactivate(freecam.actuators["rotdown"])                    
1232
+#            #left
1233
+            if rLR > -0.080 and rLR < -0.030:
1234
+                freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
1235
+                cont.activate(freecam.actuators["rotleft"])
1236
+            else:
1237
+                cont.deactivate(freecam.actuators["rotleft"])                    
1238
+#            #right
1239
+            if rLR < .080 and rLR > .03:         
1240
+                freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
1241
+                cont.activate(freecam.actuators["rotright"])
1242
+            else:
1243
+                cont.deactivate(freecam.actuators["rotright"])                     
1244
+if r_ground.triggered == False:
1245
+    cont.deactivate(own.actuators["walk_align"])
1246
+else:
1247
+    cont.activate(own.actuators["walk_align"])                    
1248
+
1249
+if r_ground.triggered:
1250
+    #print("on stair")
1251
+    try:
1252
+        if 'stair' in r_ground.hitObject:
1253
+            own['stair_counter'] = 20
1254
+            force = [ 0.0, 0.0, -100]
1255
+            # use local axis
1256
+            local = True
1257
+            # apply force
1258
+            #own.applyForce(force, local)        
1259
+    except:
1260
+        pass        
1261
+    if own['stair_counter'] > 0:
1262
+       own['stair_counter'] -= 1     
1263
+
1264
+if yBut == True:
1265
+    own['walk_idling'] = 0
1266
+    own["walk_idle_frame"] = 0
1267
+
1268
+                    
1269
+onboard() 
1270
+jump()
1271
+dropin()
1272
+throwdeck_trigger()
1273
+
1274
+nextframe()
1275
+checkidle()
1276
+getonboard()
1277
+reset_pos()
1278
+switchcam()
1279
+move_flycam()
1280
+move_followcam()
1281
+fall()
1282
+idle_anim()
1283
+sit()
1284
+#cont.activate(cam.actuators['Camera'])
1285
+#printplaying() 
1286
+
1287
+own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
1288
+own.actuators["sroll"].stopSound() 
1289
+wheel1 = scene.objects["rollen.000"]
1290
+wheel2 = scene.objects["rollen.001"]
1291
+wheel3 = scene.objects["rollen.002"]
1292
+wheel4 = scene.objects["rollen.003"]
1293
+wheel1.stopAction(2)
1294
+wheel2.stopAction(2)
1295
+wheel3.stopAction(2)
1296
+wheel4.stopAction(2)
1297
+
1298
+
1299
+own['lasty'] = yBut
1300
+own['lastb'] = bBut  
1301
+own['lasta'] = aBut
1302
+own['lastx'] = xBut   
1303
+own['lastlts'] = ltsBut
1304
+own['lastrts'] = rtsBut        
1305
+own['lastbkBut'] = bkBut
1306
+own['dropinCol'] = dropinCol
1307
+own['walk'] = 1
1308
+    

+ 1308
- 0
controller2c.py View File

@@ -0,0 +1,1308 @@
1
+os = 'Windows'
2
+from sys import platform
3
+if platform != "win32":
4
+ os = 'Linux'
5
+def onWindows():
6
+ return os == 'Windows'
7
+import bge
8
+import GameLogic
9
+import ctypes
10
+#import bpy
11
+import random
12
+
13
+#build global dict (move this to separate script that runs once)
14
+scene = bge.logic.getCurrentScene()
15
+objList = scene.objects
16
+
17
+reduction = 400000
18
+axisTh = 0.03 
19
+
20
+############
21
+##vibration#
22
+############
23
+## Define necessary structures
24
+#class XINPUT_VIBRATION(ctypes.Structure):
25
+#    _fields_ = [("wLeftMotorSpeed", ctypes.c_ushort), ("wRightMotorSpeed", ctypes.c_ushort)]
26
+#xinput = ctypes.windll.xinput1_3 # Load Xinput.dll
27
+## Set up function argument types and return type
28
+#XInputSetState = xinput.XInputSetState
29
+#XInputSetState.argtypes = [ctypes.c_uint, ctypes.POINTER(XINPUT_VIBRATION)]
30
+#XInputSetState.restype = ctypes.c_uint
31
+## Now we're ready to call it. Set left motor to 100%, right motor to 50%
32
+## for controller 0
33
+##vibration = XINPUT_VIBRATION(65535, 32768)
34
+##XInputSetState(0, ctypes.byref(vibration))
35
+## You can also create a helper function like this:
36
+#def set_vibration(controller, left_motor, right_motor):
37
+#    vibration = XINPUT_VIBRATION(int(left_motor * 65535), int(right_motor * 65535))
38
+#    XInputSetState(controller, ctypes.byref(vibration))  
39
+## ... and use it like so
40
+##set_vibration(0, 0.2, 0.2)
41
+################
42
+##end vibration#
43
+################
44
+
45
+
46
+cont = GameLogic.getCurrentController() 
47
+obj = bge.logic.getCurrentScene().objects
48
+char = bge.constraints.getCharacter
49
+own = cont.owner
50
+stance = own['stance']
51
+STANCE = own['stance']
52
+r_ground = cont.sensors["r_Ground"]
53
+#Sensor logic bricks connected to the python Controller  
54
+aXis = cont.sensors["sControla.001"]
55
+bUtt = cont.sensors["sControlb.001"]
56
+linvel = own.getLinearVelocity(True)
57
+lasta = own['lasta']
58
+lastx = own['lastx']
59
+last_sit = own['sit']
60
+
61
+try:
62
+    own['walk_timer'] = own['walk_timer'] +1
63
+except:
64
+    own['walk_timer'] = 1
65
+
66
+truckon = 30
67
+deckon = 30
68
+
69
+onW = onWindows()
70
+
71
+# windows stuff
72
+lar_lts = 0
73
+uad_lts = 1
74
+lt = 4 if onW else 2
75
+lar_rts = 2 if onW else 3
76
+uad_rts = 3 if onW else 4
77
+rt = 5
78
+
79
+a_but = 0 if onW else 0
80
+b_but = 1 if onW else 1
81
+x_but = 2 if onW else 2
82
+y_but = 3 if onW else 3
83
+l_bump = 9 if onW else 4
84
+r_bump = 10 if onW else 5
85
+bk_but = 4 if onW else 6
86
+st_but = 6 if onW else 7
87
+xb_but = 5 if onW else 8
88
+lts_pr = 7 if onW else 9
89
+rts_pr = 8 if onW else 10
90
+l_dp = 13 if onW else 11
91
+r_dp = 14 if onW else 12
92
+u_dp = 11 if onW else 13
93
+d_dp = 12 if onW else 14
94
+
95
+lLR = aXis.axisValues[lar_lts] / reduction
96
+lUD = aXis.axisValues[uad_lts] / reduction
97
+rLR = aXis.axisValues[lar_rts] / reduction
98
+rUD = aXis.axisValues[uad_rts] / reduction
99
+lTrig = aXis.axisValues[lt] / reduction
100
+rTrig = aXis.axisValues[rt] / reduction
101
+aBut = bUtt.getButtonStatus(a_but)
102
+bBut = bUtt.getButtonStatus(b_but)
103
+xBut = bUtt.getButtonStatus(x_but)
104
+yBut = bUtt.getButtonStatus(y_but)
105
+lBump = bUtt.getButtonStatus(l_bump)
106
+rBump = bUtt.getButtonStatus(r_bump)
107
+bkBut = bUtt.getButtonStatus(bk_but)
108
+stBut = bUtt.getButtonStatus(st_but)
109
+xbBut = bUtt.getButtonStatus(xb_but)
110
+ltsBut = bUtt.getButtonStatus(lts_pr)
111
+rtsBut = bUtt.getButtonStatus(rts_pr)
112
+ldPad = bUtt.getButtonStatus(l_dp)
113
+rdPad = bUtt.getButtonStatus(r_dp)
114
+udPad = bUtt.getButtonStatus(u_dp)
115
+ddPad = bUtt.getButtonStatus(d_dp)
116
+
117
+#user
118
+sens = .04
119
+fliplay = 30
120
+dropinCol = own.sensors['dropinCol']
121
+
122
+#no input
123
+def cutOff():
124
+    
125
+ if (abs(lLR) < axisTh 
126
+     and abs(lUD) < axisTh 
127
+     and abs(rLR) < axisTh 
128
+     and abs(rUD) < axisTh
129
+     and aBut == False):
130
+         
131
+  return True
132
+skater = scene.objects["Char4"]
133
+deck = scene.objects["deck"]
134
+trucks = scene.objects["trucks"]
135
+
136
+throw_deck_empty = scene.objects["throw_deck_empty"]
137
+wheel1 = scene.objects["rollen.000"]
138
+wheel2 = scene.objects["rollen.001"]
139
+wheel3 = scene.objects["rollen.002"]
140
+wheel4 = scene.objects["rollen.003"]
141
+camobj = scene.objects["Camera.003"]
142
+camera = cont.actuators["Camera"]
143
+replayCam = cont.actuators["replayCam"]
144
+timer = own['dropinTimer']
145
+cam = scene.objects["Camera.003"]
146
+freecam = scene.objects["freecam"]
147
+followcam = scene.objects["followcam"]
148
+
149
+noidle = 0
150
+
151
+playing_deck = deck.isPlayingAction(deckon)
152
+playing_trucks = trucks.isPlayingAction(truckon)
153
+if playing_deck == 1 or playing_trucks == 1:
154
+    noidle = 1
155
+
156
+if own["stance"] == None:
157
+    own["stance"] = True
158
+STANCE = own["stance"]
159
+def killact(layer):
160
+    if skater.isPlayingAction(layer):
161
+        skater.stopAction(layer)
162
+    if deck.isPlayingAction(layer):    
163
+        deck.stopAction(layer)
164
+    if trucks.isPlayingAction(layer):    
165
+        trucks.stopAction(layer)
166
+def killall():
167
+    for x in range(5000):
168
+        skater.stopAction(x)
169
+        deck.stopAction(x)
170
+        trucks.stopAction(x)
171
+def trucksisplaying():
172
+    for x in range(5000):
173
+        if deck.isPlayingAction(x):
174
+            print("deck is playing:", x)
175
+#trucksisplaying() 
176
+
177
+def printplaying():
178
+    splaying_layers = "S: "
179
+    playing_layers = "D: "
180
+    tplaying_layers = "T: "
181
+    for x in range(9900):
182
+        if skater.isPlayingAction(x):
183
+        #if trucks.isPlayingAction(x):
184
+        #if skater.isPlayingAction(x):                        
185
+            splaying_layers += str(x)
186
+            splaying_layers += " "        
187
+        if deck.isPlayingAction(x):
188
+        #if trucks.isPlayingAction(x):
189
+        #if skater.isPlayingAction(x):                        
190
+            playing_layers += str(x)
191
+            playing_layers += " "
192
+        if trucks.isPlayingAction(x):
193
+        #if trucks.isPlayingAction(x):
194
+        #if skater.isPlayingAction(x):                        
195
+            tplaying_layers += str(x)
196
+            tplaying_layers += " "            
197
+    print(splaying_layers, playing_layers, tplaying_layers) 
198
+#printplaying() 
199
+##
200
+if r_ground.positive and xBut == False and lastx == False:
201
+    killact(10)
202
+    #killact(11)
203
+    killact(12)
204
+    killact(13)              
205
+######################################  
206
+#walk out
207
+#print(own['walk_timer'])
208
+#if own['walk_timer'] < 5:
209
+#    
210
+#    if stance == 0 and skater.isPlayingAction(fliplay) == False:
211
+#        
212
+#        if own['throw_deck'] == True:
213
+#            print("walk out1")
214
+#            skater.playAction("reg_nwalk_nb.001", 15,35, layer=29, play_mode=0, speed=.5)
215
+#        else:
216
+#            print("walk out2")
217
+#            skater.playAction("walk.000", 15,35, layer=29, play_mode=0, speed=.5)
218
+#        deck.playAction("a_reg_walk", 0,35, layer=17, play_mode=0)
219
+#        trucks.playAction("a_reg_walk", 0,35, layer=17, play_mode=0)    
220
+    
221
+
222
+#idle      
223
+if stance == 0 and skater.isPlayingAction(fliplay) == False and yBut == False and r_ground.triggered and xBut == False and noidle == 0 and own['walk_idling'] == 0 and own['sit'] == 0:
224
+    own['requestAction'] = 'reg_idle'
225
+    if own['throw_deck'] == True:
226
+        own['requestAction'] = 'reg_idle_nb'
227
+        skater.playAction("reg_idle1", 1,120, layer=3, play_mode=1, speed=.5)
228
+    else:
229
+        #cont.activate(skater.actuators['aRest'])
230
+        skater.playAction("reg_idle1", 1,120, layer=3, play_mode=1, speed=.5)
231
+        deck.playAction("a_reg_idle1", 1,120, layer=3, play_mode=1, speed=.5)
232
+        trucks.playAction("a_reg_idle1", 1,120, layer=3, play_mode=1, speed=.5) 
233
+if stance == 1 and skater.isPlayingAction(fliplay) == False and yBut == False and r_ground.triggered and xBut == False and noidle == 0 and own['walk_idling'] == 0 and own['sit'] == 0:
234
+    own['requestAction'] = 'fak_idle'
235
+    if own['throw_deck'] == True:
236
+        own['requestAction'] = 'fak_idle_nb'
237
+        skater.playAction("fak_idle1", 1,120, layer=3, play_mode=1, speed=.5)
238
+    else:
239
+        #cont.activate(skater.actuators['aRest'])
240
+        skater.playAction("fak_idle1", 1,120, layer=3, play_mode=1, speed=.5)
241
+        deck.playAction("a_fak_idle1", 1,120, layer=3, play_mode=1, speed=.5)
242
+        trucks.playAction("a_fak_idle1", 1,120, layer=3, play_mode=1, speed=.5) 
243
+
244
+if lUD < -sens:
245
+    lup = 1
246
+else:
247
+    lup = 0
248
+if lUD > sens:
249
+    ldown = 1
250
+else:
251
+    ldown = 0    
252
+    
253
+#walking
254
+
255
+#new walking
256
+#if (lup == 1 and aBut == 0 and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0):
257
+vel = own.getLinearVelocity(True)
258
+if own['walk_timer'] < 50:
259
+    velx = vel.x * .95             
260
+    own.setLinearVelocity([velx, 0, vel.z], True)
261
+else:
262
+    own.setLinearVelocity([0, 0, vel.z], True)
263
+    #print("set 0 vel")
264
+    
265
+if (lup == 1 and aBut == 0 and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0):    
266
+    own['walking'] = "regular"
267
+    walking = "regular"
268
+elif lup == 1 and aBut == 1 and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0:
269
+    own['walking'] = "fast"
270
+    walking = "fast"
271
+else:
272
+    own['walking'] = None
273
+    walking = None
274
+#print(own['walk_timer'])    
275
+if walking == "regular":
276
+    cont.deactivate(own.actuators['forward2']) 
277
+    cont.deactivate(own.actuators['backward2'])    
278
+    if stance == 0:
279
+        cont.activate(own.actuators['forward'])
280
+    else:
281
+        cont.activate(own.actuators['backward'])
282
+if walking == "fast":
283
+    cont.deactivate(own.actuators['forward']) 
284
+    cont.deactivate(own.actuators['backward'])    
285
+    if stance == 0:
286
+        cont.activate(own.actuators['forward2'])
287
+    else:
288
+        cont.activate(own.actuators['backward2'])            
289
+        
290
+
291
+if walking == None:
292
+    cont.deactivate(own.actuators['forward2']) 
293
+    cont.deactivate(own.actuators['backward2'])
294
+    cont.deactivate(own.actuators['forward']) 
295
+    cont.deactivate(own.actuators['backward'])        
296
+    if own['walk_timer'] < 50:
297
+        velx = vel.x * .95             
298
+        own.setLinearVelocity([velx, 0, vel.z], True)
299
+    else:
300
+        own.setLinearVelocity([0, 0, vel.z], True)
301
+        #print("set 0 vel")    
302
+                
303
+    
304
+#old walking
305
+if (lup == 1 and aBut == 0 and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0):
306
+    own.actuators["walkondirt"].volume = .2
307
+    own.actuators["walkondirt"].pitch = 1
308
+    cont.activate(own.actuators["walkondirt"])
309
+    if lasta == 1:
310
+        #cont.deactivate(own.actuators['forward2']) 
311
+        #cont.deactivate(own.actuators['backward2'])
312
+        killact(6)
313
+        killact(7)
314
+        killact(8)
315
+        killact(9)
316
+        killact(17)
317
+        killact(18)                
318
+    if stance == 0 and skater.isPlayingAction(fliplay) == False:             
319
+        #cont.activate(own.actuators['forward'])
320
+        #cont.activate(skater.actuators['aWalk'])
321
+        #cont.activate(deck.actuators['a_reg_walk'])
322
+        #cont.activate(deck.actuators['a_reg_walk'])
323
+        #without deck
324
+        if own['throw_deck'] == True:
325
+            own['requestAction'] = 'reg_walk_nb'
326
+            #skater.playAction("reg_nwalk_nb.001", 0,35, layer=24, play_mode=1, speed=.5)
327
+        else:
328
+            own['requestAction'] = 'reg_walk'
329
+#            skater.playAction("reg_nwalk", 0,35, layer=24, play_mode=1, speed=.5)
330
+#        deck.playAction("a_reg_nwalk", 0,35, layer=16, play_mode=1, speed=.5)
331
+#        trucks.playAction("a_reg_nwalk", 0,35, layer=16, play_mode=1, speed=.5)
332
+        killact(25) 
333
+        killact(305)
334
+        killact(306)                
335
+    if stance == 1 and skater.isPlayingAction(fliplay) == False:        
336
+        #cont.activate(own.actuators['backward'])
337
+        #cont.activate(skater.actuators['aWalk_fak'])
338
+        #cont.activate(deck.actuators['a_fak_walk'])
339
+        #cont.activate(trucks.actuators['a_fak_walk'])
340
+        #without deck
341
+        if own['throw_deck'] == True:
342
+            own['requestAction'] = 'fak_walk_nb'
343
+            #skater.playAction("fak_nwalk_nb.001", 0,35, layer=25, play_mode=1, speed=.5)
344
+        else:
345
+            own['requestAction'] = 'fak_walk'
346
+#            skater.playAction("fak_nwalk", 0,35, layer=25, play_mode=1, speed=.5)    
347
+#        deck.playAction("a_fak_nwalk", 0,35, layer=15, play_mode=1, speed=.5)
348
+#        trucks.playAction("a_fak_nwalk", 0,35, layer=15, play_mode=1, speed=.5)        
349
+elif lup == 1 and aBut == 1 and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0:
350
+    own.actuators["walkondirt"].volume = .2
351
+    own.actuators["walkondirt"].pitch = 1.3
352
+    cont.activate(own.actuators["walkondirt"])
353
+    if stance == 0 and skater.isPlayingAction(fliplay) == False:        
354
+        #cont.activate(own.actuators['forward2'])
355
+        #cont.activate(skater.actuators['aWalk'])
356
+        if own['throw_deck'] == True:
357
+            own['requestAction'] = 'reg_walkFast_nb'
358
+            skater.playAction("reg_nwalk_nb.001", 0,35, layer=25, play_mode=1, speed=1)
359
+        else:
360
+            own['requestAction'] = 'reg_walkFast'
361
+#            skater.playAction("reg_nwalk", 0,35, layer=25, play_mode=1, speed=1)         
362
+#        
363
+#        deck.playAction("a_reg_nwalk", 0,35, layer=305, play_mode=1, speed=1)
364
+#        trucks.playAction("a_reg_nwalk", 0,35, layer=306, play_mode=1, speed=1)
365
+    else:
366
+        killact(25) 
367
+        killact(305)
368
+        killact(306)           
369
+    if stance == 1 and skater.isPlayingAction(fliplay) == False:        
370
+        #cont.activate(own.actuators['backward2'])
371
+        #cont.activate(skater.actuators['aWalk_fak'])
372
+        if own['throw_deck'] == True:
373
+            own['requestAction'] = 'fak_walkFast_nb'
374
+            skater.playAction("fak_nwalk_nb.001", 0,35, layer=24, play_mode=1, speed=1)           
375
+        else:
376
+            own['requestAction'] = 'fak_walkFast'
377
+#            skater.playAction("fak_nwalk", 0,35, layer=24, play_mode=1, speed=1)                       
378
+#        deck.playAction("a_fak_nwalk", 0,35, layer=15, play_mode=1, speed=1)
379
+#        trucks.playAction("a_fak_nwalk", 0,35, layer=15, play_mode=1, speed=1)             
380
+else:
381
+    vel = own.getLinearVelocity(True)
382
+    cont.deactivate(own.actuators["walkondirt"])
383
+    if stance == 0:
384
+        #cont.deactivate(own.actuators['forward'])
385
+        #cont.deactivate(own.actuators['forward2'])
386
+        cont.deactivate(skater.actuators['aWalk'])
387
+        cont.deactivate(deck.actuators['a_reg_walk'])
388
+        cont.deactivate(trucks.actuators['a_reg_walk'])        
389
+        killact(4)
390
+        killact(5)
391
+        killact(6)
392
+        killact(7)
393
+        killact(15)
394
+        killact(16)
395
+        killact(17)
396
+        killact(18)
397
+        killact(24)
398
+        killact(25) 
399
+        killact(305)
400
+        killact(306)         
401
+#        if own['walk_timer'] < 50:
402
+#            velx = vel.x * .95             
403
+#            #own.setLinearVelocity([velx, 0, vel.z], True)
404
+#            
405
+#        else:
406
+#            if r_ground.triggered:
407
+#                own.setLinearVelocity([0, 0, vel.z], True)
408
+#            #velz = vel.z
409
+#            #print(velz)
410
+#            #own.localLinearVelocity[0, 0, velz]
411
+    if stance == 1:
412
+        #cont.deactivate(own.actuators['backward'])
413
+        #cont.deactivate(own.actuators['backward2'])
414
+        cont.deactivate(skater.actuators['aWalk_fak'])
415
+        cont.deactivate(deck.actuators['a_fak_walk'])
416
+        cont.deactivate(trucks.actuators['a_fak_walk'])        
417
+        killact(4)
418
+        killact(5)
419
+        killact(6)
420
+        killact(7)
421
+        killact(15)
422
+        killact(16)
423
+        killact(17)
424
+        killact(18)
425
+        killact(24)
426
+        killact(25) 
427
+        killact(305)
428
+        killact(306)             
429
+#        if own['walk_timer'] < 50:
430
+#            velx = vel.x * .95             
431
+#            #own.setLinearVelocity([velx, 0, vel.z], True)
432
+#        else:
433
+#            own.setLinearVelocity([0, 0, vel.z], True)
434
+#in air        
435
+if lup == 1 and r_ground.positive == False:
436
+    
437
+    if stance == 0:
438
+        cont.deactivate(own.actuators['forward'])
439
+        cont.deactivate(own.actuators['forward2'])
440
+        cont.deactivate(skater.actuators['aWalk'])
441
+        killact(4)
442
+        killact(5)
443
+        killact(6)
444
+        killact(7)        
445
+        velx = linvel.x - 1
446
+        own.setLinearVelocity([-1.5, linvel.y, linvel.z], 1)
447
+        #cont.activate(own.actuators['forward2'])
448
+    if stance == 1:    
449
+        cont.deactivate(own.actuators['backward'])
450
+        cont.deactivate(own.actuators['backward2'])
451
+        cont.deactivate(skater.actuators['aWalk_fak'])
452
+        killact(4)
453
+        killact(5)
454
+        killact(6)
455
+        killact(7)        
456
+        velx = linvel.x + 1
457
+        own.setLinearVelocity([1.5, linvel.y, linvel.z], 1) 
458
+        #cont.activate(own.actuators['backward2'])       
459
+#---------------
460
+if rLR > .05:
461
+    cont.activate(camobj.actuators['camRight'])
462
+else:
463
+    cont.deactivate(camobj.actuators['camRight'])    
464
+if rLR < -.05:
465
+    cont.activate(camobj.actuators['camLeft'])
466
+else:
467
+    cont.deactivate(camobj.actuators['camLeft'])     
468
+if rUD > .05:
469
+    cont.activate(camobj.actuators['camDown'])
470
+else:
471
+    cont.deactivate(camobj.actuators['camDown'])     
472
+if rUD < -.05:
473
+    cont.activate(camobj.actuators['camUp'])
474
+else:
475
+    cont.deactivate(camobj.actuators['camUp'])     
476
+                
477
+#----------------
478
+camera.height = .9 #-.4
479
+camera.min = 1.5
480
+camera.max = 2
481
+#camera.object = "Char4:Mhair01"
482
+#camera.damping = 0
483
+#camera.axis = 4 
484
+lasty = own['lasty']     
485
+#if yBut == False and lasty == True:
486
+
487
+#    if own['walk'] == 1: 
488
+#        killact(fliplay) 
489
+        #killall() 
490
+    #camera.damping = 0     
491
+    #camera.axis = 4            
492
+#print(stance)
493
+
494
+
495
+def onboard():
496
+#    pass
497
+    if own['walk'] == 0:
498
+        print("start walking")
499
+        if own['framenum'] > 100 and own['fall'] == False:
500
+            #pass
501
+            cont.activate(own.actuators['pop'])
502
+        own['getoffboard'] = False
503
+        #set_vibration(0, 0.0, 0.0)
504
+        fliplay = 301
505
+        fliplay2 = 302 
506
+        fliplay3 = 303
507
+        try:
508
+            vel = own['offboard_vel']
509
+            #velx = vel.x *2
510
+            vel = [velx, vel.y, vel.z]
511
+            #vel = vel * 4
512
+            #vel = [-100, 0, 0]
513
+            #print(vel)
514
+            #own.localLinearVelocity = vel
515
+            #JUMPHEIGHT = 1100
516
+            #force = [600, 0.0, 10]
517
+            # use local axis
518
+            #local = True
519
+            # apply force
520
+            #own.applyForce(force, local)            
521
+        except: 
522
+            pass
523
+         
524
+        if STANCE == 0:
525
+            #killact(3)
526
+            #killact(4)
527
+            killall()
528
+            skater.stopAction(fliplay)
529
+            deck.stopAction(deckon)
530
+            trucks.stopAction(truckon)             
531
+#            skater.playAction("nreg_offboard", 1,30, layer=fliplay, priority=0, play_mode=0, speed=1.5)
532
+#            deck.playAction("a_reg_offboard", 1,30, layer=deckon, priority=0, play_mode=0, speed=1.5)
533
+#            trucks.playAction("c_reg_offboard", 1,30, layer=truckon, priority=0, play_mode=0, speed=1.5)
534
+            skater.playAction("reg_noffboard", 0,26, layer=fliplay, priority=0, play_mode=0, speed=.5)
535
+            deck.playAction("a_reg_noffboard", 0,26, layer=deckon, priority=0, play_mode=0, speed=.5)
536
+            trucks.playAction("a_reg_noffboard", 0,26, layer=truckon, priority=0, play_mode=0, speed=.5)            
537
+        if STANCE == 1:
538
+            killact(3)
539
+            killact(4)
540
+            killall()
541
+            skater.stopAction(fliplay)
542
+            deck.stopAction(deckon)
543
+            trucks.stopAction(truckon)             
544
+            skater.playAction("nfak_offboard", 1,30, layer=fliplay, priority=0, play_mode=0, speed=1.5)
545
+            deck.playAction("a_fak_offboard", 1,30, layer=deckon, priority=0, play_mode=0, speed=1.5)
546
+            trucks.playAction("a_fak_offboard", 1,30, layer=truckon, priority=0, play_mode=0, speed=1.5)             
547
+def jump():
548
+    if xBut == True:
549
+        if own['lastx'] == 0:
550
+            killact(3)
551
+            killact(4)
552
+            killact(5)
553
+            killact(6)
554
+            killact(7) 
555
+            #why does this layer have to be so high?      
556
+            if STANCE == 0:  
557
+                own['requestAction'] ='reg_jump'   
558
+#                skater.playAction("reg_jump", 1,35, layer=400, priority=0, play_mode=0, speed=.5)
559
+#                deck.playAction("a_reg_jump2", 1,35, layer=400, priority=0, play_mode=0, speed=.5)
560
+#                trucks.playAction("a_reg_jump2", 1,35, layer=400, priority=0, play_mode=0, speed=.5)
561
+            if STANCE == 1:
562
+                own['requestAction'] ='fak_jump'
563
+                #skater.playAction("fak_jump", 1,35, layer=400, priority=0, play_mode=0, speed=.5)    
564
+            #deck.playAction("a_reg_jump", 1,30, layer=11, play_mode=0, speed=.5)
565
+            #trucks.playAction("a_reg_jump", 1,30, layer=12, priority=0, play_mode=0, speed=1)             
566
+            JUMPHEIGHT = 1100
567
+            force = [ 0.0, 0.0, JUMPHEIGHT]
568
+            # use local axis
569
+            local = False
570
+            # apply force
571
+            own.applyForce(force, local)
572
+        own['lastx'] = 1
573
+    else:
574
+        own['lastx'] = 0
575
+def dropin():
576
+    if dropinCol.positive == True:
577
+        #print("DROPIN") 
578
+        pass       
579
+        
580
+def getonboard():
581
+    getonboard = own['getonboard']
582
+    fliplay2 = 50#8560
583
+    if yBut == True:
584
+        #camera.height = -.4
585
+        #camera.min = 1.5
586
+        #camera.max = 2 #2
587
+        #camera.damping = .99
588
+        #camera.axis = 0
589
+        
590
+        #cont.deactivate(cam.actuators['replayCam'])
591
+        #cont.deactivate(cam.actuators['Camera'])
592
+        #camera.height = 10 #-.5
593
+        #print("high cam")
594
+        #camera.min = .75
595
+        #camera.max = 1.25
596
+        #cont.activate(cam.actuators['Camera']) 
597
+        
598
+        deckact = deck.actuators["Visibility"]
599
+        trucksact = trucks.actuators["Visibility"]
600
+        wheel1act = wheel1.actuators["Visibility"]
601
+        wheel2act = wheel2.actuators["Visibility"]
602
+        wheel3act = wheel3.actuators["Visibility"]
603
+        wheel4act = wheel4.actuators["Visibility"]        
604
+        deckact.visibility = True
605
+        trucksact.visibility = True
606
+        wheel1act.visibility = True
607
+        wheel2act.visibility = True
608
+        wheel3act.visibility = True
609
+        wheel4act.visibility = True  
610
+        cont.activate(deck.actuators['Visibility'])
611
+        cont.activate(trucks.actuators['Visibility'])
612
+        cont.activate(wheel1.actuators['Visibility'])
613
+        cont.activate(wheel2.actuators['Visibility'])
614
+        cont.activate(wheel3.actuators['Visibility'])
615
+        cont.activate(wheel4.actuators['Visibility']) 
616
+        own['throw_deck'] = False 
617
+        throw_deck_empty = scene.objects["throw_deck_empty"]
618
+        throw_deck_empty['kill_deck'] = 1 
619
+        fliplay3 = fliplay2 + 1  
620
+        if STANCE == 0 and dropinCol.positive == True: 
621
+            cont.deactivate(skater.actuators['aRest'])
622
+            cont.deactivate(skater.actuators['aRest_fak'])
623
+            killact(4)
624
+            killact(5)
625
+            killact(6)
626
+            killact(7)                        
627
+            skater.playAction("nreg_dropin", 50,60, layer=fliplay2, priority=0, play_mode=1, speed=.5)
628
+            deck.playAction("a_reg_dropin", 50,60, layer=fliplay2, priority=0, play_mode=1, speed=.5)
629
+            trucks.playAction("a_reg_dropin", 50,60, layer=fliplay2, priority=0, play_mode=1, speed=.5)
630
+            if lasty == False:
631
+                skater.playAction("nreg_dropin", 30,50, layer=fliplay3, priority=0, play_mode=0, speed=.75)
632
+                deck.playAction("a_reg_dropin", 30,50, layer=fliplay3, priority=0, play_mode=0, speed=.75)
633
+                trucks.playAction("a_reg_dropin", 30,50, layer=fliplay3, priority=0, play_mode=0, speed=.75)                
634
+                
635
+        if STANCE == 1 and dropinCol.positive == True: 
636
+            cont.deactivate(skater.actuators['aRest'])
637
+            cont.deactivate(skater.actuators['aRest_fak'])
638
+            killact(4)
639
+            killact(5)
640
+            killact(6)
641
+            killact(7)                        
642
+            skater.playAction("nfak_dropin", 50,60, layer=fliplay2, priority=0, play_mode=1, speed=.5)
643
+            deck.playAction("a_fak_dropin", 50,60, layer=fliplay2, priority=0, play_mode=1, speed=.5)
644
+            trucks.playAction("a_fak_dropin", 50,60, layer=fliplay2, priority=0, play_mode=1, speed=.5)
645
+            if lasty == False:
646
+                skater.playAction("nfak_dropin", 30,50, layer=fliplay3, priority=0, play_mode=0, speed=.75)
647
+                deck.playAction("a_fak_dropin", 30,50, layer=fliplay3, priority=0, play_mode=0, speed=.75)
648
+                trucks.playAction("a_fak_dropin", 30,50, layer=fliplay3, priority=0, play_mode=0, speed=.75)                      
649
+    if getonboard == 1:
650
+        fliplay3 = 6000 
651
+        onboard_speed = .1   
652
+#        if STANCE == 1:
653
+#            skater.playAction("nfak_dropin", 60,80, layer=fliplay3, priority=0, play_mode=0, speed=onboard_speed)
654
+#            deck.playAction("a_fak_dropin", 60,80, layer=fliplay3, priority=0, play_mode=0, speed=onboard_speed)
655
+#            trucks.playAction("a_fak_dropin", 60,80, layer=fliplay3, priority=0, play_mode=0, speed=onboard_speed)
656
+#        if STANCE == 0:
657
+#            skater.playAction("nreg_dropin", 60,80, layer=fliplay3, priority=0, play_mode=0, speed=onboard_speed)
658
+#            deck.playAction("a_reg_dropin", 60,80, layer=fliplay3, priority=0, play_mode=0, speed=onboard_speed)
659
+#            trucks.playAction("a_reg_dropin", 60,80, layer=fliplay3, priority=0, play_mode=0, speed=onboard_speed)                                    
660
+        own['getonboard'] = 0 
661
+    if yBut == False and lasty == True:
662
+        own['getonboard'] = 1
663
+        #camera.height = -.5
664
+        #camera.min = .75
665
+        #camera.max = 1.25         
666
+
667
+def nextframe():
668
+    framenumber = own["framenum"]
669
+    framenumber = framenumber + 1
670
+    if framenumber == 900000:
671
+        framenumber = 0
672
+    own["framenum"] = framenumber
673
+    own['last_walk_frame'] = framenumber
674
+            
675
+def checkidle():
676
+    idle = cont.sensors["idle"]
677
+    #print(idle.positive)
678
+    idle_frame = own["walk_idle_frame"]
679
+    if idle.positive:
680
+        own["walk_idle_frame"] = 0
681
+        cont.deactivate(camobj.actuators['idle_camRight'])  
682
+        camera.height = .5
683
+    else: 
684
+        if idle_frame == 0:
685
+            own["walk_idle_frame"] = own["framenum"] 
686
+        diff = own["framenum"] - idle_frame
687
+        
688
+        if (diff > 700 and idle_frame != 0 and dropinCol.positive == False and own['walk'] != 0) or own['sit'] == 1:
689
+            #print("you are idle", diff)  
690
+            cont.activate(camobj.actuators['idle_camRight'])  
691
+            camera.height = .9   
692
+            camera.min = 2
693
+            camera.max = 2.50
694
+            own['walk_idling'] = 1
695
+        else:
696
+            own['walk_idling'] = 0    
697
+            
698
+def idle_anim():
699
+    if own['walk_idling'] == 1 and own['sit'] == 0:
700
+        walk_idle_frame = own['walk_idle_frame']
701
+        #print("walk_idling")
702
+        mod_num = (own["framenum"] - walk_idle_frame) % 240
703
+        #print(walk_idle_frame, mod_num)
704
+        #killact(3)
705
+        if mod_num == 0:
706
+            if own['idle_skipper'] > 0:
707
+               own['idle_skipper'] -= 1 
708
+            ran_num = random.randint(1, 8)
709
+            #print(ran_num, "modding")
710
+            if own['last_idle_num'] == ran_num:
711
+                ran_num = 1
712
+            if own['idle_skipper'] == 0:
713
+                own['last_idle_num'] = ran_num
714
+                if ran_num == 1 or ran_num > 7:    
715
+                    killact(3)
716
+                    if STANCE == 0 and own['throw_deck'] == 0:
717
+                        skater.playAction("reg_idle1", 1,120, layer=3, play_mode=0, speed=.5)
718
+                        deck.playAction("a_reg_idle1", 1,120, layer=3, play_mode=0, speed=.5)
719
+                        trucks.playAction("a_reg_idle1", 1,120, layer=3, play_mode=0, speed=.5)
720
+                    elif STANCE == 0 and own['throw_deck'] == 1:
721
+                        skater.playAction("reg_idle1", 1,120, layer=3, play_mode=0, speed=.5)
722
+                    elif STANCE == 1 and own['throw_deck'] == 0:
723
+                        skater.playAction("fak_idle1", 1,120, layer=3, play_mode=0, speed=.5)
724
+                        deck.playAction("a_fak_idle1", 1,120, layer=3, play_mode=0, speed=.5)
725
+                        trucks.playAction("a_fak_idle1", 1,120, layer=3, play_mode=0, speed=.5) 
726
+                    elif STANCE == 1 and own['throw_deck'] == 1:
727
+                        skater.playAction("fak_idle1", 1,120, layer=3, play_mode=0, speed=.5)
728
+                                                                           
729
+                elif ran_num == 2:    
730
+                    killact(3)
731
+                    if STANCE == 0 and own['throw_deck'] == 0:
732
+                        skater.playAction("reg_idle2_", 1,120, layer=3, play_mode=0, speed=.5)
733
+                        deck.playAction("a_reg_idle2", 1,120, layer=3, play_mode=0, speed=.5)
734
+                        trucks.playAction("a_reg_idle2", 1,120, layer=3, play_mode=0, speed=.5)
735
+                    elif STANCE == 0 and own['throw_deck'] == 1:
736
+                        skater.playAction("reg_idle2_nb", 1,120, layer=3, play_mode=0, speed=.5)
737
+                    elif STANCE == 1 and own['throw_deck'] == 0:
738
+                        skater.playAction("fak_idle1", 1,120, layer=3, play_mode=0, speed=.5)
739
+                        deck.playAction("a_fak_idle1", 1,120, layer=3, play_mode=0, speed=.5)
740
+                        trucks.playAction("a_fak_idle1", 1,120, layer=3, play_mode=0, speed=.5) 
741
+                    elif STANCE == 1 and own['throw_deck'] == 1:
742
+                        skater.playAction("fak_idle1", 1,120, layer=3, play_mode=0, speed=.5)  
743
+                elif ran_num == 3:    
744
+                    killact(3)
745
+                    if STANCE == 0 and own['throw_deck'] == 0:
746
+                        skater.playAction("reg_idle3", 1,240, layer=3, play_mode=0, speed=.5)
747
+                        deck.playAction("a_reg_idle3", 1,240, layer=3, play_mode=0, speed=.5)
748
+                        trucks.playAction("a_reg_idle3", 1,240, layer=3, play_mode=0, speed=.5)
749
+                    elif STANCE == 0 and own['throw_deck'] == 1:
750
+                        skater.playAction("reg_idle3", 1,240, layer=3, play_mode=0, speed=.5)
751
+                    elif STANCE == 1 and own['throw_deck'] == 0:
752
+                        skater.playAction("fak_idle1", 1,240, layer=3, play_mode=0, speed=.5)
753
+                        deck.playAction("a_fak_idle1", 1,240, layer=3, play_mode=0, speed=.5)
754
+                        trucks.playAction("a_fak_idle1", 1,240, layer=3, play_mode=0, speed=.5) 
755
+                    elif STANCE == 1 and own['throw_deck'] == 1:
756
+                        skater.playAction("fak_idle1", 1,240, layer=3, play_mode=0, speed=.5)
757
+                    own['idle_skipper'] = 2 
758
+                elif ran_num == 4:    
759
+                    killact(3)
760
+                    if STANCE == 0 and own['throw_deck'] == 0:
761
+                        skater.playAction("reg_idle4", 1,120, layer=3, play_mode=0, speed=.5)
762
+                        deck.playAction("a_reg_idle4", 1,120, layer=3, play_mode=0, speed=.5)
763
+                        trucks.playAction("a_reg_idle4", 1,120, layer=3, play_mode=0, speed=.5)
764
+                    elif STANCE == 0 and own['throw_deck'] == 1:
765
+                        skater.playAction("reg_idle4", 1,120, layer=3, play_mode=0, speed=.5)
766
+                    elif STANCE == 1 and own['throw_deck'] == 0:
767
+                        skater.playAction("fak_idle4", 1,120, layer=3, play_mode=0, speed=.5)
768
+                        deck.playAction("a_fak_idle4", 1,120, layer=3, play_mode=0, speed=.5)
769
+                        trucks.playAction("a_fak_idle4", 1,120, layer=3, play_mode=0, speed=.5) 
770
+                    elif STANCE == 1 and own['throw_deck'] == 1:
771
+                        skater.playAction("fak_idle4", 1,120, layer=3, play_mode=0, speed=.5) 
772
+                elif ran_num == 5:    
773
+                    killact(3)
774
+                    if STANCE == 0 and own['throw_deck'] == 0:
775
+                        skater.playAction("reg_idle5", 1,120, layer=3, play_mode=0, speed=.5)
776
+                        deck.playAction("a_reg_idle5", 1,120, layer=3, play_mode=0, speed=.5)
777
+                        trucks.playAction("a_reg_idle5", 1,120, layer=3, play_mode=0, speed=.5)
778
+                    elif STANCE == 0 and own['throw_deck'] == 1:
779
+                        skater.playAction("reg_idle5", 1,120, layer=3, play_mode=0, speed=.5)
780
+                    elif STANCE == 1 and own['throw_deck'] == 0:
781
+                        skater.playAction("fak_idle5", 1,120, layer=3, play_mode=0, speed=.5)
782
+                        deck.playAction("a_fak_idle5", 1,120, layer=3, play_mode=0, speed=.5)
783
+                        trucks.playAction("a_fak_idle5", 1,120, layer=3, play_mode=0, speed=.5) 
784
+                    elif STANCE == 1 and own['throw_deck'] == 1:
785
+                        skater.playAction("fak_idle5", 1,120, layer=3, play_mode=0, speed=.5)
786
+                elif ran_num == 6:    
787
+                    killact(3)
788
+                    if STANCE == 0 and own['throw_deck'] == 0:
789
+                        skater.playAction("reg_idle6", 1,120, layer=3, play_mode=0, speed=.5)
790
+                        deck.playAction("a_reg_idle6", 1,120, layer=3, play_mode=0, speed=.5)
791
+                        trucks.playAction("a_reg_idle6", 1,120, layer=3, play_mode=0, speed=.5)
792
+                    elif STANCE == 0 and own['throw_deck'] == 1:
793
+                        skater.playAction("reg_idle6", 1,120, layer=3, play_mode=0, speed=.5)
794
+                    elif STANCE == 1 and own['throw_deck'] == 0:
795
+                        skater.playAction("fak_idle6", 1,120, layer=3, play_mode=0, speed=.5)
796
+                        deck.playAction("a_fak_idle6", 1,120, layer=3, play_mode=0, speed=.5)
797
+                        trucks.playAction("a_fak_idle6", 1,120, layer=3, play_mode=0, speed=.5) 
798
+                    elif STANCE == 1 and own['throw_deck'] == 1:
799
+                        skater.playAction("fak_idle6", 1,120, layer=3, play_mode=0, speed=.5) 
800
+                elif ran_num == 7:    
801
+                    killact(3)
802
+                    if STANCE == 0 and own['throw_deck'] == 0:
803
+                        skater.playAction("reg_idle7", 1,120, layer=3, play_mode=0, speed=.5)
804
+                        deck.playAction("a_reg_idle7", 1,120, layer=3, play_mode=0, speed=.5)
805
+                        trucks.playAction("a_reg_idle7", 1,120, layer=3, play_mode=0, speed=.5)
806
+                    elif STANCE == 0 and own['throw_deck'] == 1:
807
+                        skater.playAction("reg_idle7", 1,120, layer=3, play_mode=0, speed=.5)
808
+                    elif STANCE == 1 and own['throw_deck'] == 0:
809
+                        skater.playAction("fak_idle6", 1,120, layer=3, play_mode=0, speed=.5)
810
+                        deck.playAction("a_fak_idle6", 1,120, layer=3, play_mode=0, speed=.5)
811
+                        trucks.playAction("a_fak_idle6", 1,120, layer=3, play_mode=0, speed=.5) 
812
+                    elif STANCE == 1 and own['throw_deck'] == 1:
813
+                        skater.playAction("fak_idle6", 1,120, layer=3, play_mode=0, speed=.5)                                                                                                                                 
814
+
815
+def reset_pos():
816
+    #reset
817
+    if ddPad == 1:
818
+        
819
+        spawn_pos = own['spawn_pos']
820
+        spawn_rot = own['spawn_rot']
821
+        #spawnz = spawn_pos[2] + .1
822
+        try:
823
+            own.worldPosition = (spawn_pos[0], spawn_pos[1], spawnz)
824
+            own.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
825
+        except:    
826
+            own.worldPosition = (0, 0, .1)
827
+            own.worldOrientation = [[1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]    
828
+        if own["spawn_stance"] == 1:
829
+            own.setLinearVelocity([.1,0,0], 1)
830
+            #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
831
+            #lx = cam.localPosition[1] 
832
+            #lx = lx - 4
833
+            #cam.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
834
+            #cam.localPosition[1] = lx
835
+         
836
+        else: 
837
+            own.setLinearVelocity([-.1,0,0], 1)         
838
+            #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
839
+            #lx = cam.localPosition[1]
840
+            #lx = lx - 4
841
+            #cam.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
842
+            #cam.localPosition[1] = lx
843
+    if udPad == 1:
844
+        own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]] 
845
+        own['spawn_rot'] = [[own.worldOrientation[0][0],own.worldOrientation[0][1],own.worldOrientation[0][2]], [own.worldOrientation[1][0],own.worldOrientation[1][1],own.worldOrientation[1][2]], own.worldOrientation[2][2]]
846
+        stance = own["stance"]
847
+        own["spawn_stance"] = stance    
848
+def falldeck():
849
+    #print("falldeck")
850
+    throw_deck_empty = scene.objects["throw_deck_empty"]
851
+    deckact = deck.actuators["Visibility"]
852
+    trucksact = trucks.actuators["Visibility"]
853
+    wheel1act = wheel1.actuators["Visibility"]
854
+    wheel2act = wheel2.actuators["Visibility"]
855
+    wheel3act = wheel3.actuators["Visibility"]
856
+    wheel4act = wheel4.actuators["Visibility"]
857
+            
858
+    if own['throw_deck'] == False:
859
+        own['throw_deck'] = True
860
+        deckact.visibility = False
861
+        trucksact.visibility = False
862
+        wheel1act.visibility = False
863
+        wheel2act.visibility = False
864
+        wheel3act.visibility = False
865
+        wheel4act.visibility = False
866
+        act = throw_deck_empty.actuators['throw_dec_act']
867
+        if STANCE == True:
868
+            #skater.playAction("fak_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
869
+            act.linearVelocity = [0.0, 1.0, 1.0]
870
+        if STANCE == False:
871
+            #skater.playAction("reg_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)  
872
+            act.linearVelocity = [0.0, 1.0, -1.0]  
873
+        cont.activate(act)
874
+    else:
875
+        own['throw_deck'] = False    
876
+        deckact.visibility = True
877
+        trucksact.visibility = True
878
+        wheel1act.visibility = True
879
+        wheel2act.visibility = True
880
+        wheel3act.visibility = True
881
+        wheel4act.visibility = True
882
+        throw_deck_empty['kill_deck'] = 1 
883
+        #print("trying to kill deck")     
884
+    cont.activate(deck.actuators['Visibility'])
885
+    cont.activate(trucks.actuators['Visibility'])
886
+    cont.activate(wheel1.actuators['Visibility'])
887
+    cont.activate(wheel2.actuators['Visibility'])
888
+    cont.activate(wheel3.actuators['Visibility'])
889
+    cont.activate(wheel4.actuators['Visibility']) 
890
+
891
+def throwdeck():
892
+    throw_deck_empty = scene.objects["throw_deck_empty"]
893
+    deckact = deck.actuators["Visibility"]
894
+    trucksact = trucks.actuators["Visibility"]
895
+    wheel1act = wheel1.actuators["Visibility"]
896
+    wheel2act = wheel2.actuators["Visibility"]
897
+    wheel3act = wheel3.actuators["Visibility"]
898
+    wheel4act = wheel4.actuators["Visibility"]
899
+            
900
+    if own['throw_deck'] == False:
901
+        own['throw_deck'] = True
902
+        deckact.visibility = False
903
+        trucksact.visibility = False
904
+        wheel1act.visibility = False
905
+        wheel2act.visibility = False
906
+        wheel3act.visibility = False
907
+        wheel4act.visibility = False
908
+        act = throw_deck_empty.actuators['throw_dec_act']
909
+        if STANCE == True:
910
+            skater.playAction("fak_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
911
+            act.linearVelocity = [0.0, 5.0, 5.0]
912
+        if STANCE == False:
913
+            skater.playAction("reg_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)  
914
+            act.linearVelocity = [0.0, 5.0, -5.0]  
915
+        cont.activate(act)
916
+    else:
917
+        own['throw_deck'] = False    
918
+        deckact.visibility = True
919
+        trucksact.visibility = True
920
+        wheel1act.visibility = True
921
+        wheel2act.visibility = True
922
+        wheel3act.visibility = True
923
+        wheel4act.visibility = True
924
+        throw_deck_empty['kill_deck'] = 1 
925
+        #print("trying to kill deck")     
926
+    cont.activate(deck.actuators['Visibility'])
927
+    cont.activate(trucks.actuators['Visibility'])
928
+    cont.activate(wheel1.actuators['Visibility'])
929
+    cont.activate(wheel2.actuators['Visibility'])
930
+    cont.activate(wheel3.actuators['Visibility'])
931
+    cont.activate(wheel4.actuators['Visibility'])    
932
+        
933
+def throwdeck_trigger():
934
+    lastb = own['lastb']
935
+    throw_deck_empty = scene.objects["throw_deck_empty"]
936
+    if bBut == False:
937
+        throw_deck_empty['kill_deck'] = 0
938
+    if bBut == False and own['lastb'] == True:        
939
+        #print("throw deck")
940
+        throwdeck()        
941
+              
942
+def fall():
943
+    if own['fall'] == True:
944
+        falldeck()
945
+        if STANCE == 1:
946
+            own.setLinearVelocity([3,2,0], True)
947
+        else:
948
+            own.setLinearVelocity([-3,-2,0], True)    
949
+        own['fall'] = False
950
+
951
+def sit():
952
+    #turn off sit
953
+    if lup == 1 or ldown == 1 or lUD > sens or lUD < -sens:
954
+        if own['sit'] == 1:
955
+            killact(300)
956
+            killact(299)
957
+        own['sit'] = 0
958
+
959
+    if aBut == False and lasta == True:
960
+        #print(lasta)
961
+        try:
962
+            #print(r_ground.hitObject)
963
+            if 'sit' in r_ground.hitObject:
964
+                print("sit")
965
+                own['sit'] = 1
966
+                #killall()
967
+                killact(3)
968
+                if STANCE == 0:
969
+                    skater.playAction("reg_sit", 1,65, layer=300, play_mode=0, speed=1)
970
+                    deck.playAction("a_reg_sit", 1,65, layer=300, play_mode=0, speed=1)
971
+                    trucks.playAction("a_reg_sit", 1,65, layer=300, play_mode=0, speed=1)
972
+                elif STANCE == 1:
973
+                    skater.playAction("fak_sit", 1,65, layer=300, play_mode=0, speed=1)
974
+                    deck.playAction("a_fak_sit", 1,65, layer=300, play_mode=0, speed=1)
975
+                    trucks.playAction("a_fak_sit", 1,65, layer=300, play_mode=0, speed=1)                                         
976
+    #if own['sit'] == 1 and last_sit == 0:
977
+                 
978
+                     
979
+                
980
+        except:
981
+            #print("sit broke")
982
+            pass    
983
+    if own['sit'] == 1:
984
+        try:
985
+            killact(3)
986
+            sit_vect = r_ground.hitObject.getAxisVect( [0, 1, 0])
987
+            if STANCE == 0:
988
+                own.alignAxisToVect(-sit_vect, 0, .2)
989
+                skater.playAction("reg_sit", 65,65, layer=299, play_mode=1, speed=1)
990
+                deck.playAction("a_reg_sit", 65,65, layer=299, play_mode=1, speed=1)
991
+                trucks.playAction("a_reg_sit", 65,65, layer=299, play_mode=1, speed=1)                                 
992
+                
993
+            elif STANCE == 1:
994
+                own.alignAxisToVect(sit_vect, 0, .2) 
995
+                skater.playAction("fak_sit", 65,65, layer=299, play_mode=1, speed=1)
996
+                deck.playAction("a_fak_sit", 65,65, layer=299, play_mode=1, speed=1)
997
+                trucks.playAction("a_fak_sit", 65,65, layer=299, play_mode=1, speed=1)                    
998
+        except:
999
+            pass    
1000
+
1001
+                      
1002
+def switchcam():
1003
+    if ltsBut == False and own['lastlts'] == True and rtsBut == False:
1004
+        if own['camera'] == 1:
1005
+            own['camera'] = 0
1006
+        else:
1007
+            own['camera'] = 1
1008
+    if rtsBut == False and own['lastrts'] == True and ltsBut == False:
1009
+        if own['camera'] == 2:
1010
+            own['camera'] = 0
1011
+        else:
1012
+            own['camera'] = 2 
1013
+#followcam 
1014
+def move_followcam():
1015
+    if own['camera'] == 2:
1016
+        #if rtsBut == False and own['lastrts'] == True:
1017
+        if own['lastbkBut'] == True and bkBut == False:
1018
+            print("activate move followcam") 
1019
+            if own['move_followcam'] == False:
1020
+                own['move_followcam'] = True
1021
+            else:
1022
+                own['move_followcam'] = False                       
1023
+        if own['move_followcam'] == True:
1024
+            #act = followcam.actuators[
1025
+            camspeed1 = .015
1026
+            camspeed2 = .055
1027
+            camrot1 = .005
1028
+            camrot2 = .02
1029
+            #up
1030
+            if lUD < -0.080:
1031
+                followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
1032
+                cont.activate(followcam.actuators["up"])
1033
+                print("fastup")
1034
+            else:
1035
+                cont.deactivate(followcam.actuators["up"])    
1036
+#            #down    
1037
+            if lUD > .080:
1038
+                followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
1039
+                cont.activate(followcam.actuators["down"])
1040
+            else:
1041
+                cont.deactivate(followcam.actuators["down"])                    
1042
+#            #left
1043
+            if lLR < -0.080:
1044
+                followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]                
1045
+                cont.activate(followcam.actuators["left"])
1046
+            else:
1047
+                cont.deactivate(followcam.actuators["left"])                    
1048
+#            #right
1049
+            if lLR > 0.080:         
1050
+                followcam.actuators["right"].dLoc = [camspeed2, 0, 0]                
1051
+                cont.activate(followcam.actuators["right"])
1052
+            else:
1053
+                cont.deactivate(followcam.actuators["right"])  
1054
+            #up
1055
+            if rUD < -0.080:
1056
+                followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
1057
+                cont.activate(followcam.actuators["rotup"])
1058
+                #print("uppppppppppppppppppppppppppp")
1059
+            else:
1060
+                cont.deactivate(followcam.actuators["rotup"])    
1061
+#            #down    
1062
+            if rUD > .080:
1063
+                followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]                
1064
+                cont.activate(followcam.actuators["rotdown"])
1065
+            else:
1066
+                cont.deactivate(followcam.actuators["rotdown"])                    
1067
+#            #left
1068
+            if rLR < -0.080:
1069
+                followcam.actuators["rotleft"].dRot = [0, 0, camrot2]                
1070
+                cont.activate(followcam.actuators["rotleft"])
1071
+            else:
1072
+                cont.deactivate(followcam.actuators["rotleft"])                    
1073
+#            #right
1074
+            if rLR > 0.080:         
1075
+                followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
1076
+                cont.activate(followcam.actuators["rotright"])
1077
+            else:
1078
+                cont.deactivate(followcam.actuators["rotright"]) 
1079
+
1080
+#*********************************************                
1081
+                
1082
+            if lUD > -0.080 and lUD < -0.030:
1083
+                followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
1084
+                cont.activate(followcam.actuators["up"])
1085
+                #print(lUD)
1086
+            else:
1087
+                cont.deactivate(followcam.actuators["up"])    
1088
+#            #down    
1089
+            if lUD < .080 and lUD > .03:
1090
+                followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]                
1091
+                cont.activate(followcam.actuators["down"])
1092
+            else:
1093
+                cont.deactivate(followcam.actuators["down"])                    
1094
+#            #left
1095
+            if lLR > -0.080 and lLR < -0.030:
1096
+                followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]                
1097
+                cont.activate(followcam.actuators["left"])
1098
+            else:
1099
+                cont.deactivate(followcam.actuators["left"])                    
1100
+#            #right
1101
+            if lLR < .080 and lLR > .03:       
1102
+                followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
1103
+                cont.activate(followcam.actuators["right"])
1104
+            else:
1105
+                cont.deactivate(followcam.actuators["right"])  
1106
+            #up
1107
+            if rUD > -0.080 and rUD < -0.030:
1108
+                followcam.actuators["rotup"].dRot = [camrot1, 0, 0]                
1109
+                cont.activate(followcam.actuators["rotup"])
1110
+            else:
1111
+                cont.deactivate(followcam.actuators["rotup"])    
1112
+#            #down    
1113
+            if rUD < .080 and rUD > .03:
1114
+                followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]                
1115
+                cont.activate(followcam.actuators["rotdown"])
1116
+            else:
1117
+                cont.deactivate(followcam.actuators["rotdown"])                    
1118
+#            #left
1119
+            if rLR > -0.080 and rLR < -0.030:
1120
+                followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
1121
+                cont.activate(followcam.actuators["rotleft"])
1122
+            else:
1123
+                cont.deactivate(followcam.actuators["rotleft"])                    
1124
+#            #right
1125
+            if rLR < .080 and rLR > .03:         
1126
+                followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
1127
+                cont.activate(followcam.actuators["rotright"])
1128
+            else:
1129
+                cont.deactivate(followcam.actuators["rotright"])                       
1130
+def move_flycam():
1131
+    if own['camera'] == 1:
1132
+        #if rtsBut == False and own['lastrts'] == True:
1133
+        if own['lastbkBut'] == True and bkBut == False: 
1134
+            if own['move_freecam'] == False:
1135
+                own['move_freecam'] = True
1136
+            else:
1137
+                own['move_freecam'] = False                       
1138
+        if own['move_freecam'] == True:
1139
+            #act = freecam.actuators[
1140
+            camspeed1 = .015
1141
+            camspeed2 = .055
1142
+            camrot1 = .005
1143
+            camrot2 = .02
1144
+            #up
1145
+            if lUD < -0.080:
1146
+                freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
1147
+                cont.activate(freecam.actuators["up"])
1148
+                #print("fastup")
1149
+            else:
1150
+                cont.deactivate(freecam.actuators["up"])    
1151
+#            #down    
1152
+            if lUD > .080:
1153
+                freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
1154
+                cont.activate(freecam.actuators["down"])
1155
+            else:
1156
+                cont.deactivate(freecam.actuators["down"])                    
1157
+#            #left
1158
+            if lLR < -0.080:
1159
+                freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]                
1160
+                cont.activate(freecam.actuators["left"])
1161
+            else:
1162
+                cont.deactivate(freecam.actuators["left"])                    
1163
+#            #right
1164
+            if lLR > 0.080:         
1165
+                freecam.actuators["right"].dLoc = [camspeed2, 0, 0]                
1166
+                cont.activate(freecam.actuators["right"])
1167
+            else:
1168
+                cont.deactivate(freecam.actuators["right"])  
1169
+            #up
1170
+            if rUD < -0.080:
1171
+                freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
1172
+                cont.activate(freecam.actuators["rotup"])
1173
+            else:
1174
+                cont.deactivate(freecam.actuators["rotup"])    
1175
+#            #down    
1176
+            if rUD > .080:
1177
+                freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]                
1178
+                cont.activate(freecam.actuators["rotdown"])
1179
+            else:
1180
+                cont.deactivate(freecam.actuators["rotdown"])                    
1181
+#            #left
1182
+            if rLR < -0.080:
1183
+                freecam.actuators["rotleft"].dRot = [0, 0, camrot2]                
1184
+                cont.activate(freecam.actuators["rotleft"])
1185
+            else:
1186
+                cont.deactivate(freecam.actuators["rotleft"])                    
1187
+#            #right
1188
+            if rLR > 0.080:         
1189
+                freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
1190
+                cont.activate(freecam.actuators["rotright"])
1191
+            else:
1192
+                cont.deactivate(freecam.actuators["rotright"]) 
1193
+
1194
+#*********************************************                
1195
+                
1196
+            if lUD > -0.080 and lUD < -0.030:
1197
+                freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
1198
+                cont.activate(freecam.actuators["up"])
1199
+                #print(lUD)
1200
+            else:
1201
+                cont.deactivate(freecam.actuators["up"])    
1202
+#            #down    
1203
+            if lUD < .080 and lUD > .03:
1204
+                freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]                
1205
+                cont.activate(freecam.actuators["down"])
1206
+            else:
1207
+                cont.deactivate(freecam.actuators["down"])                    
1208
+#            #left
1209
+            if lLR > -0.080 and lLR < -0.030:
1210
+                freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]                
1211
+                cont.activate(freecam.actuators["left"])
1212
+            else:
1213
+                cont.deactivate(freecam.actuators["left"])                    
1214
+#            #right
1215
+            if lLR < .080 and lLR > .03:       
1216
+                freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
1217
+                cont.activate(freecam.actuators["right"])
1218
+            else:
1219
+                cont.deactivate(freecam.actuators["right"])  
1220
+            #up
1221
+            if rUD > -0.080 and rUD < -0.030:
1222
+                freecam.actuators["rotup"].dRot = [camrot1, 0, 0]                
1223
+                cont.activate(freecam.actuators["rotup"])
1224
+            else:
1225
+                cont.deactivate(freecam.actuators["rotup"])    
1226
+#            #down    
1227
+            if rUD < .080 and rUD > .03:
1228
+                freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]                
1229
+                cont.activate(freecam.actuators["rotdown"])
1230
+            else:
1231
+                cont.deactivate(freecam.actuators["rotdown"])                    
1232
+#            #left
1233
+            if rLR > -0.080 and rLR < -0.030:
1234
+                freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
1235
+                cont.activate(freecam.actuators["rotleft"])
1236
+            else:
1237
+                cont.deactivate(freecam.actuators["rotleft"])                    
1238
+#            #right
1239
+            if rLR < .080 and rLR > .03:         
1240
+                freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
1241
+                cont.activate(freecam.actuators["rotright"])
1242
+            else:
1243
+                cont.deactivate(freecam.actuators["rotright"])                     
1244
+if r_ground.triggered == False:
1245
+    cont.deactivate(own.actuators["walk_align"])
1246
+else:
1247
+    cont.activate(own.actuators["walk_align"])                    
1248
+
1249
+if r_ground.triggered:
1250
+    #print("on stair")
1251
+    try:
1252
+        if 'stair' in r_ground.hitObject:
1253
+            own['stair_counter'] = 20
1254
+            force = [ 0.0, 0.0, -100]
1255
+            # use local axis
1256
+            local = True
1257
+            # apply force
1258
+            #own.applyForce(force, local)        
1259
+    except:
1260
+        pass        
1261
+    if own['stair_counter'] > 0:
1262
+       own['stair_counter'] -= 1     
1263
+
1264
+if yBut == True:
1265
+    own['walk_idling'] = 0
1266
+    own["walk_idle_frame"] = 0
1267
+
1268
+                    
1269
+onboard() 
1270
+jump()
1271
+dropin()
1272
+throwdeck_trigger()
1273
+
1274
+nextframe()
1275
+checkidle()
1276
+getonboard()
1277
+reset_pos()
1278
+switchcam()
1279
+move_flycam()
1280
+move_followcam()
1281
+fall()
1282
+idle_anim()
1283
+sit()
1284
+#cont.activate(cam.actuators['Camera'])
1285
+#printplaying() 
1286
+
1287
+own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
1288
+own.actuators["sroll"].stopSound() 
1289
+wheel1 = scene.objects["rollen.000"]
1290
+wheel2 = scene.objects["rollen.001"]
1291
+wheel3 = scene.objects["rollen.002"]
1292
+wheel4 = scene.objects["rollen.003"]
1293
+wheel1.stopAction(2)
1294
+wheel2.stopAction(2)
1295
+wheel3.stopAction(2)
1296
+wheel4.stopAction(2)
1297
+
1298
+
1299
+own['lasty'] = yBut
1300
+own['lastb'] = bBut  
1301
+own['lasta'] = aBut
1302
+own['lastx'] = xBut   
1303
+own['lastlts'] = ltsBut
1304
+own['lastrts'] = rtsBut        
1305
+own['lastbkBut'] = bkBut
1306
+own['dropinCol'] = dropinCol
1307
+own['walk'] = 1
1308
+    

+ 5
- 0
test2.sh View File

@@ -0,0 +1,5 @@
1
+expect - <<EOF  
2
+spawn git push -u gogs master
3
+expect "Username for 'http://shuvit.org:3000'"
4
+send "shuvit\n"
5
+EOF

Loading…
Cancel
Save