Browse Source

add walk.py

shuvit 6 years ago
parent
commit
ac61ea88cf
1 changed files with 1307 additions and 0 deletions
  1. 1307
    0
      walk.py

+ 1307
- 0
walk.py View File

@@ -0,0 +1,1307 @@
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
+        #deck.playAction("a_reg_idle1", 1,120, layer=3, play_mode=1)
815
+        #trucks.playAction("a_reg_idle1", 1,120, layer=3, play_mode=1) 
816
+                
817
+
818
+def reset_pos():
819
+    #reset
820
+    if ddPad == 1:
821
+        
822
+        spawn_pos = own['spawn_pos']
823
+        spawn_rot = own['spawn_rot']
824
+        spawnz = spawn_pos[2] + .1
825
+        own.worldPosition = (spawn_pos[0], spawn_pos[1], spawnz)
826
+        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]]
827
+        if own["spawn_stance"] == 1:
828
+            own.setLinearVelocity([.1,0,0], 1)
829
+            #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
830
+            #lx = cam.localPosition[1] 
831
+            #lx = lx - 4
832
+            #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]]
833
+            #cam.localPosition[1] = lx
834
+         
835
+        else: 
836
+            own.setLinearVelocity([-.1,0,0], 1)         
837
+            #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
838
+            #lx = cam.localPosition[1]
839
+            #lx = lx - 4
840
+            #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]]
841
+            #cam.localPosition[1] = lx
842
+    if udPad == 1:
843
+        own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]] 
844
+        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]]
845
+        stance = own["stance"]
846
+        own["spawn_stance"] = stance    
847
+def falldeck():
848
+    #print("falldeck")
849
+    throw_deck_empty = scene.objects["throw_deck_empty"]
850
+    deckact = deck.actuators["Visibility"]
851
+    trucksact = trucks.actuators["Visibility"]
852
+    wheel1act = wheel1.actuators["Visibility"]
853
+    wheel2act = wheel2.actuators["Visibility"]
854
+    wheel3act = wheel3.actuators["Visibility"]
855
+    wheel4act = wheel4.actuators["Visibility"]
856
+            
857
+    if own['throw_deck'] == False:
858
+        own['throw_deck'] = True
859
+        deckact.visibility = False
860
+        trucksact.visibility = False
861
+        wheel1act.visibility = False
862
+        wheel2act.visibility = False
863
+        wheel3act.visibility = False
864
+        wheel4act.visibility = False
865
+        act = throw_deck_empty.actuators['throw_dec_act']
866
+        if STANCE == True:
867
+            #skater.playAction("fak_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
868
+            act.linearVelocity = [0.0, 1.0, 1.0]
869
+        if STANCE == False:
870
+            #skater.playAction("reg_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)  
871
+            act.linearVelocity = [0.0, 1.0, -1.0]  
872
+        cont.activate(act)
873
+    else:
874
+        own['throw_deck'] = False    
875
+        deckact.visibility = True
876
+        trucksact.visibility = True
877
+        wheel1act.visibility = True
878
+        wheel2act.visibility = True
879
+        wheel3act.visibility = True
880
+        wheel4act.visibility = True
881
+        throw_deck_empty['kill_deck'] = 1 
882
+        #print("trying to kill deck")     
883
+    cont.activate(deck.actuators['Visibility'])
884
+    cont.activate(trucks.actuators['Visibility'])
885
+    cont.activate(wheel1.actuators['Visibility'])
886
+    cont.activate(wheel2.actuators['Visibility'])
887
+    cont.activate(wheel3.actuators['Visibility'])
888
+    cont.activate(wheel4.actuators['Visibility']) 
889
+
890
+def throwdeck():
891
+    throw_deck_empty = scene.objects["throw_deck_empty"]
892
+    deckact = deck.actuators["Visibility"]
893
+    trucksact = trucks.actuators["Visibility"]
894
+    wheel1act = wheel1.actuators["Visibility"]
895
+    wheel2act = wheel2.actuators["Visibility"]
896
+    wheel3act = wheel3.actuators["Visibility"]
897
+    wheel4act = wheel4.actuators["Visibility"]
898
+            
899
+    if own['throw_deck'] == False:
900
+        own['throw_deck'] = True
901
+        deckact.visibility = False
902
+        trucksact.visibility = False
903
+        wheel1act.visibility = False
904
+        wheel2act.visibility = False
905
+        wheel3act.visibility = False
906
+        wheel4act.visibility = False
907
+        act = throw_deck_empty.actuators['throw_dec_act']
908
+        if STANCE == True:
909
+            skater.playAction("fak_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
910
+            act.linearVelocity = [0.0, 5.0, 5.0]
911
+        if STANCE == False:
912
+            skater.playAction("reg_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)  
913
+            act.linearVelocity = [0.0, 5.0, -5.0]  
914
+        cont.activate(act)
915
+    else:
916
+        own['throw_deck'] = False    
917
+        deckact.visibility = True
918
+        trucksact.visibility = True
919
+        wheel1act.visibility = True
920
+        wheel2act.visibility = True
921
+        wheel3act.visibility = True
922
+        wheel4act.visibility = True
923
+        throw_deck_empty['kill_deck'] = 1 
924
+        #print("trying to kill deck")     
925
+    cont.activate(deck.actuators['Visibility'])
926
+    cont.activate(trucks.actuators['Visibility'])
927
+    cont.activate(wheel1.actuators['Visibility'])
928
+    cont.activate(wheel2.actuators['Visibility'])
929
+    cont.activate(wheel3.actuators['Visibility'])
930
+    cont.activate(wheel4.actuators['Visibility'])    
931
+        
932
+def throwdeck_trigger():
933
+    lastb = own['lastb']
934
+    throw_deck_empty = scene.objects["throw_deck_empty"]
935
+    if bBut == False:
936
+        throw_deck_empty['kill_deck'] = 0
937
+    if bBut == False and own['lastb'] == True:        
938
+        #print("throw deck")
939
+        throwdeck()        
940
+              
941
+def fall():
942
+    if own['fall'] == True:
943
+        falldeck()
944
+        if STANCE == 1:
945
+            own.setLinearVelocity([3,2,0], True)
946
+        else:
947
+            own.setLinearVelocity([-3,-2,0], True)    
948
+        own['fall'] = False
949
+
950
+def sit():
951
+    #turn off sit
952
+    if lup == 1 or ldown == 1 or lUD > sens or lUD < -sens:
953
+        if own['sit'] == 1:
954
+            killact(300)
955
+            killact(299)
956
+        own['sit'] = 0
957
+
958
+    if aBut == False and lasta == True:
959
+        #print(lasta)
960
+        try:
961
+            #print(r_ground.hitObject)
962
+            if 'sit' in r_ground.hitObject:
963
+                print("sit")
964
+                own['sit'] = 1
965
+                #killall()
966
+                killact(3)
967
+                if STANCE == 0:
968
+                    skater.playAction("reg_sit", 1,65, layer=300, play_mode=0, speed=1)
969
+                    deck.playAction("a_reg_sit", 1,65, layer=300, play_mode=0, speed=1)
970
+                    trucks.playAction("a_reg_sit", 1,65, layer=300, play_mode=0, speed=1)
971
+                elif STANCE == 1:
972
+                    skater.playAction("fak_sit", 1,65, layer=300, play_mode=0, speed=1)
973
+                    deck.playAction("a_fak_sit", 1,65, layer=300, play_mode=0, speed=1)
974
+                    trucks.playAction("a_fak_sit", 1,65, layer=300, play_mode=0, speed=1)                                         
975
+    #if own['sit'] == 1 and last_sit == 0:
976
+                 
977
+                     
978
+                
979
+        except:
980
+            #print("sit broke")
981
+            pass    
982
+    if own['sit'] == 1:
983
+        try:
984
+            killact(3)
985
+            sit_vect = r_ground.hitObject.getAxisVect( [0, 1, 0])
986
+            if STANCE == 0:
987
+                own.alignAxisToVect(-sit_vect, 0, .2)
988
+                skater.playAction("reg_sit", 65,65, layer=299, play_mode=1, speed=1)
989
+                deck.playAction("a_reg_sit", 65,65, layer=299, play_mode=1, speed=1)
990
+                trucks.playAction("a_reg_sit", 65,65, layer=299, play_mode=1, speed=1)                                 
991
+                
992
+            elif STANCE == 1:
993
+                own.alignAxisToVect(sit_vect, 0, .2) 
994
+                skater.playAction("fak_sit", 65,65, layer=299, play_mode=1, speed=1)
995
+                deck.playAction("a_fak_sit", 65,65, layer=299, play_mode=1, speed=1)
996
+                trucks.playAction("a_fak_sit", 65,65, layer=299, play_mode=1, speed=1)                    
997
+        except:
998
+            pass    
999
+
1000
+                      
1001
+def switchcam():
1002
+    if ltsBut == False and own['lastlts'] == True and rtsBut == False:
1003
+        if own['camera'] == 1:
1004
+            own['camera'] = 0
1005
+        else:
1006
+            own['camera'] = 1
1007
+    if rtsBut == False and own['lastrts'] == True and ltsBut == False:
1008
+        if own['camera'] == 2:
1009
+            own['camera'] = 0
1010
+        else:
1011
+            own['camera'] = 2 
1012
+#followcam 
1013
+def move_followcam():
1014
+    if own['camera'] == 2:
1015
+        #if rtsBut == False and own['lastrts'] == True:
1016
+        if own['lastbkBut'] == True and bkBut == False:
1017
+            print("activate move followcam") 
1018
+            if own['move_followcam'] == False:
1019
+                own['move_followcam'] = True
1020
+            else:
1021
+                own['move_followcam'] = False                       
1022
+        if own['move_followcam'] == True:
1023
+            #act = followcam.actuators[
1024
+            camspeed1 = .015
1025
+            camspeed2 = .055
1026
+            camrot1 = .005
1027
+            camrot2 = .02
1028
+            #up
1029
+            if lUD < -0.080:
1030
+                followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
1031
+                cont.activate(followcam.actuators["up"])
1032
+                print("fastup")
1033
+            else:
1034
+                cont.deactivate(followcam.actuators["up"])    
1035
+#            #down    
1036
+            if lUD > .080:
1037
+                followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
1038
+                cont.activate(followcam.actuators["down"])
1039
+            else:
1040
+                cont.deactivate(followcam.actuators["down"])                    
1041
+#            #left
1042
+            if lLR < -0.080:
1043
+                followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]                
1044
+                cont.activate(followcam.actuators["left"])
1045
+            else:
1046
+                cont.deactivate(followcam.actuators["left"])                    
1047
+#            #right
1048
+            if lLR > 0.080:         
1049
+                followcam.actuators["right"].dLoc = [camspeed2, 0, 0]                
1050
+                cont.activate(followcam.actuators["right"])
1051
+            else:
1052
+                cont.deactivate(followcam.actuators["right"])  
1053
+            #up
1054
+            if rUD < -0.080:
1055
+                followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
1056
+                cont.activate(followcam.actuators["rotup"])
1057
+                #print("uppppppppppppppppppppppppppp")
1058
+            else:
1059
+                cont.deactivate(followcam.actuators["rotup"])    
1060
+#            #down    
1061
+            if rUD > .080:
1062
+                followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]                
1063
+                cont.activate(followcam.actuators["rotdown"])
1064
+            else:
1065
+                cont.deactivate(followcam.actuators["rotdown"])                    
1066
+#            #left
1067
+            if rLR < -0.080:
1068
+                followcam.actuators["rotleft"].dRot = [0, 0, camrot2]                
1069
+                cont.activate(followcam.actuators["rotleft"])
1070
+            else:
1071
+                cont.deactivate(followcam.actuators["rotleft"])                    
1072
+#            #right
1073
+            if rLR > 0.080:         
1074
+                followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
1075
+                cont.activate(followcam.actuators["rotright"])
1076
+            else:
1077
+                cont.deactivate(followcam.actuators["rotright"]) 
1078
+
1079
+#*********************************************                
1080
+                
1081
+            if lUD > -0.080 and lUD < -0.030:
1082
+                followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
1083
+                cont.activate(followcam.actuators["up"])
1084
+                #print(lUD)
1085
+            else:
1086
+                cont.deactivate(followcam.actuators["up"])    
1087
+#            #down    
1088
+            if lUD < .080 and lUD > .03:
1089
+                followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]                
1090
+                cont.activate(followcam.actuators["down"])
1091
+            else:
1092
+                cont.deactivate(followcam.actuators["down"])                    
1093
+#            #left
1094
+            if lLR > -0.080 and lLR < -0.030:
1095
+                followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]                
1096
+                cont.activate(followcam.actuators["left"])
1097
+            else:
1098
+                cont.deactivate(followcam.actuators["left"])                    
1099
+#            #right
1100
+            if lLR < .080 and lLR > .03:       
1101
+                followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
1102
+                cont.activate(followcam.actuators["right"])
1103
+            else:
1104
+                cont.deactivate(followcam.actuators["right"])  
1105
+            #up
1106
+            if rUD > -0.080 and rUD < -0.030:
1107
+                followcam.actuators["rotup"].dRot = [camrot1, 0, 0]                
1108
+                cont.activate(followcam.actuators["rotup"])
1109
+            else:
1110
+                cont.deactivate(followcam.actuators["rotup"])    
1111
+#            #down    
1112
+            if rUD < .080 and rUD > .03:
1113
+                followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]                
1114
+                cont.activate(followcam.actuators["rotdown"])
1115
+            else:
1116
+                cont.deactivate(followcam.actuators["rotdown"])                    
1117
+#            #left
1118
+            if rLR > -0.080 and rLR < -0.030:
1119
+                followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
1120
+                cont.activate(followcam.actuators["rotleft"])
1121
+            else:
1122
+                cont.deactivate(followcam.actuators["rotleft"])                    
1123
+#            #right
1124
+            if rLR < .080 and rLR > .03:         
1125
+                followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
1126
+                cont.activate(followcam.actuators["rotright"])
1127
+            else:
1128
+                cont.deactivate(followcam.actuators["rotright"])                       
1129
+def move_flycam():
1130
+    if own['camera'] == 1:
1131
+        #if rtsBut == False and own['lastrts'] == True:
1132
+        if own['lastbkBut'] == True and bkBut == False: 
1133
+            if own['move_freecam'] == False:
1134
+                own['move_freecam'] = True
1135
+            else:
1136
+                own['move_freecam'] = False                       
1137
+        if own['move_freecam'] == True:
1138
+            #act = freecam.actuators[
1139
+            camspeed1 = .015
1140
+            camspeed2 = .055
1141
+            camrot1 = .005
1142
+            camrot2 = .02
1143
+            #up
1144
+            if lUD < -0.080:
1145
+                freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
1146
+                cont.activate(freecam.actuators["up"])
1147
+                #print("fastup")
1148
+            else:
1149
+                cont.deactivate(freecam.actuators["up"])    
1150
+#            #down    
1151
+            if lUD > .080:
1152
+                freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
1153
+                cont.activate(freecam.actuators["down"])
1154
+            else:
1155
+                cont.deactivate(freecam.actuators["down"])                    
1156
+#            #left
1157
+            if lLR < -0.080:
1158
+                freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]                
1159
+                cont.activate(freecam.actuators["left"])
1160
+            else:
1161
+                cont.deactivate(freecam.actuators["left"])                    
1162
+#            #right
1163
+            if lLR > 0.080:         
1164
+                freecam.actuators["right"].dLoc = [camspeed2, 0, 0]                
1165
+                cont.activate(freecam.actuators["right"])
1166
+            else:
1167
+                cont.deactivate(freecam.actuators["right"])  
1168
+            #up
1169
+            if rUD < -0.080:
1170
+                freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
1171
+                cont.activate(freecam.actuators["rotup"])
1172
+            else:
1173
+                cont.deactivate(freecam.actuators["rotup"])    
1174
+#            #down    
1175
+            if rUD > .080:
1176
+                freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]                
1177
+                cont.activate(freecam.actuators["rotdown"])
1178
+            else:
1179
+                cont.deactivate(freecam.actuators["rotdown"])                    
1180
+#            #left
1181
+            if rLR < -0.080:
1182
+                freecam.actuators["rotleft"].dRot = [0, 0, camrot2]                
1183
+                cont.activate(freecam.actuators["rotleft"])
1184
+            else:
1185
+                cont.deactivate(freecam.actuators["rotleft"])                    
1186
+#            #right
1187
+            if rLR > 0.080:         
1188
+                freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
1189
+                cont.activate(freecam.actuators["rotright"])
1190
+            else:
1191
+                cont.deactivate(freecam.actuators["rotright"]) 
1192
+
1193
+#*********************************************                
1194
+                
1195
+            if lUD > -0.080 and lUD < -0.030:
1196
+                freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
1197
+                cont.activate(freecam.actuators["up"])
1198
+                #print(lUD)
1199
+            else:
1200
+                cont.deactivate(freecam.actuators["up"])    
1201
+#            #down    
1202
+            if lUD < .080 and lUD > .03:
1203
+                freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]                
1204
+                cont.activate(freecam.actuators["down"])
1205
+            else:
1206
+                cont.deactivate(freecam.actuators["down"])                    
1207
+#            #left
1208
+            if lLR > -0.080 and lLR < -0.030:
1209
+                freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]                
1210
+                cont.activate(freecam.actuators["left"])
1211
+            else:
1212
+                cont.deactivate(freecam.actuators["left"])                    
1213
+#            #right
1214
+            if lLR < .080 and lLR > .03:       
1215
+                freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
1216
+                cont.activate(freecam.actuators["right"])
1217
+            else:
1218
+                cont.deactivate(freecam.actuators["right"])  
1219
+            #up
1220
+            if rUD > -0.080 and rUD < -0.030:
1221
+                freecam.actuators["rotup"].dRot = [camrot1, 0, 0]                
1222
+                cont.activate(freecam.actuators["rotup"])
1223
+            else:
1224
+                cont.deactivate(freecam.actuators["rotup"])    
1225
+#            #down    
1226
+            if rUD < .080 and rUD > .03:
1227
+                freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]                
1228
+                cont.activate(freecam.actuators["rotdown"])
1229
+            else:
1230
+                cont.deactivate(freecam.actuators["rotdown"])                    
1231
+#            #left
1232
+            if rLR > -0.080 and rLR < -0.030:
1233
+                freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
1234
+                cont.activate(freecam.actuators["rotleft"])
1235
+            else:
1236
+                cont.deactivate(freecam.actuators["rotleft"])                    
1237
+#            #right
1238
+            if rLR < .080 and rLR > .03:         
1239
+                freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
1240
+                cont.activate(freecam.actuators["rotright"])
1241
+            else:
1242
+                cont.deactivate(freecam.actuators["rotright"])                     
1243
+if r_ground.triggered == False:
1244
+    cont.deactivate(own.actuators["walk_align"])
1245
+else:
1246
+    cont.activate(own.actuators["walk_align"])                    
1247
+
1248
+if r_ground.triggered:
1249
+    #print("on stair")
1250
+    try:
1251
+        if 'stair' in r_ground.hitObject:
1252
+            own['stair_counter'] = 20
1253
+            force = [ 0.0, 0.0, -100]
1254
+            # use local axis
1255
+            local = True
1256
+            # apply force
1257
+            #own.applyForce(force, local)        
1258
+    except:
1259
+        pass        
1260
+    if own['stair_counter'] > 0:
1261
+       own['stair_counter'] -= 1     
1262
+
1263
+if yBut == True:
1264
+    own['walk_idling'] = 0
1265
+    own["walk_idle_frame"] = 0
1266
+
1267
+                    
1268
+onboard() 
1269
+jump()
1270
+dropin()
1271
+throwdeck_trigger()
1272
+
1273
+nextframe()
1274
+checkidle()
1275
+getonboard()
1276
+reset_pos()
1277
+switchcam()
1278
+move_flycam()
1279
+move_followcam()
1280
+fall()
1281
+idle_anim()
1282
+sit()
1283
+#cont.activate(cam.actuators['Camera'])
1284
+#printplaying() 
1285
+
1286
+own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
1287
+own.actuators["sroll"].stopSound() 
1288
+wheel1 = scene.objects["rollen.000"]
1289
+wheel2 = scene.objects["rollen.001"]
1290
+wheel3 = scene.objects["rollen.002"]
1291
+wheel4 = scene.objects["rollen.003"]
1292
+wheel1.stopAction(2)
1293
+wheel2.stopAction(2)
1294
+wheel3.stopAction(2)
1295
+wheel4.stopAction(2)
1296
+
1297
+
1298
+own['lasty'] = yBut
1299
+own['lastb'] = bBut  
1300
+own['lasta'] = aBut
1301
+own['lastx'] = xBut   
1302
+own['lastlts'] = ltsBut
1303
+own['lastrts'] = rtsBut        
1304
+own['lastbkBut'] = bkBut
1305
+own['dropinCol'] = dropinCol
1306
+own['walk'] = 1
1307
+    

Loading…
Cancel
Save