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 47KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
  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. own['requestAction'] = 'reg_idle1'
  489. #skater.playAction("reg_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  490. #deck.playAction("a_reg_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  491. #trucks.playAction("a_reg_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  492. elif STANCE == 0 and own['throw_deck'] == 1:
  493. own['requestAction'] = 'reg_idle1'
  494. #skater.playAction("reg_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  495. elif STANCE == 1 and own['throw_deck'] == 0:
  496. own['requestAction'] = 'fak_idle1'
  497. #skater.playAction("fak_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  498. #deck.playAction("a_fak_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  499. #trucks.playAction("a_fak_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  500. elif STANCE == 1 and own['throw_deck'] == 1:
  501. own['requestAction'] = 'fak_idle1'
  502. #skater.playAction("fak_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  503. elif ran_num == 2:
  504. killact(3)
  505. if STANCE == 0 and own['throw_deck'] == 0:
  506. own['requestAction'] = 'reg_idle2'
  507. #skater.playAction("reg_idle2_", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  508. #deck.playAction("a_reg_idle2", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  509. #trucks.playAction("a_reg_idle2", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  510. elif STANCE == 0 and own['throw_deck'] == 1:
  511. own['requestAction'] = 'reg_idle2_nb'
  512. #skater.playAction("reg_idle2_nb", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  513. elif STANCE == 1 and own['throw_deck'] == 0:
  514. own['requestAction'] = 'fak_idle1'
  515. elif STANCE == 1 and own['throw_deck'] == 1:
  516. own['requestAction'] = 'fak_idle1'
  517. #skater.playAction("fak_idle1", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  518. elif ran_num == 3:
  519. killact(3)
  520. if STANCE == 0 and own['throw_deck'] == 0:
  521. own['requestAction'] = 'reg_idle3'
  522. # skater.playAction("reg_idle3", 1,240, layer=idle_lay, play_mode=0, speed=.5)
  523. # deck.playAction("a_reg_idle3", 1,240, layer=idle_lay, play_mode=0, speed=.5)
  524. # trucks.playAction("a_reg_idle3", 1,240, layer=idle_lay, play_mode=0, speed=.5)
  525. elif STANCE == 0 and own['throw_deck'] == 1:
  526. own['requestAction'] = 'reg_idle3'
  527. #skater.playAction("reg_idle3", 1,240, layer=idle_lay, play_mode=0, speed=.5)
  528. elif STANCE == 1 and own['throw_deck'] == 0:
  529. own['requestAction'] = 'fak_idle1'
  530. elif STANCE == 1 and own['throw_deck'] == 1:
  531. #skater.playAction("fak_idle1", 1,240, layer=idle_lay, play_mode=0, speed=.5)
  532. own['requestAction'] = 'fak_idle1'
  533. own['idle_skipper'] = 2
  534. elif ran_num == 4:
  535. killact(3)
  536. if STANCE == 0 and own['throw_deck'] == 0:
  537. own['requestAction'] = 'reg_idle4'
  538. # skater.playAction("reg_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  539. # deck.playAction("a_reg_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  540. # trucks.playAction("a_reg_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  541. elif STANCE == 0 and own['throw_deck'] == 1:
  542. #skater.playAction("reg_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  543. own['requestAction'] = 'reg_idle4'
  544. elif STANCE == 1 and own['throw_deck'] == 0:
  545. own['requestAction'] = 'fak_idle4'
  546. # skater.playAction("fak_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  547. # deck.playAction("a_fak_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  548. # trucks.playAction("a_fak_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  549. elif STANCE == 1 and own['throw_deck'] == 1:
  550. #skater.playAction("fak_idle4", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  551. own['requestAction'] = 'fak_idle4'
  552. elif ran_num == 5:
  553. killact(3)
  554. if STANCE == 0 and own['throw_deck'] == 0:
  555. own['requestAction'] = 'reg_idle5'
  556. # skater.playAction("reg_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  557. # deck.playAction("a_reg_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  558. # trucks.playAction("a_reg_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  559. elif STANCE == 0 and own['throw_deck'] == 1:
  560. #skater.playAction("reg_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  561. own['requestAction'] = 'reg_idle5'
  562. elif STANCE == 1 and own['throw_deck'] == 0:
  563. own['requestAction'] = 'fak_idle5'
  564. # skater.playAction("fak_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  565. # deck.playAction("a_fak_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  566. # trucks.playAction("a_fak_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  567. elif STANCE == 1 and own['throw_deck'] == 1:
  568. own['requestAction'] = 'fak_idle5'
  569. #skater.playAction("fak_idle5", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  570. elif ran_num == 6:
  571. killact(3)
  572. if STANCE == 0 and own['throw_deck'] == 0:
  573. own['requestAction'] = 'reg_idle6'
  574. # skater.playAction("reg_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  575. # deck.playAction("a_reg_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  576. # trucks.playAction("a_reg_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  577. elif STANCE == 0 and own['throw_deck'] == 1:
  578. own['requestAction'] = 'reg_idle6'
  579. #skater.playAction("reg_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  580. elif STANCE == 1 and own['throw_deck'] == 0:
  581. own['requestAction'] = 'fak_idle6'
  582. # skater.playAction("fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  583. # deck.playAction("a_fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  584. # trucks.playAction("a_fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  585. elif STANCE == 1 and own['throw_deck'] == 1:
  586. #skater.playAction("fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  587. own['requestAction'] = 'fak_idle6'
  588. elif ran_num == 7:
  589. killact(3)
  590. if STANCE == 0 and own['throw_deck'] == 0:
  591. own['requestAction'] = 'reg_idle7'
  592. # skater.playAction("reg_idle7", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  593. # deck.playAction("a_reg_idle7", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  594. # trucks.playAction("a_reg_idle7", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  595. elif STANCE == 0 and own['throw_deck'] == 1:
  596. #skater.playAction("reg_idle7", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  597. own['requestAction'] = 'reg_idle7'
  598. elif STANCE == 1 and own['throw_deck'] == 0:
  599. own['requestAction'] = 'fak_idle6'
  600. # skater.playAction("fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  601. # deck.playAction("a_fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  602. # trucks.playAction("a_fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  603. elif STANCE == 1 and own['throw_deck'] == 1:
  604. own['requestAction'] = 'fak_idle6'
  605. #skater.playAction("fak_idle6", 1,120, layer=idle_lay, play_mode=0, speed=.5)
  606. def reset_pos():
  607. #reset
  608. if ddPad == 1:
  609. spawn_pos = own['spawn_pos']
  610. spawn_rot = own['spawn_rot']
  611. #spawnz = spawn_pos[2] + .1
  612. try:
  613. own.worldPosition = (spawn_pos[0], spawn_pos[1], spawnz)
  614. 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]]
  615. except:
  616. own.worldPosition = (0, 0, .1)
  617. own.worldOrientation = [[1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
  618. if own["spawn_stance"] == 1:
  619. own.setLinearVelocity([.1,0,0], 1)
  620. #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
  621. #lx = cam.localPosition[1]
  622. #lx = lx - 4
  623. #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]]
  624. #cam.localPosition[1] = lx
  625. else:
  626. own.setLinearVelocity([-.1,0,0], 1)
  627. #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
  628. #lx = cam.localPosition[1]
  629. #lx = lx - 4
  630. #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]]
  631. #cam.localPosition[1] = lx
  632. if udPad == 1:
  633. own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]]
  634. 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]]
  635. stance = own["stance"]
  636. own["spawn_stance"] = stance
  637. def falldeck():
  638. #print("falldeck")
  639. throw_deck_empty = scene.objects["throw_deck_empty"]
  640. deckact = deck.actuators["Visibility"]
  641. trucksact = trucks.actuators["Visibility"]
  642. wheel1act = wheel1.actuators["Visibility"]
  643. wheel2act = wheel2.actuators["Visibility"]
  644. wheel3act = wheel3.actuators["Visibility"]
  645. wheel4act = wheel4.actuators["Visibility"]
  646. if own['throw_deck'] == False:
  647. own['throw_deck'] = True
  648. deckact.visibility = False
  649. trucksact.visibility = False
  650. wheel1act.visibility = False
  651. wheel2act.visibility = False
  652. wheel3act.visibility = False
  653. wheel4act.visibility = False
  654. act = throw_deck_empty.actuators['throw_dec_act']
  655. if STANCE == True:
  656. #skater.playAction("fak_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
  657. act.linearVelocity = [0.0, 1.0, 1.0]
  658. if STANCE == False:
  659. #skater.playAction("reg_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
  660. act.linearVelocity = [0.0, 1.0, -1.0]
  661. cont.activate(act)
  662. else:
  663. own['throw_deck'] = False
  664. deckact.visibility = True
  665. trucksact.visibility = True
  666. wheel1act.visibility = True
  667. wheel2act.visibility = True
  668. wheel3act.visibility = True
  669. wheel4act.visibility = True
  670. throw_deck_empty['kill_deck'] = 1
  671. #print("trying to kill deck")
  672. cont.activate(deck.actuators['Visibility'])
  673. cont.activate(trucks.actuators['Visibility'])
  674. cont.activate(wheel1.actuators['Visibility'])
  675. cont.activate(wheel2.actuators['Visibility'])
  676. cont.activate(wheel3.actuators['Visibility'])
  677. cont.activate(wheel4.actuators['Visibility'])
  678. def throwdeck():
  679. throw_deck_empty = scene.objects["throw_deck_empty"]
  680. deckact = deck.actuators["Visibility"]
  681. trucksact = trucks.actuators["Visibility"]
  682. wheel1act = wheel1.actuators["Visibility"]
  683. wheel2act = wheel2.actuators["Visibility"]
  684. wheel3act = wheel3.actuators["Visibility"]
  685. wheel4act = wheel4.actuators["Visibility"]
  686. if own['throw_deck'] == False:
  687. own['throw_deck'] = True
  688. deckact.visibility = False
  689. trucksact.visibility = False
  690. wheel1act.visibility = False
  691. wheel2act.visibility = False
  692. wheel3act.visibility = False
  693. wheel4act.visibility = False
  694. act = throw_deck_empty.actuators['throw_dec_act']
  695. if STANCE == True:
  696. #skater.playAction("fak_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
  697. own['requestAction'] = 'fak_throw'
  698. act.linearVelocity = [0.0, 5.0, 5.0]
  699. if STANCE == False:
  700. #skater.playAction("reg_throw", 10,30, layer=29, priority=0, play_mode=0, speed=.5)
  701. own['requestAction'] = 'fak_throw'
  702. act.linearVelocity = [0.0, 5.0, -5.0]
  703. cont.activate(act)
  704. else:
  705. own['throw_deck'] = False
  706. deckact.visibility = True
  707. trucksact.visibility = True
  708. wheel1act.visibility = True
  709. wheel2act.visibility = True
  710. wheel3act.visibility = True
  711. wheel4act.visibility = True
  712. throw_deck_empty['kill_deck'] = 1
  713. #print("trying to kill deck")
  714. cont.activate(deck.actuators['Visibility'])
  715. cont.activate(trucks.actuators['Visibility'])
  716. cont.activate(wheel1.actuators['Visibility'])
  717. cont.activate(wheel2.actuators['Visibility'])
  718. cont.activate(wheel3.actuators['Visibility'])
  719. cont.activate(wheel4.actuators['Visibility'])
  720. def throwdeck_trigger():
  721. lastb = own['lastb']
  722. throw_deck_empty = scene.objects["throw_deck_empty"]
  723. if bBut == False:
  724. throw_deck_empty['kill_deck'] = 0
  725. if bBut == False and own['lastb'] == True:
  726. #print("throw deck")
  727. throwdeck()
  728. def fall():
  729. if own['fall'] == True:
  730. falldeck()
  731. if STANCE == 1:
  732. own.setLinearVelocity([3,2,0], True)
  733. else:
  734. own.setLinearVelocity([-3,-2,0], True)
  735. own['fall'] = False
  736. def sit():
  737. #turn off sit
  738. if lup == 1 or ldown == 1 or lUD > sens or lUD < -sens:
  739. if own['sit'] == 1:
  740. killact(300)
  741. killact(299)
  742. own['sit'] = 0
  743. if aBut == False and lasta == True:
  744. try:
  745. if 'sit' in r_ground.hitObject:
  746. print("sit")
  747. own['sit'] = 1
  748. #killall()
  749. killact(3)
  750. if STANCE == 0:
  751. skater.playAction("reg_sit", 1,65, layer=300, play_mode=0, speed=1)
  752. deck.playAction("a_reg_sit", 1,65, layer=300, play_mode=0, speed=1)
  753. trucks.playAction("a_reg_sit", 1,65, layer=300, play_mode=0, speed=1)
  754. elif STANCE == 1:
  755. skater.playAction("fak_sit", 1,65, layer=300, play_mode=0, speed=1)
  756. deck.playAction("a_fak_sit", 1,65, layer=300, play_mode=0, speed=1)
  757. trucks.playAction("a_fak_sit", 1,65, layer=300, play_mode=0, speed=1)
  758. except:
  759. pass
  760. if own['sit'] == 1:
  761. try:
  762. killact(3)
  763. sit_vect = r_ground.hitObject.getAxisVect( [0, 1, 0])
  764. if STANCE == 0:
  765. own.alignAxisToVect(-sit_vect, 0, .2)
  766. skater.playAction("reg_sit", 65,65, layer=299, play_mode=1, speed=1)
  767. deck.playAction("a_reg_sit", 65,65, layer=299, play_mode=1, speed=1)
  768. trucks.playAction("a_reg_sit", 65,65, layer=299, play_mode=1, speed=1)
  769. elif STANCE == 1:
  770. own.alignAxisToVect(sit_vect, 0, .2)
  771. skater.playAction("fak_sit", 65,65, layer=299, play_mode=1, speed=1)
  772. deck.playAction("a_fak_sit", 65,65, layer=299, play_mode=1, speed=1)
  773. trucks.playAction("a_fak_sit", 65,65, layer=299, play_mode=1, speed=1)
  774. except:
  775. pass
  776. def switchcam():
  777. if ltsBut == False and own['lastlts'] == True and rtsBut == False:
  778. if own['camera'] == 1:
  779. own['camera'] = 0
  780. else:
  781. own['camera'] = 1
  782. if rtsBut == False and own['lastrts'] == True and ltsBut == False:
  783. if own['camera'] == 2:
  784. own['camera'] = 0
  785. else:
  786. own['camera'] = 2
  787. #followcam
  788. def move_followcam():
  789. if own['camera'] == 2:
  790. #if rtsBut == False and own['lastrts'] == True:
  791. if own['lastbkBut'] == True and bkBut == False:
  792. print("activate move followcam")
  793. if own['move_followcam'] == False:
  794. own['move_followcam'] = True
  795. else:
  796. own['move_followcam'] = False
  797. if own['move_followcam'] == True:
  798. #act = followcam.actuators[
  799. camspeed1 = .015
  800. camspeed2 = .055
  801. camrot1 = .005
  802. camrot2 = .02
  803. #up
  804. if lUD < -0.080:
  805. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  806. cont.activate(followcam.actuators["up"])
  807. print("fastup")
  808. else:
  809. cont.deactivate(followcam.actuators["up"])
  810. # #down
  811. if lUD > .080:
  812. followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  813. cont.activate(followcam.actuators["down"])
  814. else:
  815. cont.deactivate(followcam.actuators["down"])
  816. # #left
  817. if lLR < -0.080:
  818. followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  819. cont.activate(followcam.actuators["left"])
  820. else:
  821. cont.deactivate(followcam.actuators["left"])
  822. # #right
  823. if lLR > 0.080:
  824. followcam.actuators["right"].dLoc = [camspeed2, 0, 0]
  825. cont.activate(followcam.actuators["right"])
  826. else:
  827. cont.deactivate(followcam.actuators["right"])
  828. #up
  829. if rUD < -0.080:
  830. followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
  831. cont.activate(followcam.actuators["rotup"])
  832. #print("uppppppppppppppppppppppppppp")
  833. else:
  834. cont.deactivate(followcam.actuators["rotup"])
  835. # #down
  836. if rUD > .080:
  837. followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]
  838. cont.activate(followcam.actuators["rotdown"])
  839. else:
  840. cont.deactivate(followcam.actuators["rotdown"])
  841. # #left
  842. if rLR < -0.080:
  843. followcam.actuators["rotleft"].dRot = [0, 0, camrot2]
  844. cont.activate(followcam.actuators["rotleft"])
  845. else:
  846. cont.deactivate(followcam.actuators["rotleft"])
  847. # #right
  848. if rLR > 0.080:
  849. followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
  850. cont.activate(followcam.actuators["rotright"])
  851. else:
  852. cont.deactivate(followcam.actuators["rotright"])
  853. #*********************************************
  854. if lUD > -0.080 and lUD < -0.030:
  855. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  856. cont.activate(followcam.actuators["up"])
  857. #print(lUD)
  858. else:
  859. cont.deactivate(followcam.actuators["up"])
  860. # #down
  861. if lUD < .080 and lUD > .03:
  862. followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  863. cont.activate(followcam.actuators["down"])
  864. else:
  865. cont.deactivate(followcam.actuators["down"])
  866. # #left
  867. if lLR > -0.080 and lLR < -0.030:
  868. followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  869. cont.activate(followcam.actuators["left"])
  870. else:
  871. cont.deactivate(followcam.actuators["left"])
  872. # #right
  873. if lLR < .080 and lLR > .03:
  874. followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
  875. cont.activate(followcam.actuators["right"])
  876. else:
  877. cont.deactivate(followcam.actuators["right"])
  878. #up
  879. if rUD > -0.080 and rUD < -0.030:
  880. followcam.actuators["rotup"].dRot = [camrot1, 0, 0]
  881. cont.activate(followcam.actuators["rotup"])
  882. else:
  883. cont.deactivate(followcam.actuators["rotup"])
  884. # #down
  885. if rUD < .080 and rUD > .03:
  886. followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  887. cont.activate(followcam.actuators["rotdown"])
  888. else:
  889. cont.deactivate(followcam.actuators["rotdown"])
  890. # #left
  891. if rLR > -0.080 and rLR < -0.030:
  892. followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
  893. cont.activate(followcam.actuators["rotleft"])
  894. else:
  895. cont.deactivate(followcam.actuators["rotleft"])
  896. # #right
  897. if rLR < .080 and rLR > .03:
  898. followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
  899. cont.activate(followcam.actuators["rotright"])
  900. else:
  901. cont.deactivate(followcam.actuators["rotright"])
  902. def move_flycam():
  903. if own['camera'] == 1:
  904. #if rtsBut == False and own['lastrts'] == True:
  905. if own['lastbkBut'] == True and bkBut == False:
  906. if own['move_freecam'] == False:
  907. own['move_freecam'] = True
  908. else:
  909. own['move_freecam'] = False
  910. if own['move_freecam'] == True:
  911. #act = freecam.actuators[
  912. camspeed1 = .015
  913. camspeed2 = .055
  914. camrot1 = .005
  915. camrot2 = .02
  916. #up
  917. if lUD < -0.080:
  918. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  919. cont.activate(freecam.actuators["up"])
  920. #print("fastup")
  921. else:
  922. cont.deactivate(freecam.actuators["up"])
  923. # #down
  924. if lUD > .080:
  925. freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  926. cont.activate(freecam.actuators["down"])
  927. else:
  928. cont.deactivate(freecam.actuators["down"])
  929. # #left
  930. if lLR < -0.080:
  931. freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  932. cont.activate(freecam.actuators["left"])
  933. else:
  934. cont.deactivate(freecam.actuators["left"])
  935. # #right
  936. if lLR > 0.080:
  937. freecam.actuators["right"].dLoc = [camspeed2, 0, 0]
  938. cont.activate(freecam.actuators["right"])
  939. else:
  940. cont.deactivate(freecam.actuators["right"])
  941. #up
  942. if rUD < -0.080:
  943. freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
  944. cont.activate(freecam.actuators["rotup"])
  945. else:
  946. cont.deactivate(freecam.actuators["rotup"])
  947. # #down
  948. if rUD > .080:
  949. freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]
  950. cont.activate(freecam.actuators["rotdown"])
  951. else:
  952. cont.deactivate(freecam.actuators["rotdown"])
  953. # #left
  954. if rLR < -0.080:
  955. freecam.actuators["rotleft"].dRot = [0, 0, camrot2]
  956. cont.activate(freecam.actuators["rotleft"])
  957. else:
  958. cont.deactivate(freecam.actuators["rotleft"])
  959. # #right
  960. if rLR > 0.080:
  961. freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
  962. cont.activate(freecam.actuators["rotright"])
  963. else:
  964. cont.deactivate(freecam.actuators["rotright"])
  965. #*********************************************
  966. if lUD > -0.080 and lUD < -0.030:
  967. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  968. cont.activate(freecam.actuators["up"])
  969. #print(lUD)
  970. else:
  971. cont.deactivate(freecam.actuators["up"])
  972. # #down
  973. if lUD < .080 and lUD > .03:
  974. freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  975. cont.activate(freecam.actuators["down"])
  976. else:
  977. cont.deactivate(freecam.actuators["down"])
  978. # #left
  979. if lLR > -0.080 and lLR < -0.030:
  980. freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  981. cont.activate(freecam.actuators["left"])
  982. else:
  983. cont.deactivate(freecam.actuators["left"])
  984. # #right
  985. if lLR < .080 and lLR > .03:
  986. freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
  987. cont.activate(freecam.actuators["right"])
  988. else:
  989. cont.deactivate(freecam.actuators["right"])
  990. #up
  991. if rUD > -0.080 and rUD < -0.030:
  992. freecam.actuators["rotup"].dRot = [camrot1, 0, 0]
  993. cont.activate(freecam.actuators["rotup"])
  994. else:
  995. cont.deactivate(freecam.actuators["rotup"])
  996. # #down
  997. if rUD < .080 and rUD > .03:
  998. freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  999. cont.activate(freecam.actuators["rotdown"])
  1000. else:
  1001. cont.deactivate(freecam.actuators["rotdown"])
  1002. # #left
  1003. if rLR > -0.080 and rLR < -0.030:
  1004. freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
  1005. cont.activate(freecam.actuators["rotleft"])
  1006. else:
  1007. cont.deactivate(freecam.actuators["rotleft"])
  1008. # #right
  1009. if rLR < .080 and rLR > .03:
  1010. freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
  1011. cont.activate(freecam.actuators["rotright"])
  1012. else:
  1013. cont.deactivate(freecam.actuators["rotright"])
  1014. if r_ground.triggered == False:
  1015. cont.deactivate(own.actuators["walk_align"])
  1016. else:
  1017. cont.activate(own.actuators["walk_align"])
  1018. #walking on stairs
  1019. if r_ground.triggered:
  1020. try:
  1021. if 'stair' in r_ground.hitObject:
  1022. own['stair_counter'] = 20
  1023. force = [ 0.0, 0.0, -100]
  1024. # use local axis
  1025. local = True
  1026. # apply force
  1027. #own.applyForce(force, local)
  1028. except:
  1029. pass
  1030. if own['stair_counter'] > 0:
  1031. own['stair_counter'] -= 1
  1032. if yBut == True:
  1033. own['walk_idling'] = 0
  1034. own["walk_idle_frame"] = 0
  1035. #if own['requestAction'] == None:
  1036. # if own['throw_deck'] == False:
  1037. # if STANCE == 1:
  1038. # own['requestAction'] = reg_idle
  1039. # else:
  1040. # own['requestAction'] = fak_idle
  1041. # else:
  1042. # if STANCE == 1:
  1043. # own['requestAction'] = reg_idle_nb
  1044. # else:
  1045. # own['requestAction'] = fak_idle_nb
  1046. if deck.visible:
  1047. own['deckvis'] = 1
  1048. else:
  1049. own['deckvis'] = 0
  1050. onboard()
  1051. jump()
  1052. dropin()
  1053. throwdeck_trigger()
  1054. nextframe()
  1055. checkidle()
  1056. getonboard()
  1057. reset_pos()
  1058. switchcam()
  1059. move_flycam()
  1060. move_followcam()
  1061. fall()
  1062. idle_anim()
  1063. sit()
  1064. #cont.activate(cam.actuators['Camera'])
  1065. #printplaying()
  1066. own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
  1067. own.actuators["sroll"].stopSound()
  1068. wheel1 = scene.objects["rollen.000"]
  1069. wheel2 = scene.objects["rollen.001"]
  1070. wheel3 = scene.objects["rollen.002"]
  1071. wheel4 = scene.objects["rollen.003"]
  1072. wheel1.stopAction(2)
  1073. wheel2.stopAction(2)
  1074. wheel3.stopAction(2)
  1075. wheel4.stopAction(2)
  1076. own['lasty'] = yBut
  1077. own['lastb'] = bBut
  1078. own['lasta'] = aBut
  1079. own['lastx'] = xBut
  1080. own['lastlts'] = ltsBut
  1081. own['lastrts'] = rtsBut
  1082. own['lastbkBut'] = bkBut
  1083. own['dropinCol'] = dropinCol
  1084. own['walk'] = 1