Shuvit game master repo. http://shuvit.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

walk.py 46KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143
  1. #shuvit.org
  2. #walk.py
  3. import bge
  4. import GameLogic
  5. import ctypes
  6. #import bpy
  7. import random
  8. import math
  9. #build global dict (move this to separate script that runs once)
  10. scene = bge.logic.getCurrentScene()
  11. objList = scene.objects
  12. cont = GameLogic.getCurrentController()
  13. obj = bge.logic.getCurrentScene().objects
  14. char = bge.constraints.getCharacter
  15. own = cont.owner
  16. stance = own['stance']
  17. STANCE = own['stance']
  18. r_ground = cont.sensors["r_Ground"]
  19. linvel = own.getLinearVelocity(True)
  20. lasta = own['lasta']
  21. lastx = own['lastx']
  22. last_sit = own['sit']
  23. dict = bge.logic.globalDict
  24. try:
  25. own['walk_timer'] = own['walk_timer'] +1
  26. except:
  27. own['walk_timer'] = 1
  28. truckon = 30
  29. deckon = 30
  30. lLR = dict['lLR']
  31. lUD = dict['lUD']
  32. rLR = dict['rLR']
  33. rUD = dict['rUD']
  34. lTrig = dict['lTrig']
  35. rTrig = dict['rTrig']
  36. aBut = dict['aBut']
  37. bBut = dict['bBut']
  38. xBut = dict['xBut']
  39. yBut = dict['yBut']
  40. lBump = dict['lBump']
  41. rBump = dict['rBump']
  42. bkBut = dict['bkBut']
  43. stBut = dict['stBut']
  44. xbBut = dict['xbBut']
  45. ltsBut = dict['ltsBut']
  46. rtsBut = dict['rtsBut']
  47. ldPad = dict['ldPad']
  48. rdPad = dict['rdPad']
  49. udPad = dict['udPad']
  50. ddPad = dict['ddPad']
  51. #user
  52. sens = .04
  53. fliplay = 30
  54. dropinCol = own.sensors['dropinCol']
  55. skater = scene.objects["Char4"]
  56. deck = scene.objects["deck"]
  57. trucks = scene.objects["trucks"]
  58. throw_deck_empty = scene.objects["throw_deck_empty"]
  59. wheel1 = scene.objects["rollen.000"]
  60. wheel2 = scene.objects["rollen.001"]
  61. wheel3 = scene.objects["rollen.002"]
  62. wheel4 = scene.objects["rollen.003"]
  63. camobj = scene.objects["Camera.003"]
  64. camera = cont.actuators["Camera"]
  65. replayCam = cont.actuators["replayCam"]
  66. timer = own['dropinTimer']
  67. cam = scene.objects["Camera.003"]
  68. freecam = scene.objects["freecam"]
  69. followcam = scene.objects["followcam"]
  70. noidle = 0
  71. playing_deck = deck.isPlayingAction(deckon)
  72. playing_trucks = trucks.isPlayingAction(truckon)
  73. if playing_deck == 1 or playing_trucks == 1:
  74. noidle = 1
  75. if own["stance"] == None:
  76. own["stance"] = True
  77. STANCE = own["stance"]
  78. def killact(layer):
  79. if skater.isPlayingAction(layer):
  80. skater.stopAction(layer)
  81. if deck.isPlayingAction(layer):
  82. deck.stopAction(layer)
  83. if trucks.isPlayingAction(layer):
  84. trucks.stopAction(layer)
  85. def killall():
  86. for x in range(5000):
  87. skater.stopAction(x)
  88. deck.stopAction(x)
  89. trucks.stopAction(x)
  90. def trucksisplaying():
  91. for x in range(5000):
  92. if deck.isPlayingAction(x):
  93. print("deck is playing:", x)
  94. def printplaying():
  95. splaying_layers = "S: "
  96. playing_layers = "D: "
  97. tplaying_layers = "T: "
  98. for x in range(9900):
  99. if skater.isPlayingAction(x):
  100. #if trucks.isPlayingAction(x):
  101. #if skater.isPlayingAction(x):
  102. splaying_layers += str(x)
  103. splaying_layers += " "
  104. if deck.isPlayingAction(x):
  105. #if trucks.isPlayingAction(x):
  106. #if skater.isPlayingAction(x):
  107. playing_layers += str(x)
  108. playing_layers += " "
  109. if trucks.isPlayingAction(x):
  110. #if trucks.isPlayingAction(x):
  111. #if skater.isPlayingAction(x):
  112. tplaying_layers += str(x)
  113. tplaying_layers += " "
  114. print(splaying_layers, playing_layers, tplaying_layers)
  115. #printplaying()
  116. ##
  117. if r_ground.positive and xBut == False and lastx == False:
  118. killact(10)
  119. #killact(11)
  120. killact(12)
  121. killact(13)
  122. ######################################
  123. #idle
  124. 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 and own['dropinTimer'] == 0 and own['lasty'] == False:
  125. own['requestAction'] = 'reg_idle'
  126. if own['throw_deck'] == True:
  127. own['requestAction'] = 'reg_idle_nb'
  128. 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 and own['dropinTimer'] == 0 and own['lasty'] == False:
  129. own['requestAction'] = 'fak_idle'
  130. if own['throw_deck'] == True:
  131. own['requestAction'] = 'fak_idle_nb'
  132. if lUD < -sens:
  133. lup = 1
  134. else:
  135. lup = 0
  136. if lUD > sens:
  137. ldown = 1
  138. else:
  139. ldown = 0
  140. #walking
  141. #new walking
  142. vel = own.getLinearVelocity(True)
  143. if own['walk_timer'] < 50:
  144. velx = vel.x * .95
  145. own.setLinearVelocity([velx, 0, vel.z], True)
  146. else:
  147. own.setLinearVelocity([0, 0, vel.z], True)
  148. #print("set 0 vel")
  149. wf = 1
  150. if own['last_walk_frame'] - own['last_roll_frame'] > 55:
  151. wf = 0
  152. if (lup == 1 and aBut == 0 and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0) and wf == 0:
  153. own['walking'] = "regular"
  154. walking = "regular"
  155. elif lup == 1 and aBut == 1 and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0 and wf == 0:
  156. own['walking'] = "fast"
  157. walking = "fast"
  158. else:
  159. own['walking'] = None
  160. walking = None
  161. #print(own['walk_timer'])
  162. if walking == "regular":
  163. cont.deactivate(own.actuators['forward2'])
  164. cont.deactivate(own.actuators['backward2'])
  165. if stance == 0:
  166. cont.activate(own.actuators['forward'])
  167. else:
  168. cont.activate(own.actuators['backward'])
  169. if walking == "fast":
  170. cont.deactivate(own.actuators['forward'])
  171. cont.deactivate(own.actuators['backward'])
  172. if stance == 0:
  173. cont.activate(own.actuators['forward2'])
  174. else:
  175. cont.activate(own.actuators['backward2'])
  176. if walking == None:
  177. cont.deactivate(own.actuators['forward2'])
  178. cont.deactivate(own.actuators['backward2'])
  179. cont.deactivate(own.actuators['forward'])
  180. cont.deactivate(own.actuators['backward'])
  181. if own['walk_timer'] < 50:
  182. velx = vel.x * .95
  183. own.setLinearVelocity([velx, 0, vel.z], True)
  184. else:
  185. own.setLinearVelocity([0, 0, vel.z], True)
  186. #print("set 0 vel")
  187. #old walking
  188. if (lup == 1 and aBut == 0 and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0):
  189. own.actuators["walkondirt"].volume = .2
  190. own.actuators["walkondirt"].pitch = 1
  191. cont.activate(own.actuators["walkondirt"])
  192. if stance == 0 and skater.isPlayingAction(fliplay) == False:
  193. #without deck
  194. if own['throw_deck'] == True:
  195. own['requestAction'] = 'reg_walk_nb'
  196. else:
  197. own['requestAction'] = 'reg_walk'
  198. if stance == 1 and skater.isPlayingAction(fliplay) == False:
  199. #without deck
  200. if own['throw_deck'] == True:
  201. own['requestAction'] = 'fak_walk_nb'
  202. else:
  203. own['requestAction'] = 'fak_walk'
  204. elif lup == 1 and aBut == 1 and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0:
  205. own.actuators["walkondirt"].volume = .2
  206. own.actuators["walkondirt"].pitch = 1.3
  207. cont.activate(own.actuators["walkondirt"])
  208. if stance == 0 and skater.isPlayingAction(fliplay) == False:
  209. if own['throw_deck'] == True:
  210. own['requestAction'] = 'reg_walkFast_nb'
  211. skater.playAction("reg_nwalk_nb.001", 0,35, layer=25, play_mode=1, speed=1)
  212. else:
  213. own['requestAction'] = 'reg_walkFast'
  214. else:
  215. killact(25)
  216. killact(305)
  217. killact(306)
  218. if stance == 1 and skater.isPlayingAction(fliplay) == False:
  219. if own['throw_deck'] == True:
  220. own['requestAction'] = 'fak_walkFast_nb'
  221. skater.playAction("fak_nwalk_nb.001", 0,35, layer=24, play_mode=1, speed=1)
  222. else:
  223. own['requestAction'] = 'fak_walkFast'
  224. else:
  225. vel = own.getLinearVelocity(True)
  226. cont.deactivate(own.actuators["walkondirt"])
  227. if stance == 0:
  228. cont.deactivate(skater.actuators['aWalk'])
  229. cont.deactivate(deck.actuators['a_reg_walk'])
  230. cont.deactivate(trucks.actuators['a_reg_walk'])
  231. if stance == 1:
  232. cont.deactivate(skater.actuators['aWalk_fak'])
  233. cont.deactivate(deck.actuators['a_fak_walk'])
  234. cont.deactivate(trucks.actuators['a_fak_walk'])
  235. #in air
  236. if lup == 1 and r_ground.positive == False:
  237. if stance == 0:
  238. cont.deactivate(own.actuators['forward'])
  239. cont.deactivate(own.actuators['forward2'])
  240. cont.deactivate(skater.actuators['aWalk'])
  241. killact(4)
  242. killact(5)
  243. killact(6)
  244. killact(7)
  245. velx = linvel.x - 1
  246. own.setLinearVelocity([-1.5, linvel.y, linvel.z], 1)
  247. if stance == 1:
  248. cont.deactivate(own.actuators['backward'])
  249. cont.deactivate(own.actuators['backward2'])
  250. cont.deactivate(skater.actuators['aWalk_fak'])
  251. killact(4)
  252. killact(5)
  253. killact(6)
  254. killact(7)
  255. velx = linvel.x + 1
  256. own.setLinearVelocity([1.5, linvel.y, linvel.z], 1)
  257. #---------------
  258. if rLR > .05:
  259. cont.activate(camobj.actuators['camRight'])
  260. else:
  261. cont.deactivate(camobj.actuators['camRight'])
  262. if rLR < -.05:
  263. cont.activate(camobj.actuators['camLeft'])
  264. else:
  265. cont.deactivate(camobj.actuators['camLeft'])
  266. if rUD > .05:
  267. cont.activate(camobj.actuators['camDown'])
  268. else:
  269. cont.deactivate(camobj.actuators['camDown'])
  270. if rUD < -.05:
  271. cont.activate(camobj.actuators['camUp'])
  272. else:
  273. cont.deactivate(camobj.actuators['camUp'])
  274. #----------------
  275. camera.height = .9 #-.4
  276. camera.min = 1.5
  277. camera.max = 2
  278. #camera.object = "Char4:Mhair01"
  279. #camera.damping = 0
  280. #camera.axis = 4
  281. lasty = own['lasty']
  282. #if yBut == False and lasty == True:
  283. # if own['walk'] == 1:
  284. # killact(fliplay)
  285. #killall()
  286. #camera.damping = 0
  287. #camera.axis = 4
  288. #print(stance)
  289. def onboard():
  290. # pass
  291. if own['walk'] == 0:
  292. print("start walking")
  293. if own['framenum'] > 100 and own['fall'] == False:
  294. #pass
  295. cont.activate(own.actuators['pop'])
  296. own['getoffboard'] = False
  297. #set_vibration(0, 0.0, 0.0)
  298. fliplay = 301
  299. fliplay2 = 302
  300. fliplay3 = 303
  301. try:
  302. vel = own['offboard_vel']
  303. vel = [velx, vel.y, vel.z]
  304. except:
  305. pass
  306. if STANCE == 0:
  307. #killact(3)
  308. #killact(4)
  309. killall()
  310. skater.stopAction(fliplay)
  311. deck.stopAction(deckon)
  312. trucks.stopAction(truckon)
  313. own['requestAction'] = 'reg_offboard'
  314. if STANCE == 1:
  315. killact(3)
  316. killact(4)
  317. killall()
  318. skater.stopAction(fliplay)
  319. deck.stopAction(deckon)
  320. trucks.stopAction(truckon)
  321. own['requestAction'] = 'fak_offboard'
  322. def jump():
  323. if xBut == True:
  324. if own['lastx'] == 0:
  325. killact(3)
  326. killact(4)
  327. killact(5)
  328. killact(6)
  329. killact(7)
  330. if STANCE == 0:
  331. own['requestAction'] ='reg_jump'
  332. if STANCE == 1:
  333. own['requestAction'] ='fak_jump'
  334. JUMPHEIGHT = 1100
  335. force = [ 0.0, 0.0, JUMPHEIGHT]
  336. # use local axis
  337. local = False
  338. # apply force
  339. own.applyForce(force, local)
  340. own['lastx'] = 1
  341. else:
  342. own['lastx'] = 0
  343. def dropin():
  344. if dropinCol.positive == True:
  345. pass
  346. def getonboard():
  347. getonboard = own['getonboard']
  348. fliplay2 = 50#8560
  349. if yBut == True:
  350. #camera.height = -.4
  351. #camera.min = 1.5
  352. #camera.max = 2 #2
  353. #camera.damping = .99
  354. #camera.axis = 0
  355. #cont.deactivate(cam.actuators['replayCam'])
  356. #cont.deactivate(cam.actuators['Camera'])
  357. #camera.height = 10 #-.5
  358. #print("high cam")
  359. #camera.min = .75
  360. #camera.max = 1.25
  361. #cont.activate(cam.actuators['Camera'])
  362. deckact = deck.actuators["Visibility"]
  363. trucksact = trucks.actuators["Visibility"]
  364. wheel1act = wheel1.actuators["Visibility"]
  365. wheel2act = wheel2.actuators["Visibility"]
  366. wheel3act = wheel3.actuators["Visibility"]
  367. wheel4act = wheel4.actuators["Visibility"]
  368. deckact.visibility = True
  369. trucksact.visibility = True
  370. wheel1act.visibility = True
  371. wheel2act.visibility = True
  372. wheel3act.visibility = True
  373. wheel4act.visibility = True
  374. cont.activate(deck.actuators['Visibility'])
  375. cont.activate(trucks.actuators['Visibility'])
  376. cont.activate(wheel1.actuators['Visibility'])
  377. cont.activate(wheel2.actuators['Visibility'])
  378. cont.activate(wheel3.actuators['Visibility'])
  379. cont.activate(wheel4.actuators['Visibility'])
  380. own['throw_deck'] = False
  381. throw_deck_empty = scene.objects["throw_deck_empty"]
  382. throw_deck_empty['kill_deck'] = 1
  383. fliplay3 = fliplay2 + 1
  384. if dropinCol.positive == True:
  385. nearestObject = None
  386. grindEmpty = scene.objects['grindEmpty']
  387. grindDar = grindEmpty.sensors['grindDar2']
  388. minDist = None
  389. if grindDar.positive:
  390. detectedObjects = grindDar.hitObjectList
  391. dist = 0
  392. for obj in detectedObjects:
  393. dist = own.getDistanceTo(obj)
  394. if (minDist is None or dist < minDist):
  395. nearestObject = obj
  396. minDist = dist
  397. if nearestObject != None:
  398. print(nearestObject)
  399. obj = nearestObject
  400. player_e = own.worldOrientation.to_euler()
  401. player_pos = own.worldPosition
  402. player_rotz = math.degrees(player_e[2])
  403. grinder_e = obj.worldOrientation.to_euler()
  404. grinder_rotz = math.degrees(grinder_e[2])
  405. rot = player_rotz - grinder_rotz
  406. grinder_pos = obj.worldPosition
  407. worldVect = [1, 0, 0]
  408. vect = obj.getAxisVect(worldVect)
  409. go = obj.worldOrientation
  410. grinder_axis = [1,0,0]
  411. try:
  412. delta = player_pos - grinder_pos
  413. delta = delta.cross(vect)
  414. if delta[2] >= 0:
  415. grindside = "right"
  416. else:
  417. grindside = "left"
  418. deltamove = delta[2] * .1#.25
  419. if STANCE == 0:
  420. move = [-deltamove, 0, 0]
  421. else:
  422. move = [deltamove, 0, 0]
  423. #print("1deltamove", deltamove)
  424. own.applyMovement(move, True)
  425. except:
  426. #print("delta broke: ", player_pos, grinder_pos)
  427. pass
  428. if STANCE == 0:
  429. own['requestAction'] ='reg_dropin_pos'
  430. own['dropinTimer'] = 60
  431. if STANCE == 1:
  432. own['requestAction'] ='fak_dropin_pos'
  433. own['dropinTimer'] = 60
  434. if getonboard == 1:
  435. fliplay3 = 6000
  436. onboard_speed = .1
  437. own['getonboard'] = 0
  438. if yBut == False and lasty == True:
  439. own['getonboard'] = 1
  440. def nextframe():
  441. framenumber = own["framenum"]
  442. framenumber = framenumber + 1
  443. if framenumber == 900000:
  444. framenumber = 0
  445. own["framenum"] = framenumber
  446. own['last_walk_frame'] = framenumber
  447. def checkidle():
  448. idle = cont.sensors["idle"]
  449. #print(idle.positive)
  450. idle_frame = own["walk_idle_frame"]
  451. if idle.positive:
  452. own["walk_idle_frame"] = 0
  453. cont.deactivate(camobj.actuators['idle_camRight'])
  454. camera.height = .5
  455. else:
  456. if idle_frame == 0:
  457. own["walk_idle_frame"] = own["framenum"]
  458. diff = own["framenum"] - idle_frame
  459. if (diff > 700 and idle_frame != 0 and dropinCol.positive == False and own['walk'] != 0) or own['sit'] == 1:
  460. #print("you are idle", diff)
  461. cont.activate(camobj.actuators['idle_camRight'])
  462. camera.height = .9
  463. camera.min = 2
  464. camera.max = 2.50
  465. own['walk_idling'] = 1
  466. else:
  467. own['walk_idling'] = 0
  468. def idle_anim():
  469. if own['walk_idling'] == 1 and own['sit'] == 0:
  470. walk_idle_frame = own['walk_idle_frame']
  471. #print("walk_idling")
  472. mod_num = (own["framenum"] - walk_idle_frame) % 240
  473. #print(walk_idle_frame, mod_num)
  474. #killact(3)
  475. idle_lay = 300
  476. if mod_num == 0:
  477. if own['idle_skipper'] > 0:
  478. own['idle_skipper'] -= 1
  479. ran_num = random.randint(1, 8)
  480. #print(ran_num, "modding")
  481. if own['last_idle_num'] == ran_num:
  482. ran_num = 1
  483. if own['idle_skipper'] == 0:
  484. own['last_idle_num'] = ran_num
  485. if ran_num == 1 or ran_num > 7:
  486. killact(3)
  487. if STANCE == 0 and own['throw_deck'] == 0:
  488. skater.playAction("reg_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  489. deck.playAction("a_reg_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  490. trucks.playAction("a_reg_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  491. elif STANCE == 0 and own['throw_deck'] == 1:
  492. skater.playAction("reg_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  493. elif STANCE == 1 and own['throw_deck'] == 0:
  494. skater.playAction("fak_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  495. deck.playAction("a_fak_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  496. trucks.playAction("a_fak_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  497. elif STANCE == 1 and own['throw_deck'] == 1:
  498. skater.playAction("fak_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  499. elif ran_num == 2:
  500. killact(3)
  501. if STANCE == 0 and own['throw_deck'] == 0:
  502. skater.playAction("reg_idle2_", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  503. deck.playAction("a_reg_idle2", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  504. trucks.playAction("a_reg_idle2", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  505. elif STANCE == 0 and own['throw_deck'] == 1:
  506. skater.playAction("reg_idle2_nb", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  507. elif STANCE == 1 and own['throw_deck'] == 0:
  508. skater.playAction("fak_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  509. deck.playAction("a_fak_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  510. trucks.playAction("a_fak_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  511. elif STANCE == 1 and own['throw_deck'] == 1:
  512. skater.playAction("fak_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  513. elif ran_num == 3:
  514. killact(3)
  515. if STANCE == 0 and own['throw_deck'] == 0:
  516. skater.playAction("reg_idle3", 1,240, layer=idle_lay, play_mode=0, speed=.5)
  517. deck.playAction("a_reg_idle3", 1,240, layer=idle_lay, play_mode=0, speed=.5)
  518. trucks.playAction("a_reg_idle3", 1,240, layer=idle_lay, play_mode=0, speed=.5)
  519. elif STANCE == 0 and own['throw_deck'] == 1:
  520. skater.playAction("reg_idle3", 1,240, layer=idle_lay, play_mode=0, speed=.5)
  521. elif STANCE == 1 and own['throw_deck'] == 0:
  522. skater.playAction("fak_idle1", 1,240, layer=idle_lay, play_mode=0, speed=.5)
  523. deck.playAction("a_fak_idle1", 1,240, layer=idle_lay, play_mode=0, speed=.5)
  524. trucks.playAction("a_fak_idle1", 1,240, layer=idle_lay, play_mode=0, speed=.5)
  525. elif STANCE == 1 and own['throw_deck'] == 1:
  526. skater.playAction("fak_idle1", 1,240, layer=idle_lay, play_mode=0, speed=.5)
  527. own['idle_skipper'] = 2
  528. elif ran_num == 4:
  529. killact(3)
  530. if STANCE == 0 and own['throw_deck'] == 0:
  531. skater.playAction("reg_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  532. deck.playAction("a_reg_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  533. trucks.playAction("a_reg_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  534. elif STANCE == 0 and own['throw_deck'] == 1:
  535. skater.playAction("reg_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  536. elif STANCE == 1 and own['throw_deck'] == 0:
  537. skater.playAction("fak_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  538. deck.playAction("a_fak_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  539. trucks.playAction("a_fak_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  540. elif STANCE == 1 and own['throw_deck'] == 1:
  541. skater.playAction("fak_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  542. elif ran_num == 5:
  543. killact(3)
  544. if STANCE == 0 and own['throw_deck'] == 0:
  545. skater.playAction("reg_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  546. deck.playAction("a_reg_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  547. trucks.playAction("a_reg_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  548. elif STANCE == 0 and own['throw_deck'] == 1:
  549. skater.playAction("reg_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  550. elif STANCE == 1 and own['throw_deck'] == 0:
  551. skater.playAction("fak_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  552. deck.playAction("a_fak_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  553. trucks.playAction("a_fak_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  554. elif STANCE == 1 and own['throw_deck'] == 1:
  555. skater.playAction("fak_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  556. elif ran_num == 6:
  557. killact(3)
  558. if STANCE == 0 and own['throw_deck'] == 0:
  559. skater.playAction("reg_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  560. deck.playAction("a_reg_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  561. trucks.playAction("a_reg_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  562. elif STANCE == 0 and own['throw_deck'] == 1:
  563. skater.playAction("reg_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  564. elif STANCE == 1 and own['throw_deck'] == 0:
  565. skater.playAction("fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  566. deck.playAction("a_fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  567. trucks.playAction("a_fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  568. elif STANCE == 1 and own['throw_deck'] == 1:
  569. skater.playAction("fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  570. elif ran_num == 7:
  571. killact(3)
  572. if STANCE == 0 and own['throw_deck'] == 0:
  573. skater.playAction("reg_idle7", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  574. deck.playAction("a_reg_idle7", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  575. trucks.playAction("a_reg_idle7", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  576. elif STANCE == 0 and own['throw_deck'] == 1:
  577. skater.playAction("reg_idle7", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  578. elif STANCE == 1 and own['throw_deck'] == 0:
  579. skater.playAction("fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  580. deck.playAction("a_fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  581. trucks.playAction("a_fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  582. elif STANCE == 1 and own['throw_deck'] == 1:
  583. skater.playAction("fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  584. def reset_pos():
  585. #reset
  586. if ddPad == 1:
  587. spawn_pos = own['spawn_pos']
  588. spawn_rot = own['spawn_rot']
  589. #spawnz = spawn_pos[2] + .1
  590. try:
  591. own.worldPosition = (spawn_pos[0], spawn_pos[1], spawnz)
  592. 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]]
  593. except:
  594. own.worldPosition = (0, 0, .1)
  595. own.worldOrientation = [[1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
  596. if own["spawn_stance"] == 1:
  597. own.setLinearVelocity([.1,0,0], 1)
  598. #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
  599. #lx = cam.localPosition[1]
  600. #lx = lx - 4
  601. #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]]
  602. #cam.localPosition[1] = lx
  603. else:
  604. own.setLinearVelocity([-.1,0,0], 1)
  605. #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
  606. #lx = cam.localPosition[1]
  607. #lx = lx - 4
  608. #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]]
  609. #cam.localPosition[1] = lx
  610. if udPad == 1:
  611. own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]]
  612. 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]]
  613. stance = own["stance"]
  614. own["spawn_stance"] = stance
  615. def falldeck():
  616. #print("falldeck")
  617. throw_deck_empty = scene.objects["throw_deck_empty"]
  618. deckact = deck.actuators["Visibility"]
  619. trucksact = trucks.actuators["Visibility"]
  620. wheel1act = wheel1.actuators["Visibility"]
  621. wheel2act = wheel2.actuators["Visibility"]
  622. wheel3act = wheel3.actuators["Visibility"]
  623. wheel4act = wheel4.actuators["Visibility"]
  624. if own['throw_deck'] == False:
  625. own['throw_deck'] = True
  626. deckact.visibility = False
  627. trucksact.visibility = False
  628. wheel1act.visibility = False
  629. wheel2act.visibility = False
  630. wheel3act.visibility = False
  631. wheel4act.visibility = False
  632. act = throw_deck_empty.actuators['throw_dec_act']
  633. if STANCE == True:
  634. #skater.playAction("fak_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
  635. act.linearVelocity = [0.0, 1.0, 1.0]
  636. if STANCE == False:
  637. #skater.playAction("reg_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
  638. act.linearVelocity = [0.0, 1.0, -1.0]
  639. cont.activate(act)
  640. else:
  641. own['throw_deck'] = False
  642. deckact.visibility = True
  643. trucksact.visibility = True
  644. wheel1act.visibility = True
  645. wheel2act.visibility = True
  646. wheel3act.visibility = True
  647. wheel4act.visibility = True
  648. throw_deck_empty['kill_deck'] = 1
  649. #print("trying to kill deck")
  650. cont.activate(deck.actuators['Visibility'])
  651. cont.activate(trucks.actuators['Visibility'])
  652. cont.activate(wheel1.actuators['Visibility'])
  653. cont.activate(wheel2.actuators['Visibility'])
  654. cont.activate(wheel3.actuators['Visibility'])
  655. cont.activate(wheel4.actuators['Visibility'])
  656. def throwdeck():
  657. throw_deck_empty = scene.objects["throw_deck_empty"]
  658. deckact = deck.actuators["Visibility"]
  659. trucksact = trucks.actuators["Visibility"]
  660. wheel1act = wheel1.actuators["Visibility"]
  661. wheel2act = wheel2.actuators["Visibility"]
  662. wheel3act = wheel3.actuators["Visibility"]
  663. wheel4act = wheel4.actuators["Visibility"]
  664. if own['throw_deck'] == False:
  665. own['throw_deck'] = True
  666. deckact.visibility = False
  667. trucksact.visibility = False
  668. wheel1act.visibility = False
  669. wheel2act.visibility = False
  670. wheel3act.visibility = False
  671. wheel4act.visibility = False
  672. act = throw_deck_empty.actuators['throw_dec_act']
  673. if STANCE == True:
  674. #skater.playAction("fak_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
  675. own['requestAction'] = 'fak_throw'
  676. act.linearVelocity = [0.0, 5.0, 5.0]
  677. if STANCE == False:
  678. #skater.playAction("reg_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
  679. own['requestAction'] = 'fak_throw'
  680. act.linearVelocity = [0.0, 5.0, -5.0]
  681. cont.activate(act)
  682. else:
  683. own['throw_deck'] = False
  684. deckact.visibility = True
  685. trucksact.visibility = True
  686. wheel1act.visibility = True
  687. wheel2act.visibility = True
  688. wheel3act.visibility = True
  689. wheel4act.visibility = True
  690. throw_deck_empty['kill_deck'] = 1
  691. #print("trying to kill deck")
  692. cont.activate(deck.actuators['Visibility'])
  693. cont.activate(trucks.actuators['Visibility'])
  694. cont.activate(wheel1.actuators['Visibility'])
  695. cont.activate(wheel2.actuators['Visibility'])
  696. cont.activate(wheel3.actuators['Visibility'])
  697. cont.activate(wheel4.actuators['Visibility'])
  698. def throwdeck_trigger():
  699. lastb = own['lastb']
  700. throw_deck_empty = scene.objects["throw_deck_empty"]
  701. if bBut == False:
  702. throw_deck_empty['kill_deck'] = 0
  703. if bBut == False and own['lastb'] == True:
  704. #print("throw deck")
  705. throwdeck()
  706. def fall():
  707. if own['fall'] == True:
  708. falldeck()
  709. if STANCE == 1:
  710. own.setLinearVelocity([3,2,0], True)
  711. else:
  712. own.setLinearVelocity([-3,-2,0], True)
  713. own['fall'] = False
  714. def sit():
  715. #turn off sit
  716. if lup == 1 or ldown == 1 or lUD > sens or lUD < -sens:
  717. if own['sit'] == 1:
  718. killact(300)
  719. killact(299)
  720. own['sit'] = 0
  721. if aBut == False and lasta == True:
  722. try:
  723. if 'sit' in r_ground.hitObject:
  724. print("sit")
  725. own['sit'] = 1
  726. #killall()
  727. killact(3)
  728. if STANCE == 0:
  729. skater.playAction("reg_sit", 1,65, layer=300, play_mode=0, speed=1)
  730. deck.playAction("a_reg_sit", 1,65, layer=300, play_mode=0, speed=1)
  731. trucks.playAction("a_reg_sit", 1,65, layer=300, play_mode=0, speed=1)
  732. elif STANCE == 1:
  733. skater.playAction("fak_sit", 1,65, layer=300, play_mode=0, speed=1)
  734. deck.playAction("a_fak_sit", 1,65, layer=300, play_mode=0, speed=1)
  735. trucks.playAction("a_fak_sit", 1,65, layer=300, play_mode=0, speed=1)
  736. except:
  737. pass
  738. if own['sit'] == 1:
  739. try:
  740. killact(3)
  741. sit_vect = r_ground.hitObject.getAxisVect( [0, 1, 0])
  742. if STANCE == 0:
  743. own.alignAxisToVect(-sit_vect, 0, .2)
  744. skater.playAction("reg_sit", 65,65, layer=299, play_mode=1, speed=1)
  745. deck.playAction("a_reg_sit", 65,65, layer=299, play_mode=1, speed=1)
  746. trucks.playAction("a_reg_sit", 65,65, layer=299, play_mode=1, speed=1)
  747. elif STANCE == 1:
  748. own.alignAxisToVect(sit_vect, 0, .2)
  749. skater.playAction("fak_sit", 65,65, layer=299, play_mode=1, speed=1)
  750. deck.playAction("a_fak_sit", 65,65, layer=299, play_mode=1, speed=1)
  751. trucks.playAction("a_fak_sit", 65,65, layer=299, play_mode=1, speed=1)
  752. except:
  753. pass
  754. def switchcam():
  755. if ltsBut == False and own['lastlts'] == True and rtsBut == False:
  756. if own['camera'] == 1:
  757. own['camera'] = 0
  758. else:
  759. own['camera'] = 1
  760. if rtsBut == False and own['lastrts'] == True and ltsBut == False:
  761. if own['camera'] == 2:
  762. own['camera'] = 0
  763. else:
  764. own['camera'] = 2
  765. #followcam
  766. def move_followcam():
  767. if own['camera'] == 2:
  768. #if rtsBut == False and own['lastrts'] == True:
  769. if own['lastbkBut'] == True and bkBut == False:
  770. print("activate move followcam")
  771. if own['move_followcam'] == False:
  772. own['move_followcam'] = True
  773. else:
  774. own['move_followcam'] = False
  775. if own['move_followcam'] == True:
  776. #act = followcam.actuators[
  777. camspeed1 = .015
  778. camspeed2 = .055
  779. camrot1 = .005
  780. camrot2 = .02
  781. #up
  782. if lUD < -0.080:
  783. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  784. cont.activate(followcam.actuators["up"])
  785. print("fastup")
  786. else:
  787. cont.deactivate(followcam.actuators["up"])
  788. # #down
  789. if lUD > .080:
  790. followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  791. cont.activate(followcam.actuators["down"])
  792. else:
  793. cont.deactivate(followcam.actuators["down"])
  794. # #left
  795. if lLR < -0.080:
  796. followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  797. cont.activate(followcam.actuators["left"])
  798. else:
  799. cont.deactivate(followcam.actuators["left"])
  800. # #right
  801. if lLR > 0.080:
  802. followcam.actuators["right"].dLoc = [camspeed2, 0, 0]
  803. cont.activate(followcam.actuators["right"])
  804. else:
  805. cont.deactivate(followcam.actuators["right"])
  806. #up
  807. if rUD < -0.080:
  808. followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
  809. cont.activate(followcam.actuators["rotup"])
  810. #print("uppppppppppppppppppppppppppp")
  811. else:
  812. cont.deactivate(followcam.actuators["rotup"])
  813. # #down
  814. if rUD > .080:
  815. followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]
  816. cont.activate(followcam.actuators["rotdown"])
  817. else:
  818. cont.deactivate(followcam.actuators["rotdown"])
  819. # #left
  820. if rLR < -0.080:
  821. followcam.actuators["rotleft"].dRot = [0, 0, camrot2]
  822. cont.activate(followcam.actuators["rotleft"])
  823. else:
  824. cont.deactivate(followcam.actuators["rotleft"])
  825. # #right
  826. if rLR > 0.080:
  827. followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
  828. cont.activate(followcam.actuators["rotright"])
  829. else:
  830. cont.deactivate(followcam.actuators["rotright"])
  831. #*********************************************
  832. if lUD > -0.080 and lUD < -0.030:
  833. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  834. cont.activate(followcam.actuators["up"])
  835. #print(lUD)
  836. else:
  837. cont.deactivate(followcam.actuators["up"])
  838. # #down
  839. if lUD < .080 and lUD > .03:
  840. followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  841. cont.activate(followcam.actuators["down"])
  842. else:
  843. cont.deactivate(followcam.actuators["down"])
  844. # #left
  845. if lLR > -0.080 and lLR < -0.030:
  846. followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  847. cont.activate(followcam.actuators["left"])
  848. else:
  849. cont.deactivate(followcam.actuators["left"])
  850. # #right
  851. if lLR < .080 and lLR > .03:
  852. followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
  853. cont.activate(followcam.actuators["right"])
  854. else:
  855. cont.deactivate(followcam.actuators["right"])
  856. #up
  857. if rUD > -0.080 and rUD < -0.030:
  858. followcam.actuators["rotup"].dRot = [camrot1, 0, 0]
  859. cont.activate(followcam.actuators["rotup"])
  860. else:
  861. cont.deactivate(followcam.actuators["rotup"])
  862. # #down
  863. if rUD < .080 and rUD > .03:
  864. followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  865. cont.activate(followcam.actuators["rotdown"])
  866. else:
  867. cont.deactivate(followcam.actuators["rotdown"])
  868. # #left
  869. if rLR > -0.080 and rLR < -0.030:
  870. followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
  871. cont.activate(followcam.actuators["rotleft"])
  872. else:
  873. cont.deactivate(followcam.actuators["rotleft"])
  874. # #right
  875. if rLR < .080 and rLR > .03:
  876. followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
  877. cont.activate(followcam.actuators["rotright"])
  878. else:
  879. cont.deactivate(followcam.actuators["rotright"])
  880. def move_flycam():
  881. if own['camera'] == 1:
  882. #if rtsBut == False and own['lastrts'] == True:
  883. if own['lastbkBut'] == True and bkBut == False:
  884. if own['move_freecam'] == False:
  885. own['move_freecam'] = True
  886. else:
  887. own['move_freecam'] = False
  888. if own['move_freecam'] == True:
  889. #act = freecam.actuators[
  890. camspeed1 = .015
  891. camspeed2 = .055
  892. camrot1 = .005
  893. camrot2 = .02
  894. #up
  895. if lUD < -0.080:
  896. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  897. cont.activate(freecam.actuators["up"])
  898. #print("fastup")
  899. else:
  900. cont.deactivate(freecam.actuators["up"])
  901. # #down
  902. if lUD > .080:
  903. freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  904. cont.activate(freecam.actuators["down"])
  905. else:
  906. cont.deactivate(freecam.actuators["down"])
  907. # #left
  908. if lLR < -0.080:
  909. freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  910. cont.activate(freecam.actuators["left"])
  911. else:
  912. cont.deactivate(freecam.actuators["left"])
  913. # #right
  914. if lLR > 0.080:
  915. freecam.actuators["right"].dLoc = [camspeed2, 0, 0]
  916. cont.activate(freecam.actuators["right"])
  917. else:
  918. cont.deactivate(freecam.actuators["right"])
  919. #up
  920. if rUD < -0.080:
  921. freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
  922. cont.activate(freecam.actuators["rotup"])
  923. else:
  924. cont.deactivate(freecam.actuators["rotup"])
  925. # #down
  926. if rUD > .080:
  927. freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]
  928. cont.activate(freecam.actuators["rotdown"])
  929. else:
  930. cont.deactivate(freecam.actuators["rotdown"])
  931. # #left
  932. if rLR < -0.080:
  933. freecam.actuators["rotleft"].dRot = [0, 0, camrot2]
  934. cont.activate(freecam.actuators["rotleft"])
  935. else:
  936. cont.deactivate(freecam.actuators["rotleft"])
  937. # #right
  938. if rLR > 0.080:
  939. freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
  940. cont.activate(freecam.actuators["rotright"])
  941. else:
  942. cont.deactivate(freecam.actuators["rotright"])
  943. #*********************************************
  944. if lUD > -0.080 and lUD < -0.030:
  945. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  946. cont.activate(freecam.actuators["up"])
  947. #print(lUD)
  948. else:
  949. cont.deactivate(freecam.actuators["up"])
  950. # #down
  951. if lUD < .080 and lUD > .03:
  952. freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  953. cont.activate(freecam.actuators["down"])
  954. else:
  955. cont.deactivate(freecam.actuators["down"])
  956. # #left
  957. if lLR > -0.080 and lLR < -0.030:
  958. freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  959. cont.activate(freecam.actuators["left"])
  960. else:
  961. cont.deactivate(freecam.actuators["left"])
  962. # #right
  963. if lLR < .080 and lLR > .03:
  964. freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
  965. cont.activate(freecam.actuators["right"])
  966. else:
  967. cont.deactivate(freecam.actuators["right"])
  968. #up
  969. if rUD > -0.080 and rUD < -0.030:
  970. freecam.actuators["rotup"].dRot = [camrot1, 0, 0]
  971. cont.activate(freecam.actuators["rotup"])
  972. else:
  973. cont.deactivate(freecam.actuators["rotup"])
  974. # #down
  975. if rUD < .080 and rUD > .03:
  976. freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  977. cont.activate(freecam.actuators["rotdown"])
  978. else:
  979. cont.deactivate(freecam.actuators["rotdown"])
  980. # #left
  981. if rLR > -0.080 and rLR < -0.030:
  982. freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
  983. cont.activate(freecam.actuators["rotleft"])
  984. else:
  985. cont.deactivate(freecam.actuators["rotleft"])
  986. # #right
  987. if rLR < .080 and rLR > .03:
  988. freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
  989. cont.activate(freecam.actuators["rotright"])
  990. else:
  991. cont.deactivate(freecam.actuators["rotright"])
  992. if r_ground.triggered == False:
  993. cont.deactivate(own.actuators["walk_align"])
  994. else:
  995. cont.activate(own.actuators["walk_align"])
  996. #walking on stairs
  997. if r_ground.triggered:
  998. try:
  999. if 'stair' in r_ground.hitObject:
  1000. own['stair_counter'] = 20
  1001. force = [ 0.0, 0.0, -100]
  1002. # use local axis
  1003. local = True
  1004. # apply force
  1005. #own.applyForce(force, local)
  1006. except:
  1007. pass
  1008. if own['stair_counter'] > 0:
  1009. own['stair_counter'] -= 1
  1010. if yBut == True:
  1011. own['walk_idling'] = 0
  1012. own["walk_idle_frame"] = 0
  1013. if own['requestAction'] == None:
  1014. if own['throw_deck'] == False:
  1015. if STANCE == 1:
  1016. own['requestAction'] = reg_idle
  1017. else:
  1018. own['requestAction'] = fak_idle
  1019. else:
  1020. if STANCE == 1:
  1021. own['requestAction'] = reg_idle_nb
  1022. else:
  1023. own['requestAction'] = fak_idle_nb
  1024. if deck.visible:
  1025. own['deckvis'] = 1
  1026. else:
  1027. own['deckvis'] = 0
  1028. onboard()
  1029. jump()
  1030. dropin()
  1031. throwdeck_trigger()
  1032. nextframe()
  1033. checkidle()
  1034. getonboard()
  1035. reset_pos()
  1036. switchcam()
  1037. move_flycam()
  1038. move_followcam()
  1039. fall()
  1040. idle_anim()
  1041. sit()
  1042. #cont.activate(cam.actuators['Camera'])
  1043. #printplaying()
  1044. own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
  1045. own.actuators["sroll"].stopSound()
  1046. wheel1 = scene.objects["rollen.000"]
  1047. wheel2 = scene.objects["rollen.001"]
  1048. wheel3 = scene.objects["rollen.002"]
  1049. wheel4 = scene.objects["rollen.003"]
  1050. wheel1.stopAction(2)
  1051. wheel2.stopAction(2)
  1052. wheel3.stopAction(2)
  1053. wheel4.stopAction(2)
  1054. own['lasty'] = yBut
  1055. own['lastb'] = bBut
  1056. own['lasta'] = aBut
  1057. own['lastx'] = xBut
  1058. own['lastlts'] = ltsBut
  1059. own['lastrts'] = rtsBut
  1060. own['lastbkBut'] = bkBut
  1061. own['dropinCol'] = dropinCol
  1062. own['walk'] = 1