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.

controller2.py 162KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341
  1. #shuvit.org
  2. #main control script
  3. #scale = .3
  4. #action layers
  5. #0-14 rolling
  6. #grablay = 400
  7. #fliplay = 500
  8. #grindlay = 700
  9. os = 'Windows'
  10. from sys import platform
  11. if platform != "win32":
  12. os = 'Linux'
  13. def onWindows():
  14. return os == 'Windows'
  15. from mathutils import Vector
  16. import bge
  17. import GameLogic
  18. import ctypes
  19. import math
  20. #import bpy
  21. #build global dict (move this to separate script that runs once)
  22. scene = bge.logic.getCurrentScene()
  23. objList = scene.objects
  24. try:
  25. GameLogic.DictObjects
  26. init=1
  27. except:
  28. init=0
  29. if init:
  30. cont.GameLogic.getCurrentController()
  31. own = cont.getOwner()
  32. name = own.getName()
  33. if not GameLogic.DictObjects.has_key(name):
  34. GameLogic.DictObjects[name]=cont
  35. own.init=0
  36. reduction = 400000
  37. axisTh = 0.03
  38. #initialize quadrant variables
  39. q1on = 0
  40. q2on = 0
  41. q3on = 0
  42. q4on = 0
  43. q5on = 0
  44. q6on = 0
  45. q7on = 0
  46. q8on = 0
  47. lq1on = 0
  48. lq2on = 0
  49. lq3on = 0
  50. lq4on = 0
  51. lq5on = 0
  52. lq6on = 0
  53. lq7on = 0
  54. lq8on = 0
  55. #number of frames / length of the location timers
  56. countdown = 20
  57. cont = GameLogic.getCurrentController()
  58. obj = bge.logic.getCurrentScene().objects
  59. char = bge.constraints.getCharacter
  60. own = cont.owner
  61. dict = bge.logic.globalDict #Get the global dictionary
  62. #dict['trick_string'] = ''
  63. #last frame stuff
  64. lGRAB_ON = own["lGRAB_ON"]
  65. lastgrab = own["lastGrab"]
  66. lastpump = own["lastPump"]
  67. lf_ground = own["lF_ground"]
  68. lastopos = own["last_Opos"]
  69. lastnopos = own["last_nOpos"]
  70. LAST_STANCE = own["last_stance"]
  71. LAST_GROUND = own["last_ground"]
  72. lastStop = own["lastStop"]
  73. LAST_LEFT = own["LAST_LEFT"]
  74. last_trick_string = dict.get('last_trick_sting')
  75. lasta = own["lasta"]
  76. lastx = own["lastx"]
  77. lastaf = own["lastaf"]
  78. lastxf = own["lastxf"]
  79. lgf = own['last_grind_frame']
  80. frame = own['framenum']
  81. frames_since_grinding = frame - lgf
  82. own['last_footplant'] = own['footplant_on']
  83. lastaBut_ground = own['lastaBut_ground']
  84. lastxBut_ground = own['lastxBut_ground']
  85. aBut_ground = own['aBut_ground']
  86. xBut_ground = own['xBut_ground']
  87. own['last_manual_v2'] = own['manual_v2']
  88. #current frame stuff
  89. GRAB_ON = own["GRAB_ON"]
  90. pumpon = own["Pump"]
  91. vib_countdown = own["vib_Countdown"]
  92. grindold = own['grindOld']
  93. #grindHit = own["LAST_GRIND"]
  94. LAST_GRIND = own["LAST_GRIND"]
  95. #grindTouch = cont.sensors['grindCol']
  96. grindTouch = cont.sensors['grindCol_bottom']
  97. touched = grindTouch.triggered
  98. leftgrabon = own["Leftgrabon"]
  99. rightgrabon = own["Rightgrabon"]
  100. linvel = own.getLinearVelocity
  101. zvel = own.worldLinearVelocity.z
  102. own["Zvel"] = zvel
  103. r_ground = cont.sensors["r_Ground"]
  104. trigger = r_ground.triggered
  105. STANCE = own["stance"]
  106. motion = cont.actuators['MotionPump']
  107. linVelocity = own.getLinearVelocity(True)
  108. countdown = own['countdown']
  109. jump_timer = own['jump_timer']
  110. pos = own.localPosition
  111. rot = own.getAxisVect( [0.0, 0.0, 1.0])
  112. gray = cont.sensors["gRay"]
  113. #airconst = cont.actuators["airConst"]
  114. pop = cont.actuators["pop"]
  115. grindHit = own["grindHit"]
  116. grindCement = cont.actuators["grind_cement"]
  117. grindRail = cont.actuators["grind_rail"]
  118. grindSound = own["grindSound"]
  119. skater = scene.objects["Char4"]
  120. deck = scene.objects["deck"]
  121. trucks = scene.objects["trucks"]
  122. wheel1 = scene.objects["rollen.000"]
  123. wheel2 = scene.objects["rollen.001"]
  124. wheel3 = scene.objects["rollen.002"]
  125. wheel4 = scene.objects["rollen.003"]
  126. turnsens = .04
  127. turnsens2 = .06 #air_turn_boost
  128. grindDar = own["grindDar_hit"]
  129. grindEmpty = scene.objects["grindEmpty"]
  130. grindDar2 = grindEmpty.sensors["grindDar2"]
  131. #invertCol = cont.sensors["invertCol"]
  132. cam = scene.objects["Camera.003"]
  133. freecam = scene.objects["freecam"]
  134. followcam = scene.objects["followcam"]
  135. coping_on = own["coping"]
  136. invert_on = own['invert_on']
  137. grab_type = own['grab_type']
  138. c_ground = cont.sensors['c_ground']
  139. #
  140. control_bottom = scene.objects['control_bottom']
  141. invertTouch = control_bottom.sensors['grindCol_bottom']
  142. wallride = own["wallride"]
  143. wallride_col = cont.sensors['wallride']
  144. wallrideL = cont.sensors['wallrideL']
  145. wallrideR = cont.sensors['wallrideR']
  146. wallrideconstL = cont.actuators['wallrideconstL']
  147. wallrideconstR = cont.actuators['wallrideconstR']
  148. if r_ground.triggered: own['wallride_off'] = 0
  149. own['pop_sound'] = 0
  150. own['land_sound'] = 0
  151. #own['fall'] = 0
  152. #joystick location timers
  153. q1oncd = own["Q1oncd"]
  154. q2oncd = own["Q2oncd"]
  155. q3oncd = own["Q3oncd"]
  156. q4oncd = own["Q4oncd"]
  157. q5oncd = own["Q5oncd"]
  158. q6oncd = own["Q6oncd"]
  159. q7oncd = own["Q7oncd"]
  160. q8oncd = own["Q8oncd"]
  161. q1oncdl = own["Q1oncdl"]
  162. q2oncdl = own["Q2oncdl"]
  163. q3oncdl = own["Q3oncdl"]
  164. q4oncdl = own["Q4oncdl"]
  165. q5oncdl = own["Q5oncdl"]
  166. q6oncdl = own["Q6oncdl"]
  167. q7oncdl = own["Q7oncdl"]
  168. q8oncdl = own["Q8oncdl"]
  169. #setable
  170. grablay = 600 #this plus 1
  171. fliplay = 470
  172. MAX_VEL = 6.7
  173. SPEEDUP = .055
  174. SPEEDPUMP = .09 #.075
  175. SPEEDPUMPFAST = .13 #.09
  176. PUMP_SPEED_SENS = .4
  177. PUMP_SENS = .98
  178. ACCEL = 10
  179. CRUISE = 9
  180. COUNTDOWN = 20 #pump and speed stuff
  181. JUMPHEIGHT = 800 #775#750
  182. JUMPSTRENGTH = 0
  183. own['flip_manual_stance'] = 0
  184. CAVEMAN_SPEED = .75
  185. LAND_LAYER = 100
  186. LAND_END = 20
  187. #Sensor logic bricks connected to the python Controller
  188. aXis = cont.sensors["sControla"]
  189. bUtt = cont.sensors["sControlb"]
  190. onW = onWindows()
  191. # windows stuff
  192. lar_lts = 0
  193. uad_lts = 1
  194. lar_rts = 2 if onW else 2
  195. uad_rts = 3 if onW else 3
  196. lt = 4 if onW else 4
  197. rt = 5 if onW else 5
  198. # These are the numerical values associated with the buttons on the Xbox Controller
  199. # Called with - SensorName.getButtonStatus(buttonnumber) -
  200. # A joystick sensor logic brick (with the 'Button' Event Type; 'All Events' selected; and 'Tap' enabled) must be connected to the Python Controller logic brick to call these buttons
  201. a_but = 0 if onW else 0
  202. b_but = 1 if onW else 1
  203. x_but = 2 if onW else 2
  204. y_but = 3 if onW else 3
  205. l_bump = 9 if onW else 9
  206. r_bump = 10 if onW else 10
  207. bk_but = 4 if onW else 4
  208. st_but = 6 if onW else 6
  209. xb_but = 5 if onW else 5
  210. lts_pr = 7 if onW else 7
  211. rts_pr = 8 if onW else 8
  212. l_dp = 13 if onW else 13
  213. r_dp = 14 if onW else 14
  214. u_dp = 11 if onW else 11
  215. d_dp = 12 if onW else 12
  216. lLR = aXis.axisValues[lar_lts] / reduction
  217. lUD = aXis.axisValues[uad_lts] / reduction
  218. rLR = aXis.axisValues[lar_rts] / reduction
  219. rUD = aXis.axisValues[uad_rts] / reduction
  220. lTrig = aXis.axisValues[lt] / reduction
  221. rTrig = aXis.axisValues[rt] / reduction
  222. aBut = bUtt.getButtonStatus(a_but)
  223. bBut = bUtt.getButtonStatus(b_but)
  224. xBut = bUtt.getButtonStatus(x_but)
  225. yBut = bUtt.getButtonStatus(y_but)
  226. lBump = bUtt.getButtonStatus(l_bump)
  227. rBump = bUtt.getButtonStatus(r_bump)
  228. bkBut = bUtt.getButtonStatus(bk_but)
  229. stBut = bUtt.getButtonStatus(st_but)
  230. xbBut = bUtt.getButtonStatus(xb_but)
  231. ltsBut = bUtt.getButtonStatus(lts_pr)
  232. rtsBut = bUtt.getButtonStatus(rts_pr)
  233. ldPad = bUtt.getButtonStatus(l_dp)
  234. rdPad = bUtt.getButtonStatus(r_dp)
  235. udPad = bUtt.getButtonStatus(u_dp)
  236. ddPad = bUtt.getButtonStatus(d_dp)
  237. ## -End- ##
  238. list = bUtt.getButtonActiveList()
  239. #print(list)
  240. #no input
  241. def cutOff():
  242. if (abs(lLR) < axisTh
  243. and abs(lUD) < axisTh
  244. and abs(rLR) < axisTh
  245. and abs(rUD) < axisTh
  246. and aBut == False):
  247. return True
  248. #fliptricks after manuals
  249. if (frame - own['last_manual_frame']) < 25:
  250. flip_start_lay = 8
  251. flipspeed = .4
  252. own['flipspeed'] = .4
  253. own['flip_start_lay'] = 8
  254. #print("chopping flip start")
  255. else:
  256. flip_start_lay = 1
  257. own['flip_start_lay'] = 1
  258. flipspeed = .6
  259. own['flipspeed'] = .6
  260. def printplaying():
  261. splaying_layers = "S: "
  262. playing_layers = "D: "
  263. tplaying_layers = "T: "
  264. for x in range(9900):
  265. if skater.isPlayingAction(x):
  266. #if trucks.isPlayingAction(x):
  267. #if skater.isPlayingAction(x):
  268. splaying_layers += str(x)
  269. splaying_layers += " "
  270. if deck.isPlayingAction(x):
  271. #if trucks.isPlayingAction(x):
  272. #if skater.isPlayingAction(x):
  273. playing_layers += str(x)
  274. playing_layers += " "
  275. if trucks.isPlayingAction(x):
  276. #if trucks.isPlayingAction(x):
  277. #if skater.isPlayingAction(x):
  278. tplaying_layers += str(x)
  279. tplaying_layers += " "
  280. print(splaying_layers, playing_layers, tplaying_layers)
  281. if aBut == True and lasta == False and r_ground.triggered:
  282. aBut_ground = True
  283. own['aBut_ground'] = True
  284. #else:
  285. if aBut == False:
  286. aBut_ground = False
  287. own['aBut_ground'] = False
  288. if xBut == True and lastx == False and r_ground.triggered:
  289. xBut_ground = True
  290. own['xBut_ground'] = True
  291. #else:
  292. if xBut == False:
  293. xBut_ground = False
  294. own['xBut_ground'] = False
  295. def killact(layer):
  296. if skater.isPlayingAction(layer):
  297. skater.stopAction(layer)
  298. if deck.isPlayingAction(layer):
  299. deck.stopAction(layer)
  300. if trucks.isPlayingAction(layer):
  301. trucks.stopAction(layer)
  302. def killall():
  303. for x in range(9000):
  304. skater.stopAction(x)
  305. deck.stopAction(x)
  306. trucks.stopAction(x)
  307. def grind_stance():
  308. #own["last_grind_stance"] = own["grind_stance"]
  309. # if grindHit == 1 and LAST_GRIND == 1 and (own['grindCountdown'] < 15 or own['grindCountdown'] >19):
  310. # own["last_grind_stance"] = own["grind_stance"]
  311. #own["grind_stance"] = STANCE
  312. pass
  313. grind_stance()
  314. def reset_rtimers():
  315. own["Q1oncd"] = 0
  316. own["Q2oncd"] = 0
  317. own["Q3oncd"] = 0
  318. own["Q4oncd"] = 0
  319. own["Q5oncd"] = 0
  320. own["Q6oncd"] = 0
  321. own["Q7oncd"] = 0
  322. own["Q8oncd"] = 0
  323. q1oncd = 0
  324. q2oncd = 0
  325. q3oncd = 0
  326. q4oncd = 0
  327. q5oncd = 0
  328. q6oncd = 0
  329. q7oncd = 0
  330. q8oncd = 0
  331. def check_fall():
  332. playing_frame = 20
  333. if skater.isPlayingAction(fliplay):
  334. playing_frame = skater.getActionFrame(fliplay)
  335. if r_ground.triggered == True and skater.isPlayingAction(fliplay) and own['jump_timer'] < 40 and playing_frame < 14 and playing_frame > 3:
  336. own['fall'] = 1
  337. print("fall: ", playing_frame, own['jump_timer'])
  338. check_fall()
  339. def check_landing():
  340. lf_ground = own["lF_ground"]
  341. #zvel = own.getLinearVelocity
  342. #print(zvel)
  343. STANCE = own["stance"]
  344. #if lf_ground == False and r_ground.triggered == True and grindDar == 0:
  345. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  346. #if playing_action_frame < (LAND_END):
  347. #own["lastPump"] = False
  348. #own["Pump"] = False
  349. if lf_ground == False and r_ground.triggered == True:
  350. #resetjumpstance()
  351. #print(r_ground.hitObject)
  352. own['jump_from_trans'] = 0
  353. nearestObject = None
  354. minDist = None
  355. detectedObjects = grindDar2.hitObjectList
  356. #if grindHit == False and gray.triggered == False and touched == False:
  357. # if grindDar2.positive:
  358. # for obj in detectedObjects:
  359. # dist = own.getDistanceTo(obj)
  360. # if (minDist is None or dist < minDist):
  361. # nearestObject = obj
  362. # minDist = dist
  363. # if nearestObject != None and 'rail' in scene.objects[nearestObject]:
  364. # cont.activate(own.actuators["landonrail"])
  365. # print("landonrail***************")
  366. #play landing sound
  367. if grindDar == 0:
  368. #print("you are not grinding", grindHit)
  369. lastheight = own["air_height"]
  370. pos = own.worldPosition.z
  371. dist = lastheight - pos
  372. dist = dist * 2
  373. #print(dist, "-------------dist")
  374. if dist > 1:
  375. dist = 1
  376. own.actuators["land"].volume = dist
  377. #cont.deactivate(own.actuators["land"])
  378. sact = own.actuators["land"]
  379. sact.stopSound()
  380. cont.activate(own.actuators["land"])
  381. own['land_sound'] = 1
  382. if grindDar == 1:
  383. pass
  384. #cont.activate(own.actuators["landonrail"])
  385. #vibrate
  386. #set_vibration(0, 0.3, 0.3)
  387. own["vib_Countdown"] = 14
  388. cont.activate(own.actuators["Vibration"])
  389. #print("vibrate")
  390. if own['manual_v2'] == 0 and grindDar == 0:
  391. if STANCE == 0:
  392. own['requestAction'] = 'reg_land'
  393. elif STANCE == 1:
  394. own['requestAction'] = 'fak_land'
  395. killact(2)
  396. killact(3)
  397. killact(4)
  398. killact(5)
  399. lf_ground = r_ground.triggered
  400. own["lF_ground"] = lf_ground
  401. vib_countdown = own["vib_Countdown"]
  402. if vib_countdown == 0:
  403. pass
  404. #set_vibration(0, 0, 0)
  405. elif vib_countdown > 0:
  406. vib_countdown = vib_countdown - 1
  407. own["vib_Countdown"] = vib_countdown
  408. if vib_countdown == 1:
  409. stopAnims()
  410. stance()
  411. #air anim
  412. if r_ground.triggered == False:
  413. if STANCE == 0:
  414. own['requestAction'] = 'reg_air'
  415. if STANCE == 1:
  416. own['requestAction'] = 'fak_air'
  417. else:
  418. if STANCE == 0:
  419. own['requestAction'] = 'reg_roll'
  420. if STANCE == 1:
  421. own['requestAction'] = 'fak_roll'
  422. #check manual_v2
  423. if (rUD > .04 and rUD < .07) or (rUD < -.04 and rUD > -.07):
  424. #if (rUD > .04 and rUD < .07):
  425. #print("zoned")
  426. timer = own['manual_v2_timer']
  427. timer = timer + 1
  428. if timer > 20:
  429. own['manual_v2'] = 1
  430. own['manual_v2_timer'] = timer
  431. if rUD < .04 and rUD > -.04:
  432. own['manual_v2_timer'] = 0
  433. own['manual_v2'] = 0
  434. own['manual_v2_type'] = None
  435. if own['manual_v2'] == 1:
  436. if own['last_manual_v2'] == 0:
  437. #print("don't flip")
  438. if STANCE == 0:
  439. if rUD > .04 and rUD < .07:
  440. #print("reg manual")
  441. own['manual_v2_type'] = 'reg manual'
  442. own['requestAction'] = 'reg_manual'
  443. if rUD < -.04 and rUD > -.07:
  444. #print("reg nose manual")
  445. own['manual_v2_type'] = 'reg nose manual'
  446. own['requestAction'] = 'reg_nose_manual'
  447. if STANCE == 1:
  448. if rUD > .04 and rUD < .07:
  449. #print("fak manual")
  450. own['manual_v2_type'] = 'fak manual'
  451. own['requestAction'] = 'fak_manual'
  452. if rUD < -.04 and rUD > -.07:
  453. #print("fak nose manual")
  454. own['manual_v2_type'] = 'fak nose manual'
  455. own['requestAction'] = 'fak_nose_manual'
  456. else:
  457. #print("flip stance")
  458. if STANCE == 0:
  459. if own['manual_v2_type'] == 'fak manual':
  460. own['manual_v2_type'] = 'reg nose manual'
  461. if own['manual_v2_type'] == 'fak nose manual':
  462. own['manual_v2_type'] = 'reg manual'
  463. if STANCE == 1:
  464. if own['manual_v2_type'] == 'reg manual':
  465. own['manual_v2_type'] = 'fak nose manual'
  466. if own['manual_v2_type'] == 'reg nose manual':
  467. own['manual_v2_type'] = 'fak manual'
  468. #print(own['manual_v2'], own['manual_v2_type'])
  469. #check manual
  470. ####
  471. #reg
  472. if rUD > .04 and rUD < .07 and STANCE == 0 and rLR < .035 and rLR > -.035:
  473. timer = own["reg_manual_timer"]
  474. timer = timer + 1
  475. own["reg_manual_timer"] = timer
  476. if timer > 20 and rUD < .04:
  477. own["reg_manual"] = 0
  478. #print("reg_man off")
  479. if rUD <= .04 and (STANCE == 1 or STANCE == 0) and rUD >= -.04:
  480. own["reg_manual_timer"] = 0
  481. own["reg_manual"] = 0
  482. #print("reg_man off2")
  483. #####
  484. if own["reg_manual_timer"] > 10 and own["fak_manual"] == 0 and own['reg_nmanual'] == 0:
  485. #if own["reg_manual_timer"] > 10 and own["fak_manual"] == 0:
  486. #if own['fak_nmanual'] == 0:
  487. own["reg_manual"] = 1
  488. ######
  489. if own["reg_manual_timer"] == 0:
  490. own["reg_manual"] = 0
  491. if own['last_reg_manual'] == 1 and own['reg_manual'] == 0:
  492. killall()
  493. #print(own["reg_manual"])
  494. ####
  495. #fak
  496. if rUD > .04 and rUD < .07 and STANCE == 1 and rLR < .035 and rLR > -.035:
  497. timer = own["fak_manual_timer"]
  498. timer = timer + 1
  499. own["fak_manual_timer"] = timer
  500. if timer > 20:
  501. own["fak_manual"] = 0
  502. if rUD <= .04 and (STANCE == 1 or STANCE == 0) and rUD >= -.04:
  503. own["fak_manual_timer"] = 0
  504. own["fak_manual"] = 0
  505. if own["fak_manual_timer"] > 10 and own["reg_manual"] == 0:
  506. own["fak_manual"] = 1
  507. if own["fak_manual_timer"] == 0:
  508. own["fak_manual"] = 0
  509. if own['last_fak_manual'] == 1 and own['fak_manual'] == 0:
  510. killall()
  511. #print(own["reg_manual"], own["fak_manual"])
  512. #####
  513. #reg nmanual
  514. if rUD < -.04 and rUD > -.07 and STANCE == 0 and rLR < .035 and rLR > -.035:
  515. timer = own["reg_nmanual_timer"]
  516. timer = timer + 1
  517. own["reg_nmanual_timer"] = timer
  518. if timer > 20:
  519. own["reg_nmanual"] = 0
  520. if rUD >= -.04 and (STANCE == 1 or STANCE == 0) and rUD <= .04:
  521. own["reg_nmanual_timer"] = 0
  522. own["reg_nmanual"] = 0
  523. if own["reg_nmanual_timer"] > 10 and own["fak_nmanual"] == 0 and own['reg_manual'] == 0 and own['fak_manual'] == 0:
  524. if own['last_fak_manual'] == False and own['last_reg_manual'] == False and own['last_fak_manual'] == False:
  525. own["reg_nmanual"] = 1
  526. #print("baaad", own['reg_manual'], own['last_reg_manual'])
  527. if own["reg_nmanual_timer"] == 0:
  528. own["reg_nmanual"] = 0
  529. if own['last_reg_nmanual'] == 1 and own['reg_nmanual'] == 0:
  530. killall()
  531. #####
  532. #fak nmanual
  533. #print (rUD)
  534. if rUD < -.04 and rUD > -.07 and STANCE == 1 and rLR < .035 and rLR > -.035:
  535. timer = own["fak_nmanual_timer"]
  536. timer = timer + 1
  537. own["fak_nmanual_timer"] = timer
  538. if timer > 20:
  539. own["fak_nmanual"] = 0
  540. if rUD >= -.04 and (STANCE == 1 or STANCE == 0) and rUD <= .04:
  541. own["fak_nmanual_timer"] = 0
  542. own["fak_nmanual"] = 0
  543. #print('@@@@@@@@@fak_man_off_1')
  544. if own["fak_nmanual_timer"] > 10 and own["reg_nmanual"] == 0 and own['fak_manual'] == 0 and own ['reg_manual'] == 0:
  545. own["fak_nmanual"] = 1
  546. if own["fak_nmanual_timer"] == 0 and own['reg_manual'] == 0:
  547. #if own['flip_manual_stance'] == 0:
  548. own["fak_nmanual"] = 0
  549. if own['last_fak_nmanual'] == 1 and own['fak_nmanual'] == 0:
  550. killall()
  551. #print("rm ", own["reg_manual"], "rnm ", own["reg_nmanual"], "fm ", own["fak_manual"], "fnm ", own["fak_nmanual"])
  552. def reg_stance_left_off():
  553. LAST_LEFT = own["LAST_LEFT"]
  554. own["LAST_LEFT"] = 0
  555. def reg_stance_right_off():
  556. LAST_RIGHT = own["LAST_RIGHT"]
  557. own["LAST_RIGHT"] = 0
  558. def reg_stance_on():
  559. #revert_timer
  560. playing = deck.isPlayingAction(40)
  561. if own["revert_timer"] < 1 and own['manual_v2'] == 0 and playing == 0:
  562. own['requestAction'] = 'reg_roll'
  563. def reg_stance_off():
  564. killact(2)
  565. def reg_manual_on():
  566. own['requestAction'] = 'reg_manual'
  567. if own["reg_manual_timer"] == 41:
  568. killact(3000)
  569. killact(3001)
  570. killact(3002)
  571. def reg_manual_off():
  572. killact(222)
  573. killact(223)
  574. killact(224)
  575. killact(3000)
  576. killact(3001)
  577. killact(3002)
  578. killact(10)
  579. killact(32)
  580. killact(11)
  581. killact(34)
  582. def fak_manual_on():
  583. #killall()
  584. own['requestAction'] = 'fak_manual'
  585. if own["fak_manual_timer"] == 41:
  586. killact(3000)
  587. killact(3001)
  588. killact(3002)
  589. def fak_manual_off():
  590. killact(222)
  591. killact(223)
  592. killact(224)
  593. killact(3000)
  594. killact(3001)
  595. killact(3002)
  596. killact(10)
  597. killact(32)
  598. killact(11)
  599. killact(34)
  600. #######
  601. #######
  602. #######
  603. #######
  604. def reg_nmanual_on():
  605. own['requestAction'] = 'reg_nmanual'
  606. if own["reg_nmanual_timer"] == 41:
  607. killact(3000)
  608. killact(3001)
  609. killact(3002)
  610. def reg_nmanual_off():
  611. killact(222)
  612. killact(223)
  613. killact(224)
  614. killact(3000)
  615. killact(3001)
  616. killact(3002)
  617. killact(10)
  618. killact(32)
  619. killact(11)
  620. killact(34)
  621. def fak_nmanual_on():
  622. own['requestAction'] = 'fak_nmanual'
  623. if own["fak_nmanual_timer"] == 41:
  624. killact(3000)
  625. killact(3001)
  626. killact(3002)
  627. def fak_nmanual_off():
  628. killact(222)
  629. killact(223)
  630. killact(224)
  631. killact(3000)
  632. killact(3001)
  633. killact(3002)
  634. killact(10)
  635. killact(32)
  636. killact(11)
  637. killact(34)
  638. ###########
  639. def reg_stanceinc_on():
  640. skater.playAction("nreg", 1,60, layer=3, blendin=2, layer_weight=0, play_mode=1, speed=.5)
  641. deck.playAction("a_reg", 1,40, layer=3, blendin=0, blend_mode=0, play_mode=1, speed=.5)
  642. trucks.playAction("a_reg", 1,40, layer=3, blendin=2, layer_weight=0, play_mode=1, speed=.5)
  643. def reg_stanceinc_off():
  644. killact(3)
  645. def reg_stance_left_on():
  646. if own['manual_v2'] == 0 and own["revert_timer"] < 1:
  647. own['requestAction'] = 'reg_turnLeft'
  648. LAST_LEFT = own["LAST_LEFT"]
  649. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  650. if LAST_LEFT == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
  651. LAST_LEFT = 1
  652. own["LAST_LEFT"] = 1
  653. def reg_stance_right_on():
  654. if own['manual_v2'] == 0 and own["revert_timer"] < 1:
  655. own['requestAction'] = 'reg_turnRight'
  656. LAST_RIGHT = own["LAST_RIGHT"]
  657. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  658. if LAST_RIGHT == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
  659. LAST_RIGHT = 1
  660. own["LAST_RIGHT"] = 1
  661. def fak_stance_on():
  662. playing = deck.isPlayingAction(40)
  663. if own['manual_v2'] == 0 and own["revert_timer"] < 1 and playing == 0:
  664. own['requestAction'] = 'fak_roll'
  665. def fak_stance_off():
  666. killact(3)
  667. def fak_stance_left_on():
  668. if own['manual_v2'] == 0 and own["revert_timer"] < 1:
  669. own['requestAction'] = 'fak_turnLeft'
  670. LAST_LEFT_FAK = own["LAST_LEFT_FAK"]
  671. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  672. if LAST_LEFT_FAK == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
  673. LAST_LEFT_FAK = 1
  674. own["LAST_LEFT_FAK"] = 1
  675. def fak_stance_left_off():
  676. killact(12)
  677. killact(36)
  678. LAST_LEFT_FAK = own["LAST_LEFT_FAK"]
  679. own["LAST_LEFT_FAK"] = 0
  680. def fak_stance_right_on():
  681. if own['manual_v2'] == 0 and own["revert_timer"] < 1:
  682. own['requestAction'] = 'fak_turnRight'
  683. LAST_RIGHT_FAK = own["LAST_RIGHT_FAK"]
  684. own["LAST_RIGHT_FAK"] = 1
  685. def fak_stance_right_off():
  686. killact(13)
  687. killact(37)
  688. LAST_RIGHT_FAK = own["LAST_RIGHT_FAK"]
  689. own["LAST_RIGHT_FAK"] = 0
  690. def reg_air_on():
  691. playing = deck.isPlayingAction(fliplay)
  692. if playing == False:
  693. own['requestAction'] = 'reg_air'
  694. def reg_air_off():
  695. killact(4)
  696. def fak_air_on():
  697. flipping = skater.isPlayingAction(fliplay)
  698. if flipping == False:
  699. own['requestAction'] = 'fak_air'
  700. def fak_air_off():
  701. killact(5)
  702. #$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  703. def stance():
  704. # turnsens = .04
  705. # turnblend = 10
  706. rotation = .96
  707. turnsens = 0.06
  708. if rot.z < .9: inc = 1
  709. else: inc = 0
  710. flipping = skater.isPlayingAction(500)
  711. #print(flipping)
  712. #ground
  713. if r_ground.triggered == True and grindHit == False and flipping == False and own["wallride"] == None and own['revert_timer'] < 2:
  714. if STANCE == 0:
  715. reg_manual = own['reg_manual']
  716. fak_manual = own["fak_manual"]
  717. reg_nmanual = own['reg_nmanual']
  718. fak_nmanual = own["fak_nmanual"]
  719. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  720. fak_stance_off()
  721. reg_air_off()
  722. fak_air_off()
  723. if reg_manual == 0 and fak_manual == 0:
  724. last_manual = own['last_reg_manual']
  725. if last_manual == 1:
  726. reg_manual_off()
  727. fak_manual_off()
  728. reg_stance_on()
  729. if own['manual_v2_type'] == 'reg manual':
  730. reg_manual_on()
  731. elif own['manual_v2_type'] == 'reg nose manual':
  732. reg_nmanual_on()
  733. elif own['manual_v2_type'] == 'fak manual':
  734. fak_manual_on()
  735. elif own['manual_v2_type'] == 'fak nose manual':
  736. fak_nmanual_on()
  737. if STANCE == 1:
  738. reg_manual = own['reg_manual']
  739. fak_manual = own["fak_manual"]
  740. reg_nmanual = own['reg_nmanual']
  741. fak_nmanual = own["fak_nmanual"]
  742. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  743. reg_stance_off()
  744. reg_air_off()
  745. fak_air_off
  746. if fak_manual == 0:
  747. last_manual = own['last_fak_manual']
  748. if last_manual == 1:
  749. fak_manual_off()
  750. reg_manual_off()
  751. fak_stance_on()
  752. if own['manual_v2_type'] == 'fak manual':
  753. fak_manual_on()
  754. elif own['manual_v2_type'] == 'fak nose manual':
  755. fak_nmanual_on()
  756. elif own['manual_v2_type'] == 'reg manual':
  757. reg_manual_on()
  758. elif own['manual_v2_type'] == 'reg nose manual':
  759. reg_nmanual_on()
  760. if own["Pump"] == False:
  761. if lLR < -turnsens and STANCE == 0:
  762. reg_stance_left_on()
  763. if lLR > -turnsens or LAST_GRIND != grindHit:
  764. reg_stance_left_off()
  765. if lLR > turnsens and STANCE == 0:
  766. reg_stance_right_on()
  767. if lLR < turnsens or LAST_GRIND != grindHit:
  768. reg_stance_right_off()
  769. if lLR < -turnsens and STANCE == 1:
  770. fak_stance_left_on()
  771. if lLR > -turnsens or LAST_GRIND != grindHit:
  772. fak_stance_left_off()
  773. if lLR > turnsens and STANCE == 1:
  774. fak_stance_right_on()
  775. if lLR < turnsens or LAST_GRIND != grindHit:
  776. fak_stance_right_off()
  777. #air
  778. playing = deck.isPlayingAction(fliplay)
  779. if r_ground.triggered == False and playing == False and flipping == False:
  780. if STANCE == 0:
  781. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  782. fak_air_off()
  783. reg_stance_off()
  784. fak_stance_off()
  785. reg_stance_left_off()
  786. reg_stance_right_off()
  787. fak_stance_left_off()
  788. fak_stance_right_off()
  789. reg_air_on()
  790. if STANCE == 1:
  791. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  792. reg_air_off()
  793. reg_stance_off()
  794. fak_stance_off()
  795. reg_stance_left_off()
  796. reg_stance_right_off()
  797. fak_stance_left_off()
  798. fak_stance_right_off()
  799. fak_air_on()
  800. if grindHit == True:
  801. reg_stance_off()
  802. fak_stance_off()
  803. ###################
  804. #trick definitions#
  805. ###################
  806. def jump():
  807. #print("jump funct")
  808. jump_timer = own['jump_timer']
  809. reg_manual_off()
  810. fak_manual_off()
  811. reg_nmanual_off()
  812. fak_nmanual_off()
  813. cont.deactivate(wallrideconstL)
  814. cont.deactivate(wallrideconstR)
  815. if JUMPSTRENGTH != 0:
  816. height = JUMPSTRENGTH * JUMPHEIGHT
  817. else:
  818. height = JUMPHEIGHT
  819. #if jump_timer == 0:
  820. if jump_timer < 50:
  821. jump_timer = 60
  822. own['jump_timer'] = jump_timer
  823. if zvel < 7 and jump_timer == 60:
  824. cont.activate(own.actuators["pop"])
  825. own['pop_sound'] = 1
  826. print("jump")
  827. #
  828. posx = own.worldPosition[0]
  829. posy = own.worldPosition[1]
  830. posz = own.worldPosition[2]
  831. jumppos = Vector((posx, posy, posz))
  832. own['jumpPos'] = jumppos
  833. force = [ 0.0, 0.0, height]
  834. # use local axis
  835. local = False
  836. # apply force
  837. try:
  838. if 'trans' in r_ground.hitObject:
  839. print('jump from trans')
  840. own['jump_from_trans'] = 1
  841. own['trans_jump_obj'] = r_ground.hitObject
  842. except:
  843. print('trans jump broke')
  844. if grindHit == False:
  845. own.applyForce(force, local)
  846. force2 = [0.0, 0, 150]
  847. own.applyForce(force2, True)
  848. #print("apply jump force1")
  849. if grindHit == True:
  850. linvelloc = own.getLinearVelocity(True)
  851. own.applyForce(force, True)
  852. force2 = [0.0, 0, 150]
  853. own.applyForce(force2, True)
  854. linvelloc2 = own.getLinearVelocity(True)
  855. force = (linvelloc.x, linvelloc.y, linvelloc2.z)
  856. own.setLinearVelocity(force, True)
  857. #print("apply jump force2 grindHit")
  858. own['jump_stance'] = STANCE
  859. if STANCE == True:
  860. own["jump_stance"] = 1
  861. if STANCE == False:
  862. own["jump_stance"] = 0
  863. #own["jump_stance"] = own["stance"]
  864. if grindHit == True:
  865. own['grind_jump'] = 1
  866. if lLR > turnsens or lLR < -turnsens or lUD > turnsens or lUD < -turnsens:
  867. own['grindjumpturn'] = True
  868. #print("turn on grindjumpturn")
  869. num = 1
  870. if num ==1:
  871. rString = "R"
  872. lString = "L"
  873. cont.deactivate(wallrideconstL)
  874. cont.deactivate(wallrideconstR)
  875. #print("deactivating constraints")
  876. if own["wallride"] == "R":
  877. force = [0,170,0]
  878. own.applyForce(force, True)
  879. print("****walljumpforce R")
  880. cont.activate(own.actuators["pop2"])
  881. jump_timer = 60
  882. own['jump_timer'] = jump_timer
  883. if own["wallride"] == "L":
  884. force = [0,-170,0] #325
  885. own.applyForce(force, True)
  886. print("****walljumpforce L")
  887. cont.activate(own.actuators["pop2"])
  888. jump_timer = 60
  889. own['jump_timer'] = jump_timer
  890. own["Q1oncd"] = 0
  891. own["Q2oncd"] = 0
  892. own["Q3oncd"] = 0
  893. own["Q4oncd"] = 0
  894. own["Q5oncd"] = 0
  895. own["Q6oncd"] = 0
  896. own["Q7oncd"] = 0
  897. own["Q8oncd"] = 0
  898. if own['jump_timer'] == 60:
  899. own['jump_timer'] = 59
  900. def jump_Timer():
  901. jump_timer = own['jump_timer']
  902. if jump_timer > 0:
  903. jump_timer = jump_timer - 1
  904. own['jump_timer'] = jump_timer
  905. if own['grindjumpturn'] == True:
  906. jump_timer = 30
  907. own['jump_timer'] = jump_timer
  908. def pump():
  909. velocity = own['velocity']
  910. #regular
  911. local = True
  912. downforce = -.1
  913. if linVelocity.x < MAX_VEL and linVelocity.x >= -0 and STANCE == 1 and grindHit == False:
  914. countdown = COUNTDOWN
  915. yvel = linVelocity.x + SPEEDPUMP
  916. yvel2 = linVelocity.x + SPEEDPUMPFAST
  917. own['countdown'] = countdown
  918. force = [(yvel), 0, linVelocity.z + downforce]
  919. force2 = [(yvel2), 0, linVelocity.z + downforce]
  920. if rot.z < PUMP_SENS and rot.z > PUMP_SPEED_SENS:
  921. own.setLinearVelocity(force, local)
  922. if rot.z < PUMP_SENS and rot.z <= PUMP_SPEED_SENS:
  923. own.setLinearVelocity(force2, local)
  924. own['requestAction'] = 'fak_pump'
  925. #switch
  926. if linVelocity.x > -MAX_VEL and linVelocity.x <= 0 and STANCE == 0 and grindHit == False:
  927. countdown = COUNTDOWN
  928. yvel = linVelocity.x - SPEEDPUMP
  929. yvel2 = linVelocity.x - SPEEDPUMPFAST
  930. own['countdown'] = countdown
  931. force = [(yvel), 0, linVelocity.z + downforce]
  932. force2 = [(yvel2), 0, linVelocity.z + downforce]
  933. if rot.z < PUMP_SENS and rot.z > PUMP_SPEED_SENS:
  934. own.setLinearVelocity(force, local)
  935. if rot.z < PUMP_SENS and rot.z <= PUMP_SPEED_SENS:
  936. own.setLinearVelocity(force2, local)
  937. own['requestAction'] = 'reg_pump'
  938. own["Pump"] = True
  939. own["lastPump"] = True
  940. def roll():
  941. if r_ground.triggered == 1:
  942. pass
  943. def stop():
  944. if linVelocity.x < .05 and linVelocity.x > -.05:
  945. can_stop = 0
  946. own["lastStop"] = True
  947. else:
  948. can_stop = 1
  949. if r_ground.triggered == 1 and STANCE == False and can_stop == 1:
  950. own['requestAction'] = 'reg_stop'
  951. yvel = linVelocity.x * .985
  952. force = [(yvel), 0, linVelocity.z]
  953. own.setLinearVelocity(force, True)
  954. elif r_ground.triggered == 1 and STANCE == True and can_stop == 1:
  955. own['requestAction'] = 'fak_stop'
  956. yvel = linVelocity.x * .985
  957. force = [(yvel), 0, linVelocity.z]
  958. own.setLinearVelocity(force, True)
  959. if linVelocity.x < .05 and linVelocity.x > -.05 and own["lastStop"] == True:
  960. own["lastStop"] == False
  961. def oposin():
  962. if skater.isPlayingAction(30) or skater.isPlayingAction(31):
  963. landing = 1
  964. else:
  965. landing = 0
  966. if (r_ground.triggered == 1) and STANCE == False and landing == 0 and own['manual'] == 0:
  967. if grindold == 0:
  968. own['requestAction'] = 'reg_opos'
  969. elif (r_ground.triggered == 1) and STANCE == True and own['manual'] == 0:
  970. if grindold == 0:
  971. own['requestAction'] = 'fak_opos'
  972. else:
  973. killact(65)
  974. killact(66)
  975. killact(67)
  976. killact(68)
  977. own["last_Opos"] = True
  978. def noposin():
  979. if skater.isPlayingAction(30) or skater.isPlayingAction(31):
  980. landing = 1
  981. else:
  982. landing = 0
  983. if (r_ground.triggered == 1) and STANCE == False and landing == 0 and own['manual'] == 0:
  984. if grindold == 0:
  985. own['requestAction'] = 'reg_nopos'
  986. elif (r_ground.triggered == 1) and STANCE == True and own['manual'] == 0:
  987. if grindold == 0:
  988. own['requestAction'] = 'fak_nopos'
  989. else:
  990. killact(71)
  991. killact(72)
  992. killact(73)
  993. killact(74)
  994. own["last_nOpos"] = True
  995. def aollie():
  996. print("ollie")
  997. dict['trick_string'] = 'Ollie'
  998. r_ground = cont.sensors["r_Ground"]
  999. trigger = r_ground.triggered
  1000. STANCE = own["stance"]
  1001. wallride = own["wallride"]
  1002. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1003. own["wallride_off"] = 1
  1004. own['requestAction'] = 'reg_ollie'
  1005. jump()
  1006. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1007. own["wallride_off"] = 1
  1008. own['requestAction'] = 'fak_ollie'
  1009. jump()
  1010. def nollie():
  1011. print("nollie")
  1012. dict['trick_string'] = 'Nollie'
  1013. r_ground = cont.sensors["r_Ground"]
  1014. trigger = r_ground.triggered
  1015. STANCE = own["stance"]
  1016. if (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1017. own['requestAction'] = 'fak_nollie'
  1018. own["wallride_off"] = 1
  1019. jump()
  1020. elif (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1021. own["wallride_off"] = 1
  1022. own['requestAction'] = 'reg_nollie'
  1023. jump()
  1024. def kickflip():
  1025. print("kickflip")
  1026. dict['trick_string'] = 'Kickflip'
  1027. STANCE = own["stance"]
  1028. print(flip_start_lay)
  1029. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1030. own["wallride_off"] = 1
  1031. own['requestAction'] = 'reg_kickflip'
  1032. jump()
  1033. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1034. own["wallride_off"] = 1
  1035. own['requestAction'] = 'fak_kickflip'
  1036. jump()
  1037. if own["wallride"] !=1: jump()
  1038. if r_ground.triggered == 0 and STANCE == False:
  1039. own["wallride_off"] = 1
  1040. own['requestAction'] = 'reg_kickflip'
  1041. if own["wallride"] != None:
  1042. jump()
  1043. elif r_ground.triggered == 0 and STANCE == True:
  1044. own["wallride_off"] = 1
  1045. own['requestAction'] = 'fak_kickflip'
  1046. if own["wallride"] != None:
  1047. jump()
  1048. def varial_kickflip():
  1049. print("varial kickflip")
  1050. dict['trick_string'] = 'Varial Kickflip'
  1051. STANCE = own["stance"]
  1052. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1053. own["wallride_off"] = 1
  1054. own['requestAction'] = 'reg_varial_kickflip'
  1055. jump()
  1056. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1057. own["wallride_off"] = 1
  1058. own['requestAction'] = 'fak_varial_kickflip'
  1059. jump()
  1060. if r_ground.triggered == 0 and STANCE == False:
  1061. own["wallride_off"] = 1
  1062. if own["wallride"] != None:
  1063. jump()
  1064. elif r_ground.triggered == 0 and STANCE == True:
  1065. own["wallride_off"] = 1
  1066. if own["wallride"] != None:
  1067. jump()
  1068. def nollie_varial_kickflip():
  1069. print("nollie varial kickflip")
  1070. dict['trick_string'] = 'Nollie Varial Kickflip'
  1071. STANCE = own["stance"]
  1072. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1073. own["wallride_off"] = 1
  1074. own['requestAction'] = 'reg_nollie_varial_kickflip'
  1075. jump()
  1076. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1077. own["wallride_off"] = 1
  1078. own['requestAction'] = 'fak_nollie_varial_kickflip'
  1079. jump()
  1080. if r_ground.triggered == 0 and STANCE == False:
  1081. own["wallride_off"] = 1
  1082. if own["wallride"] != None:
  1083. jump()
  1084. elif r_ground.triggered == 0 and STANCE == True:
  1085. own["wallride_off"] = 1
  1086. if own["wallride"] != None:
  1087. jump()
  1088. def nollie_varial_heelflip():
  1089. print("nollie varial heelflip")
  1090. dict['trick_string'] = 'Nollie Varial Heelflip'
  1091. STANCE = own["stance"]
  1092. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1093. own["wallride_off"] = 1
  1094. own['requestAction'] = 'reg_nollie_varial_heelflip'
  1095. jump()
  1096. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1097. own["wallride_off"] = 1
  1098. own['requestAction'] = 'fak_nollie_varial_heelflip'
  1099. jump()
  1100. if r_ground.triggered == 0 and STANCE == False:
  1101. own["wallride_off"] = 1
  1102. if own["wallride"] != None:
  1103. jump()
  1104. elif r_ground.triggered == 0 and STANCE == True:
  1105. own["wallride_off"] = 1
  1106. if own["wallride"] != None:
  1107. jump()
  1108. def varial_heelflip():
  1109. print("varial heelflip")
  1110. dict['trick_string'] = 'Varial Heelflip'
  1111. STANCE = own["stance"]
  1112. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1113. own["wallride_off"] = 1
  1114. own['requestAction'] = 'reg_varial_heelflip'
  1115. jump()
  1116. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1117. own["wallride_off"] = 1
  1118. own['requestAction'] = 'fak_varial_heelflip'
  1119. jump()
  1120. if r_ground.triggered == 0 and STANCE == False:
  1121. own["wallride_off"] = 1
  1122. if own["wallride"] != None:
  1123. jump()
  1124. elif r_ground.triggered == 0 and STANCE == True:
  1125. own["wallride_off"] = 1
  1126. if own["wallride"] != None:
  1127. jump()
  1128. def nollie_kickflip():
  1129. print("kickflip")
  1130. STANCE = own["stance"]
  1131. dict['trick_string'] = 'Nollie Kickflip'
  1132. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1133. own["wallride_off"] = 1
  1134. own['requestAction'] = 'reg_nollie_kickflip'
  1135. jump()
  1136. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1137. own["wallride_off"] = 1
  1138. own['requestAction'] = 'fak_nollie_kickflip'
  1139. jump()
  1140. if r_ground.triggered == 0 and STANCE == False:
  1141. own["wallride_off"] = 1
  1142. if own["wallride"] != None:
  1143. print("wall out trick")
  1144. #jump()
  1145. elif r_ground.triggered == 0 and STANCE == True:
  1146. own["wallride_off"] = 1
  1147. if own["wallride"] != None:
  1148. print("wall out trick")
  1149. #jump()
  1150. def heelflip():
  1151. print("heelflip")
  1152. dict['trick_string'] = 'Heelflip'
  1153. STANCE = own["stance"]
  1154. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1155. own["wallride_off"] = 1
  1156. own['requestAction'] = 'reg_heelflip'
  1157. jump()
  1158. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1159. own["wallride_off"] = 1
  1160. own['requestAction'] = 'fak_heelflip'
  1161. jump()
  1162. if r_ground.triggered == 0 and STANCE == False:
  1163. own["wallride_off"] = 1
  1164. if own["wallride"] != None:
  1165. print("wall out trick")
  1166. #jump()
  1167. elif r_ground.triggered == 0 and STANCE == True:
  1168. own["wallride_off"] = 1
  1169. if own["wallride"] != None:
  1170. print("wall out trick")
  1171. #jump()
  1172. def nollie_heelflip():
  1173. print("heelflip")
  1174. dict['trick_string'] = 'Nollie Heelflip'
  1175. STANCE = own["stance"]
  1176. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1177. own["wallride_off"] = 1
  1178. own['requestAction'] = 'reg_nollie_heelflip'
  1179. jump()
  1180. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1181. own["wallride_off"] = 1
  1182. own['requestAction'] = 'fak_nollie_heelflip'
  1183. jump()
  1184. if r_ground.triggered == 0 and STANCE == False:
  1185. own["wallride_off"] = 1
  1186. if own["wallride"] != None:
  1187. jump()
  1188. elif r_ground.triggered == 0 and STANCE == True:
  1189. own["wallride_off"] = 1
  1190. if own["wallride"] != None:
  1191. jump()
  1192. def shovit():
  1193. print("shovit")
  1194. dict['trick_string'] = 'Shovit'
  1195. STANCE = own["stance"]
  1196. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1197. own["wallride_off"] = 1
  1198. own['requestAction'] = 'reg_shovit'
  1199. jump()
  1200. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1201. own["wallride_off"] = 1
  1202. own['requestAction'] = 'fak_shovit'
  1203. jump()
  1204. if r_ground.triggered == 0 and STANCE == False:
  1205. if own["wallride"] != None:
  1206. jump()
  1207. elif r_ground.triggered == 0 and STANCE == True:
  1208. own["wallride_off"] = 1
  1209. if own["wallride"] != None:
  1210. jump()
  1211. def shovit360():
  1212. print("360shovit")
  1213. dict['trick_string'] = '360 Shovit'
  1214. STANCE = own["stance"]
  1215. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1216. own["wallride_off"] = 1
  1217. own['requestAction'] = 'reg_shovit360'
  1218. jump()
  1219. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1220. own["wallride_off"] = 1
  1221. own['requestAction'] = 'fak_shovit360'
  1222. jump()
  1223. if r_ground.triggered == 0 and STANCE == False:
  1224. own["wallride_off"] = 1
  1225. if own["wallride"] != None:
  1226. jump()
  1227. elif r_ground.triggered == 0 and STANCE == True:
  1228. own["wallride_off"] = 1
  1229. if own["wallride"] != None:
  1230. jump()
  1231. def fsshovit360():
  1232. print("360shovit")
  1233. dict['trick_string'] = '360 Shovit'
  1234. STANCE = own["stance"]
  1235. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1236. own["wallride_off"] = 1
  1237. own['requestAction'] = 'reg_fsshovit360'
  1238. jump()
  1239. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1240. own["wallride_off"] = 1
  1241. own['requestAction'] = 'fak_fsshovit360'
  1242. jump()
  1243. if r_ground.triggered == 0 and STANCE == False:
  1244. own["wallride_off"] = 1
  1245. if own["wallride"] != None:
  1246. jump()
  1247. elif r_ground.triggered == 0 and STANCE == True:
  1248. own["wallride_off"] = 1
  1249. if own["wallride"] != None:
  1250. jump()
  1251. def nollie_shovit():
  1252. print("shovit")
  1253. dict['trick_string'] = 'Nollie Shovit'
  1254. STANCE = own["stance"]
  1255. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1256. own["wallride_off"] = 1
  1257. own['requestAction'] = 'reg_nollie_shovit'
  1258. jump()
  1259. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1260. own["wallride_off"] = 1
  1261. own['requestAction'] = 'fak_nollie_shovit'
  1262. jump()
  1263. if r_ground.triggered == 0 and STANCE == False:
  1264. own["wallride_off"] = 1
  1265. if own["wallride"] != None:
  1266. jump()
  1267. elif r_ground.triggered == 0 and STANCE == True:
  1268. own["wallride_off"] = 1
  1269. if own["wallride"] != None:
  1270. jump()
  1271. def fsshovit():
  1272. dict['trick_string'] = 'Frontside Shovit'
  1273. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1274. own["wallride_off"] = 1
  1275. own['requestAction'] = 'reg_fsshovit'
  1276. jump()
  1277. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1278. own["wallride_off"] = 1
  1279. own['requestAction'] = 'fak_fsshovit'
  1280. jump()
  1281. if r_ground.triggered == 0 and STANCE == False:
  1282. own["wallride_off"] = 1
  1283. if own["wallride"] != None:
  1284. jump()
  1285. elif r_ground.triggered == 0 and STANCE == True:
  1286. own["wallride_off"] = 1
  1287. if own["wallride"] != None:
  1288. jump()
  1289. def nollie_fsshovit():
  1290. dict['trick_string'] = 'Nollie Frontside Shovit'
  1291. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1292. own["wallride_off"] = 1
  1293. own['requestAction'] = 'reg_nollie_fsshovit'
  1294. jump()
  1295. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1296. own["wallride_off"] = 1
  1297. own['requestAction'] = 'fak_nollie_fsshovit'
  1298. jump()
  1299. if r_ground.triggered == 0 and STANCE == False:
  1300. own["wallride_off"] = 1
  1301. if own["wallride"] != None:
  1302. jump()
  1303. elif r_ground.triggered == 0 and STANCE == True:
  1304. own["wallride_off"] = 1
  1305. if own["wallride"] != None:
  1306. jump()
  1307. #nollie_shovit360()
  1308. def nollie_shovit360():
  1309. dict['trick_string'] = 'Nollie Frontside Shovit 360'
  1310. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1311. own["wallride_off"] = 1
  1312. own['requestAction'] = 'reg_nollie_shovit360'
  1313. jump()
  1314. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1315. own["wallride_off"] = 1
  1316. own['requestAction'] = 'fak_nollie_shovit360'
  1317. jump()
  1318. if r_ground.triggered == 0 and STANCE == False:
  1319. own["wallride_off"] = 1
  1320. if own["wallride"] != None:
  1321. jump()
  1322. elif r_ground.triggered == 0 and STANCE == True:
  1323. own["wallride_off"] = 1
  1324. if own["wallride"] != None:
  1325. jump()
  1326. #nollie_fsshovit360()
  1327. def nollie_fsshovit360():
  1328. dict['trick_string'] = 'Nollie Frontside Shovit'
  1329. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1330. own["wallride_off"] = 1
  1331. own['requestAction'] = 'reg_nollie_fsshovit'
  1332. jump()
  1333. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1334. own["wallride_off"] = 1
  1335. own['requestAction'] = 'fak_nollie_fsshovit'
  1336. jump()
  1337. if r_ground.triggered == 0 and STANCE == False:
  1338. own["wallride_off"] = 1
  1339. if own["wallride"] != None:
  1340. jump()
  1341. elif r_ground.triggered == 0 and STANCE == True:
  1342. own["wallride_off"] = 1
  1343. if own["wallride"] != None:
  1344. jump()
  1345. def frontside_grab_on():
  1346. GRAB_PLAYED = own["GRAB_PLAYED"]
  1347. GRAB_ON = own["GRAB_ON"]
  1348. dict['trick_string'] = 'Mute Grab'
  1349. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1350. own['requestAction'] = 'frontside_grab'
  1351. #skater.playAction("reg_fg", 10,30, layer=400, priority=5, play_mode=1, speed=.5)
  1352. grablay2 = grablay + 1
  1353. GRAB_PLAYED = True
  1354. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1355. elif r_ground.triggered == 1:
  1356. killact(400)
  1357. killact(401)
  1358. def backside_grab_on():
  1359. GRAB_PLAYED = own["GRAB_PLAYED"]
  1360. GRAB_ON = own["GRAB_ON"]
  1361. if GRAB_ON == True and r_ground.triggered == 0 and aBut == True:
  1362. skater.playAction("reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1363. deck.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1364. trucks.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1365. elif GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1366. own['requestAction'] = 'backside_grab'
  1367. GRAB_PLAYED = True
  1368. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1369. elif r_ground.triggered == 1:
  1370. killact(402)
  1371. def fakfrontside_grab_on():
  1372. GRAB_PLAYED = own["GRAB_PLAYED"]
  1373. GRAB_ON = own["GRAB_ON"]
  1374. if GRAB_ON == True and r_ground.triggered == 0 and aBut == True:
  1375. skater.playAction("fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1376. deck.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1377. trucks.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1378. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1379. own['requestAction'] = 'fak_frontside_grab'
  1380. GRAB_PLAYED = True
  1381. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1382. elif r_ground.triggered == 1:
  1383. killact(403)
  1384. def fakbackside_grab_on():
  1385. GRAB_PLAYED = own["GRAB_PLAYED"]
  1386. GRAB_ON = own["GRAB_ON"]
  1387. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1388. own['requestAction'] = 'fak_backside_grab'
  1389. GRAB_PLAYED = True
  1390. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1391. elif r_ground.triggered == 1:
  1392. killact(404)
  1393. #nose/tail grabs
  1394. def frontside_nose_grab_on():
  1395. GRAB_PLAYED = own["GRAB_PLAYED"]
  1396. GRAB_ON = own["GRAB_ON"]
  1397. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1398. own['requestAction'] = 'frontside_nose_grab'
  1399. GRAB_PLAYED = True
  1400. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1401. elif r_ground.triggered == 1:
  1402. killact(400)
  1403. print("frontside nosegrab on")
  1404. def frontside_tail_grab_on():
  1405. GRAB_PLAYED = own["GRAB_PLAYED"]
  1406. GRAB_ON = own["GRAB_ON"]
  1407. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1408. own['requestAction'] = 'frontside_tail_grab'
  1409. GRAB_PLAYED = True
  1410. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1411. elif r_ground.triggered == 1:
  1412. killact(400)
  1413. print("frontside tailgrab on")
  1414. def backside_nose_grab_on():
  1415. GRAB_PLAYED = own["GRAB_PLAYED"]
  1416. GRAB_ON = own["GRAB_ON"]
  1417. #airwalk
  1418. if GRAB_ON == True and r_ground.triggered == 0 and (aBut == True):
  1419. print("airwalk")
  1420. skater.playAction("reg_airwalk", 10,30, layer=405, priority=5, blendin=5, play_mode=1, speed=.5)
  1421. deck.playAction("a_reg_airwalk", 10,30, layer=405, priority=5, blendin=5, play_mode=1, speed=.5)
  1422. trucks.playAction("a_reg_airwalk", 10,30, layer=405, priority=5, blendin=5, play_mode=1, speed=.5)
  1423. #norm
  1424. elif GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1425. own['requestAction'] = 'backside_nose_grab'
  1426. GRAB_PLAYED = True
  1427. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1428. elif r_ground.triggered == 1:
  1429. killact(405)
  1430. print("backside nosegrab on")
  1431. def backside_tail_grab_on():
  1432. GRAB_PLAYED = own["GRAB_PLAYED"]
  1433. GRAB_ON = own["GRAB_ON"]
  1434. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1435. own['requestAction'] = 'backside_tail_grab'
  1436. GRAB_PLAYED = True
  1437. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1438. elif r_ground.triggered == 1:
  1439. killact(411)
  1440. print("backside tailgrab on")
  1441. #switch
  1442. def fak_frontside_nose_grab_on():
  1443. GRAB_PLAYED = own["GRAB_PLAYED"]
  1444. GRAB_ON = own["GRAB_ON"]
  1445. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1446. own['requestAction'] = 'fak_frontside_nose_grab'
  1447. GRAB_PLAYED = True
  1448. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1449. elif r_ground.triggered == 1:
  1450. killact(406)
  1451. print("fak frontside nosegrab on")
  1452. def fak_frontside_tail_grab_on():
  1453. GRAB_PLAYED = own["GRAB_PLAYED"]
  1454. GRAB_ON = own["GRAB_ON"]
  1455. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1456. own['requestAction'] = 'fak_frontside_tail_grab'
  1457. GRAB_PLAYED = True
  1458. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1459. elif r_ground.triggered == 1:
  1460. killact(412)
  1461. print("fak frontside tailgrab on")
  1462. def fak_backside_nose_grab_on():
  1463. GRAB_PLAYED = own["GRAB_PLAYED"]
  1464. GRAB_ON = own["GRAB_ON"]
  1465. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1466. own['requestAction'] = 'fak_backside_nose_grab'
  1467. GRAB_PLAYED = True
  1468. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1469. elif r_ground.triggered == 1:
  1470. killact(408)
  1471. print("fak backside nosegrab on")
  1472. def fak_backside_tail_grab_on():
  1473. GRAB_PLAYED = own["GRAB_PLAYED"]
  1474. GRAB_ON = own["GRAB_ON"]
  1475. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1476. #cont.activate(fak_backsidegrab)
  1477. own['requestAction'] = 'fak_backside_tail_grab'
  1478. GRAB_PLAYED = True
  1479. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1480. elif r_ground.triggered == 1:
  1481. killact(410)
  1482. print("fak backside tailgrab on")
  1483. #--------------------
  1484. def SWAG():
  1485. if r_ground.triggered == 1:
  1486. SWAG = own["swag"]
  1487. SWAG = own.getLinearVelocity(True)
  1488. SWAG = SWAG[1]
  1489. own["swag"] = SWAG
  1490. #print(SWAG)
  1491. if STANCE == True:
  1492. if SWAG > 1 and SWAG < 2:
  1493. rotation = [ 0.0, 0, (SWAG / 200)]
  1494. own.applyRotation( rotation, True)
  1495. elif SWAG > 2:
  1496. rotation = [ 0.0, 0, (SWAG / 50)]
  1497. own.applyRotation( rotation, True)
  1498. elif SWAG < -1 and SWAG > -2:
  1499. rotation = [ 0.0, 0, (SWAG / 200)]
  1500. own.applyRotation( rotation, True)
  1501. elif SWAG < -2:
  1502. rotation = [ 0.0, 0, (SWAG / 50)]
  1503. own.applyRotation( rotation, True)
  1504. if STANCE == False:
  1505. if SWAG > 1 and SWAG < 2:
  1506. rotation = [ 0.0, 0, (-SWAG / 200)]
  1507. own.applyRotation( rotation, True)
  1508. elif SWAG > 2:
  1509. rotation = [ 0.0, 0, (-SWAG / 50)]
  1510. own.applyRotation( rotation, True)
  1511. elif SWAG < -1 and SWAG > -2:
  1512. rotation = [ 0.0, 0, (-SWAG / 200)]
  1513. own.applyRotation( rotation, True)
  1514. elif SWAG < -2:
  1515. rotation = [ 0.0, 0, (-SWAG / 50)]
  1516. own.applyRotation( rotation, True)
  1517. def air():
  1518. if r_ground.triggered == False and own['airup'] == 0:
  1519. distance = own.getDistanceTo(gray.hitPosition)
  1520. since_grind_buf = 3
  1521. if gray.hitObject != None and grindDar2.triggered == False and (frame - lgf) > since_grind_buf:
  1522. if distance < .5:
  1523. own.alignAxisToVect(gray.hitNormal, 2, .1)
  1524. elif distance >= .5 and distance < 1.75:
  1525. own.alignAxisToVect(gray.hitNormal, 2, .05)
  1526. elif distance >= 1.75:
  1527. own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
  1528. if grindDar2.triggered and (frame - lgf) > since_grind_buf:
  1529. if distance < .5:
  1530. own.alignAxisToVect(gray.hitNormal, 2, .1)
  1531. elif distance >= .5 and distance < 1.75:
  1532. own.alignAxisToVect(gray.hitNormal, 2, .03)
  1533. elif distance >= 1.75:
  1534. own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
  1535. elif r_ground.triggered == True:
  1536. pass
  1537. def stopAnims():
  1538. pass
  1539. def isplaying():
  1540. # for x in range(9000):
  1541. # l1 = deck.isPlayingAction(x)
  1542. # if l1 == True:
  1543. # print(x)
  1544. pass
  1545. def nextframe():
  1546. framenumber = own["framenum"]
  1547. framenumber = framenumber + 1
  1548. if framenumber == 900000:
  1549. framenumber = 0
  1550. own["framenum"] = framenumber
  1551. #print(framenumber)
  1552. def push():
  1553. local = True
  1554. #print("push")
  1555. linVelocity15 = own.linearVelocity
  1556. if linVelocity15.x < MAX_VEL and linVelocity15.x >= -0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0 and own['last_footplant'] == False:
  1557. countdown = COUNTDOWN
  1558. yvel = linVelocity15.x + SPEEDUP
  1559. own['countdown'] = countdown
  1560. force = [(yvel), 0, linVelocity15.z]
  1561. own.setLinearVelocity(force, local)
  1562. own['requestAction'] = 'fak_push_goof'
  1563. #switch
  1564. if linVelocity15.x > -MAX_VEL and linVelocity15.x < 0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0:
  1565. countdown = COUNTDOWN
  1566. yvel = linVelocity15.x - SPEEDUP
  1567. own['countdown'] = countdown
  1568. force = [(yvel), 0, linVelocity15.z]
  1569. own.setLinearVelocity(force, local)
  1570. own['requestAction'] = 'reg_push'
  1571. def push_goof():
  1572. linVelocity15 = own.linearVelocity
  1573. local = True
  1574. #print("push goof")
  1575. if linVelocity15.x < MAX_VEL and linVelocity15.x >= -0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0:
  1576. countdown = COUNTDOWN
  1577. yvel = linVelocity15.x + SPEEDUP
  1578. own['countdown'] = countdown
  1579. force = [(yvel), 0, linVelocity15.z]
  1580. own.setLinearVelocity(force, local)
  1581. own['requestAction'] = 'fak_push'
  1582. #switch
  1583. if linVelocity15.x > -MAX_VEL and linVelocity15.x < 0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0:
  1584. countdown = COUNTDOWN
  1585. yvel = linVelocity15.x - SPEEDUP
  1586. own['countdown'] = countdown
  1587. force = [(yvel), 0, linVelocity15.z]
  1588. own.setLinearVelocity(force, local)
  1589. own['requestAction'] = 'reg_push_goof'
  1590. def brfoot():
  1591. lay = grablay + 40
  1592. if STANCE == 0:
  1593. own['reuqestAction'] = 'reg_brfoot'
  1594. # skater.playAction("brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1595. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1596. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1597. if STANCE == 1:
  1598. own['reuqestAction'] = 'fak_brfoot'
  1599. # skater.playAction("fak_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1600. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1601. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1602. jump()
  1603. def frfoot():
  1604. lay = grablay + 40
  1605. killact(5)
  1606. if STANCE == 0:
  1607. own['reuqestAction'] = 'reg_frfoot'
  1608. # skater.playAction("frfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1609. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1610. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1611. if STANCE == 1:
  1612. own['reuqestAction'] = 'fak_frfoot'
  1613. # skater.playAction("fakbfrfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1614. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1615. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1616. jump()
  1617. def blfoot():
  1618. lay = grablay + 40
  1619. killact(5)
  1620. if STANCE == 0:
  1621. own['reuqestAction'] = 'reg_blfoot'
  1622. # skater.playAction("blfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1623. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1624. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1625. if STANCE == 1:
  1626. own['reuqestAction'] = 'fak_blfoot'
  1627. # skater.playAction("fakfrfoot.001", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1628. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1629. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1630. jump()
  1631. def flfoot():
  1632. lay = grablay + 40
  1633. killact(5)
  1634. if STANCE == 0:
  1635. own['reuqestAction'] = 'reg_flfoot'
  1636. # skater.playAction("flfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1637. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1638. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1639. if STANCE == 1:
  1640. # own['reuqestAction'] = 'fak_flfoot'
  1641. # skater.playAction("fak_flfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1642. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1643. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1644. jump()
  1645. def rollsound():
  1646. #onground
  1647. if r_ground.triggered == 1 and grindDar == 0 and own['invert_on'] == 0:
  1648. num1 = .05
  1649. num2 = .25
  1650. if linVelocity.x <= -num1 and linVelocity.x >= num1:
  1651. own.actuators["sroll"].volume = .0001
  1652. cont.deactivate(own.actuators["sroll"])
  1653. own.actuators["sroll"].stopSound()
  1654. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1655. own.actuators["sroll"].volume = .02
  1656. own.actuators["sroll"].pitch = .65
  1657. num1 = .25
  1658. num2 = .5
  1659. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1660. own.actuators["sroll"].volume = .03
  1661. own.actuators["sroll"].pitch = .7
  1662. num1 = .5
  1663. num2 = .75
  1664. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1665. own.actuators["sroll"].volume = .04
  1666. own.actuators["sroll"].pitch = .75
  1667. num1 = .75
  1668. num2 = 1
  1669. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1670. own.actuators["sroll"].volume = .05
  1671. own.actuators["sroll"].pitch = .8
  1672. num1 = 1
  1673. num2 = 1.5
  1674. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1675. own.actuators["sroll"].volume = .06
  1676. own.actuators["sroll"].pitch = .85
  1677. num1 = 1.5
  1678. num2 = 2
  1679. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1680. own.actuators["sroll"].volume = .07
  1681. own.actuators["sroll"].pitch = .9
  1682. num1 = 2
  1683. num2 = 3
  1684. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1685. own.actuators["sroll"].volume = .08
  1686. own.actuators["sroll"].pitch = .95
  1687. num1 = 3
  1688. num2 = 4
  1689. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1690. own.actuators["sroll"].volume = .09
  1691. own.actuators["sroll"].pitch = 1
  1692. num1 = 4
  1693. num2 = 5
  1694. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1695. own.actuators["sroll"].volume = .11
  1696. own.actuators["sroll"].pitch = 1.05
  1697. num1 = 5
  1698. num2 = 6
  1699. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1700. own.actuators["sroll"].volume = .1
  1701. own.actuators["sroll"].pitch = 1.1
  1702. own.actuators['sroll'].mode = 2
  1703. cont.activate(own.actuators["sroll"])
  1704. if grindDar == 1 or own['invert_on'] == 1:
  1705. own.actuators["sroll"].volume = .0001
  1706. cont.deactivate(own.actuators["sroll"])
  1707. own.actuators["sroll"].stopSound()
  1708. #in air
  1709. if r_ground.triggered == False:
  1710. own.actuators["sroll"].volume = .0001
  1711. cont.deactivate(own.actuators["sroll"])
  1712. own.actuators["sroll"].stopSound()
  1713. act = cont.actuators["sroll"]
  1714. own['sroll_vol'] = act.volume
  1715. own['sroll_pitch'] = act.pitch
  1716. def wheelroll():
  1717. #still
  1718. if linVelocity.x <= -0.05 and linVelocity.x >= 0.05:
  1719. wheel1.stopAction(2)
  1720. wheel2.stopAction(2)
  1721. wheel3.stopAction(2)
  1722. wheel4.stopAction(2)
  1723. #regular
  1724. if linVelocity.x > 0.05 and linVelocity.x < .5:
  1725. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=0, speed=.25)
  1726. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=0, speed=.25)
  1727. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=0, speed=.25)
  1728. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=0, speed=.25)
  1729. if linVelocity.x > 0.5 and linVelocity.x < 1:
  1730. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=1)
  1731. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=1)
  1732. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=1)
  1733. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=1)
  1734. if linVelocity.x > 1 and linVelocity.x < 4:
  1735. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1736. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1737. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1738. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1739. if linVelocity.x > 4:
  1740. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=2)
  1741. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=2)
  1742. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=2)
  1743. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=2)
  1744. #switch
  1745. if linVelocity.x < -0.05 and linVelocity.x > -.5:
  1746. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=0, speed=.25)
  1747. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=0, speed=.25)
  1748. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=0, speed=.25)
  1749. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=0, speed=.25)
  1750. if linVelocity.x < -0.5 and linVelocity.x > -1:
  1751. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=1)
  1752. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=1)
  1753. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=1)
  1754. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=1)
  1755. if linVelocity.x < -1 and linVelocity > -4:
  1756. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1757. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1758. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1759. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1760. if linVelocity.x < -4:
  1761. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=2)
  1762. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=2)
  1763. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=2)
  1764. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=2)
  1765. def transspeed():
  1766. num1 = .1
  1767. num2 = .4
  1768. speed = 20
  1769. def turn():
  1770. rotamt = .02
  1771. linVelocity2 = own.getLinearVelocity(True)
  1772. speed = .002
  1773. manual = 0
  1774. if own['manual_v2'] == 1:
  1775. manual = 1
  1776. if abs(linVelocity.x) < 2:
  1777. speed = .005
  1778. jumpstance = own['jump_stance']
  1779. if lLR > turnsens or lLR < -turnsens:
  1780. own["turn"] = 1
  1781. else:
  1782. own["turn"] = 0
  1783. if lUD > turnsens or lUD < -turnsens:
  1784. own["turnud"] = 1
  1785. else:
  1786. own["turnud"] = 0
  1787. #light
  1788. #if manual and grindhit = true
  1789. if lLR > turnsens and lLR < (turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1790. rotation = [ 0.0, 0.0, (-rotamt)]
  1791. local = False # use world axis
  1792. own.applyRotation( rotation, local)
  1793. if r_ground.triggered == True:
  1794. #print("light turn")
  1795. if STANCE == 0:
  1796. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1797. if STANCE == 1:
  1798. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1799. if lLR < -turnsens and lLR > (turnsens * -1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1800. rotation = [ 0.0, 0.0, rotamt]
  1801. local = False # use world axis
  1802. own.applyRotation( rotation, local)
  1803. if r_ground.triggered == True:
  1804. #print("light turn")
  1805. if STANCE == 0:
  1806. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1807. if STANCE == 1:
  1808. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1809. #medium
  1810. if lLR > (turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1811. #turn left
  1812. if rot.z < .4:
  1813. rotation = [ 0.0, 0.0, (-rotamt * 5)]
  1814. if rot.z < .6 and rot.z > .4:
  1815. rotation = [ 0.0, 0.0, (-rotamt * 2)]
  1816. else:
  1817. rotation = [ 0.0, 0.0, (-rotamt * 1.6)]
  1818. local = True # use world axis
  1819. own.applyRotation( rotation, local)
  1820. if r_ground.triggered == True:
  1821. #print("med turn")
  1822. if STANCE == 0:
  1823. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1824. if STANCE == 1:
  1825. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1826. if lLR < (-turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1827. #turn right
  1828. if rot.z < .4:
  1829. rotation = [ 0.0, 0.0, (rotamt * 5)]
  1830. if rot.z < .6 and rot.z > .4:
  1831. rotation = [ 0.0, 0.0, (rotamt * 2)]
  1832. else:
  1833. rotation = [ 0.0, 0.0, (rotamt * 1.6)]
  1834. local = True # use world axis
  1835. own.applyRotation( rotation, local)
  1836. if r_ground.triggered == True:
  1837. #print("med turn")
  1838. if STANCE == 0:
  1839. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1840. if STANCE == 1:
  1841. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1842. #air
  1843. if r_ground.triggered == False and lLR > turnsens and (grindHit == False or (manual == 1 and grindHit == True)) and own["wallride"] == None:
  1844. rotamt = .07
  1845. if STANCE == 0:
  1846. own.applyRotation([0,0,-rotamt], 1)
  1847. if STANCE == 1:
  1848. own.applyRotation([0,0,-rotamt], 1)
  1849. if r_ground.triggered == False and lLR < -turnsens and (grindHit == False or (manual == 1 and grindHit == True)) and own["wallride"] == None:
  1850. rotamt = .07
  1851. if STANCE == 0:
  1852. own.applyRotation([0,0,rotamt], 1)
  1853. if STANCE == 1:
  1854. own.applyRotation([0,0,rotamt], 1)
  1855. ###########
  1856. def grindsound():
  1857. dropin = own['dropinTimer']
  1858. lif = own['last_invert_frame']
  1859. if grindSound != None and grindHit == True and own['nogrindsound'] == 0:
  1860. if abs(linVelocity.x) > abs(linVelocity.y):
  1861. vel = linVelocity.x
  1862. elif abs(linVelocity.x) < abs(linVelocity.y):
  1863. vel = linVelocity.y
  1864. else:
  1865. vel = 0
  1866. if grindSound == "rail":
  1867. cont.deactivate(own.actuators['grind_cement'])
  1868. num1 = .000
  1869. num2 = .05
  1870. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1871. own.actuators["grind_rail"].volume = .0001
  1872. own.actuators["grind_rail"].pitch = .6
  1873. num1 = .05
  1874. num2 = .25
  1875. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1876. own.actuators["grind_rail"].volume = .05
  1877. own.actuators["grind_rail"].pitch = .7
  1878. num1 = .25
  1879. num2 = .5
  1880. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1881. own.actuators["grind_rail"].volume = .1
  1882. own.actuators["grind_rail"].pitch = .75
  1883. num1 = .5
  1884. num2 = .75
  1885. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1886. own.actuators["grind_rail"].volume = .14
  1887. own.actuators["grind_rail"].pitch = .8
  1888. num1 = .75
  1889. num2 = 1
  1890. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1891. own.actuators["grind_rail"].volume = .17
  1892. own.actuators["grind_rail"].pitch = .85
  1893. num1 = 1
  1894. num2 = 1.25
  1895. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1896. own.actuators["grind_rail"].volume = .18
  1897. own.actuators["grind_rail"].pitch = .9
  1898. num1 = 1.25
  1899. num2 = 2
  1900. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1901. own.actuators["grind_rail"].volume = .19
  1902. own.actuators["grind_rail"].pitch = .95
  1903. num1 = 2
  1904. num2 = 40
  1905. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1906. own.actuators["grind_rail"].volume = .19
  1907. own.actuators["grind_rail"].pitch = 1
  1908. cont.activate(own.actuators['grind_rail'])
  1909. if grindSound == "concrete":
  1910. #play sound
  1911. cont.deactivate(own.actuators['grind_rail'])
  1912. num1 = .000
  1913. num2 = .05
  1914. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1915. own.actuators["grind_cement"].volume = .01
  1916. own.actuators["grind_cement"].pitch = .6
  1917. num1 = .05
  1918. num2 = .25
  1919. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1920. own.actuators["grind_cement"].volume = .05
  1921. own.actuators["grind_cement"].pitch = .7
  1922. num1 = .25
  1923. num2 = .5
  1924. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1925. own.actuators["grind_cement"].volume = .1
  1926. own.actuators["grind_cement"].pitch = .75
  1927. num1 = .5
  1928. num2 = .75
  1929. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1930. own.actuators["grind_cement"].volume = .14
  1931. own.actuators["grind_cement"].pitch = .8
  1932. num1 = .75
  1933. num2 = 1
  1934. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1935. own.actuators["grind_cement"].volume = .17
  1936. own.actuators["grind_cement"].pitch = .85
  1937. num1 = 1
  1938. num2 = 1.25
  1939. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1940. own.actuators["grind_cement"].volume = .18
  1941. own.actuators["grind_cement"].pitch = .9
  1942. num1 = 1.25
  1943. num2 = 2
  1944. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1945. own.actuators["grind_cement"].volume = .19
  1946. own.actuators["grind_cement"].pitch = .95
  1947. num1 = 2
  1948. num2 = 40
  1949. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1950. own.actuators["grind_cement"].volume = .19
  1951. own.actuators["grind_cement"].pitch = 1
  1952. cont.activate(own.actuators['grind_cement'])
  1953. else:
  1954. cont.deactivate(own.actuators['grind_cement'])
  1955. cont.deactivate(own.actuators['grind_rail'])
  1956. def record_grindsound():
  1957. dropin = own['dropinTimer']
  1958. lif = own['last_invert_frame']
  1959. if grindHit == True and dropin == 0 and own['invert_on'] == 0 and own["LAST_GRIND"] == True and own["nogrindsound"] == 0 and (frame - lif > 13):
  1960. if grindSound == "concrete":
  1961. act = own.actuators["grind_cement"]
  1962. own['grindcement_vol'] = act.volume
  1963. own['grindcement_pitch'] = act.pitch
  1964. elif grindSound == "rail":
  1965. act = own.actuators["grind_rail"]
  1966. own['grindrail_vol'] = act.volume
  1967. own['grindrail_pitch'] = act.pitch
  1968. if own["LAST_GRIND"] == False:
  1969. own['grindcement_vol'] = 0
  1970. own['grindcement_pitch'] = 0
  1971. own['grindrail_vol'] = 0
  1972. own['grindrail_pitch'] = 0
  1973. def grind():
  1974. grindsound()
  1975. STANCE = own["stance"]
  1976. jumpstance = own["jump_stance"]
  1977. lif = frame - own['last_invert_frame']
  1978. if own['LAST_GRIND'] == False and grindHit == True:
  1979. own['grindstartFrame'] = own['framenum']
  1980. #print(own['grindstartFrame'])
  1981. if grindHit == True and own['invert_on'] == 0 and own['footplant_on'] == False and own['manual'] == 0 and lif > 40 and own['dropinTimer'] < 30:
  1982. gblend = 1
  1983. if LAST_GRIND == 0:
  1984. gt = own['grindType']
  1985. tempstance = 3
  1986. if jumpstance != 3:
  1987. tempstance = jumpstance
  1988. else:
  1989. tempstance = STANCE
  1990. grindpos = own['grindpos']
  1991. if grindpos == "reg_5050" and own['grindType'] == "empty":
  1992. own['grindType'] = grindpos
  1993. if own['grindType'] == "empty" and grindpos == 'reg_board':
  1994. if jumpstance == 1:
  1995. own['grindType'] = "fak_bsboard"
  1996. own["stance"] = True
  1997. STANCE = True
  1998. elif jumpstance == 0:
  1999. own['grindType'] = "reg_bsboard"
  2000. own["stance"] = False
  2001. STANCE = False
  2002. elif jumpstance == 3:
  2003. if STANCE == True:
  2004. own['grindType'] = "fak_bsboard"
  2005. else:
  2006. own['grindType'] = "reg_bsboard"
  2007. if STANCE == True:
  2008. if own['grindType'] == "reg_bsboard":
  2009. own['grind_stance'] = 0
  2010. own['requestAction'] = 'reg_bsboard'
  2011. elif own['grindType'] == "fak_bsboard":
  2012. own['grind_stance'] = 1
  2013. own['requestAction'] = 'fak_bsboard'
  2014. elif own['grindType'] == "reg_fsboard":
  2015. own['grind_stance'] = 0
  2016. own['requestAction'] = 'reg_fsboard'
  2017. elif own['grindType'] == "reg_tailg":
  2018. own['requestAction'] = 'reg_tailg'
  2019. elif own['grindType'] == "reg_tailgR":
  2020. own['requestAction'] = 'reg_tailgr'
  2021. elif own['grindType'] == "reg_tailgL":
  2022. own['requestAction'] = 'reg_tailgl'
  2023. elif own['grindType'] == "reg_noseg":
  2024. own['requestAction'] = 'reg_noseg'
  2025. elif own['grindType'] == "reg_nosegR":
  2026. own['requestAction'] = 'reg_nosegr'
  2027. elif own['grindType'] == "reg_nosegL":
  2028. own['requestAction'] = 'reg_nosegl'
  2029. elif own['grindType'] == "fak_noseg":
  2030. own['requestAction'] = 'fak_noseg'
  2031. elif own['grindType'] == "fak_nosegR":
  2032. own['requestAction'] = 'fak_nosegr'
  2033. elif own['grindType'] == "fak_nosegL":
  2034. own['requestAction'] = 'fak_nosegl'
  2035. elif own['grindType'] == "fak_tailg":
  2036. own['requestAction'] = 'fak_tailg'
  2037. elif own['grindType'] == "fak_tailgR":
  2038. own['requestAction'] = 'fak_tailgr'
  2039. elif own['grindType'] == "fak_tailgL":
  2040. own['requestAction'] = 'fak_tailgl'
  2041. elif own['grindType'] == "reg_tailslide":
  2042. own['requestAction'] = 'reg_tailslide'
  2043. own['grind_stance'] = 0
  2044. elif own['grindType'] == "fak_tailslide":
  2045. own['requestAction'] = 'fak_tailslide'
  2046. own['grind_stance'] = 1
  2047. elif own['grindType'] == "reg_noseslide":
  2048. own['requestAction'] = 'reg_noseslide'
  2049. own['grind_stance'] = 0
  2050. elif own['grindType'] == "fak_noseslide":
  2051. own['requestAction'] = 'fak_noseslide'
  2052. own['grind_stance'] = 1
  2053. elif own['grindType'] == "nose_stall":
  2054. own['requestAction'] = 'nose_stall'
  2055. skater.playAction("fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2056. deck.playAction("a_fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2057. trucks.playAction("a_fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2058. elif own['grindType'] == "tail_stall":
  2059. own['requestAction'] = 'tail_stall'
  2060. skater.playAction("fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2061. deck.playAction("a_fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2062. trucks.playAction("a_fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2063. else:
  2064. if STANCE == 0:
  2065. own['requestAction'] = 'reg_5050'
  2066. if STANCE == 1:
  2067. own['requestAction'] = 'fak_5050'
  2068. #elif STANCE == False and LAST_GRIND == False:
  2069. elif STANCE == False:
  2070. if own['grindType'] == "reg_bsboard":
  2071. own['grind_stance'] = 0
  2072. own['requestAction'] = 'reg_bsboard'
  2073. elif own['grindType'] == "fak_bsboard":
  2074. own['grind_stance'] = 1
  2075. own['requestAction'] = 'fak_bsboard'
  2076. elif own['grindType'] == "reg_tailg":
  2077. own['grind_stance'] = 0
  2078. own['requestAction'] = 'reg_tailg'
  2079. elif own['grindType'] == "reg_tailgR":
  2080. own['requestAction'] = 'reg_tailgr'
  2081. elif own['grindType'] == "reg_tailgL":
  2082. own['requestAction'] = 'reg_tailgl'
  2083. elif own['grindType'] == "reg_noseg":
  2084. own['requestAction'] = 'reg_noseg'
  2085. elif own['grindType'] == "reg_nosegR":
  2086. own['requestAction'] = 'reg_nosegr'
  2087. elif own['grindType'] == "reg_nosegL":
  2088. own['requestAction'] = 'reg_nosegl'
  2089. elif own['grindType'] == "fak_noseg":
  2090. own['requestAction'] = 'fak_noseg'
  2091. elif own['grindType'] == "fak_nosegR":
  2092. own['requestAction'] = 'fak_nosegr'
  2093. elif own['grindType'] == "fak_nosegL":
  2094. own['requestAction'] = 'fak_nosegl'
  2095. elif own['grindType'] == "fak_tailg":
  2096. own['requestAction'] = 'fak_tailg'
  2097. elif own['grindType'] == "fak_tailgR":
  2098. own['requestAction'] = 'fak_tailgr'
  2099. elif own['grindType'] == "fak_tailgL":
  2100. own['requestAction'] = 'fak_tailgl'
  2101. elif own['grindType'] == "reg_tailslide":
  2102. own['requestAction'] = 'reg_tailslide'
  2103. elif own['grindType'] == "fak_tailslide":
  2104. own['grind_stance'] = 1
  2105. own['requestAction'] = 'fak_tailslide'
  2106. elif own['grindType'] == "reg_noseslide":
  2107. own['grind_stance'] = 0
  2108. own['requestAction'] = 'reg_noseslide'
  2109. elif own['grindType'] == "fak_noseslide":
  2110. own['grind_stance'] = 1
  2111. own['requestAction'] = 'fak_noseslide'
  2112. elif own['grindType'] == "nose_stall":
  2113. skater.playAction("nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2114. deck.playAction("a_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2115. trucks.playAction("a_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2116. #print("nose_stall")
  2117. elif own['grindType'] == "tail_stall":
  2118. skater.playAction("reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2119. deck.playAction("a_reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2120. trucks.playAction("a_reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2121. #print("reg_tail_stall")
  2122. else:
  2123. if STANCE == 0:
  2124. own['requestAction'] = 'reg_5050'
  2125. if STANCE == 1:
  2126. own['requestAction'] = 'fak_5050'
  2127. def rotmult():
  2128. if r_ground.triggered:
  2129. num = ((rot.z * -1) +1)
  2130. num = num * 100
  2131. def airup():
  2132. if r_ground.triggered == False:
  2133. pos = own.worldPosition
  2134. pos = own.worldPosition.z
  2135. last_pos = own['last_posz']
  2136. if last_pos - pos > 0:
  2137. own['airup'] = 0
  2138. if last_pos - pos < 0:
  2139. own['airup'] = 1
  2140. if pos > own['last_posz']:
  2141. own["air_height"] = pos
  2142. own['last_posz'] = pos
  2143. def onramp():
  2144. if r_ground.positive:
  2145. if 'ramp' in r_ground.hitObject:
  2146. own['onramp'] = 1
  2147. else:
  2148. own['onramp'] = 0
  2149. else:
  2150. own['onramp'] = 0
  2151. def grindtype(gtype):
  2152. own['grindType'] = gtype
  2153. def transmult():
  2154. lastrotz = own["rotz"]
  2155. linvel = own.getLinearVelocity(True)
  2156. newx = (linvel.x + (linvel.x * .039))
  2157. if linvel.x < 7 and linvel.x > -7 and rot.z > lastrotz and r_ground.triggered == 1 and rot.z > .3 and rot.z < .93:
  2158. own.setLinearVelocity([newx, linvel.y, linvel.z], True)
  2159. def speedmult():
  2160. vel = own.getLinearVelocity(True)
  2161. xyz = own.worldOrientation.to_euler()
  2162. roty = math.degrees(xyz[1])
  2163. roty = abs(roty)
  2164. roty = roty * .0005
  2165. if abs(vel.x) > 1:
  2166. mult = .0015 + roty
  2167. else:
  2168. mult = .000
  2169. mult2 = .018
  2170. mult3 = .007
  2171. lastrotz = own["rotz"]
  2172. x = vel.x * mult
  2173. x2 = x + vel.x
  2174. x3 = vel.x * mult2
  2175. x4 = x3 + vel.x
  2176. x5 = vel.x * mult3
  2177. x6 = x5 + vel.x
  2178. if r_ground.triggered and vel.x < 4 and vel.x > -4:
  2179. own.setLinearVelocity([x2, vel.y, vel.z], True)
  2180. def coping():
  2181. if invertTouch.positive:
  2182. own["coping"] = 1
  2183. else:
  2184. own["coping"] = 0
  2185. def onboard():
  2186. if own['walk'] == 1:
  2187. cont.deactivate(cam.actuators['replayCam'])
  2188. cont.activate(cam.actuators['Camera'])
  2189. killall()
  2190. walklay = 40
  2191. fliplay3 = 2060
  2192. ob_speed = .5
  2193. if STANCE == 0:
  2194. skater.stopAction(fliplay)
  2195. deck.stopAction(fliplay)
  2196. trucks.stopAction(fliplay)
  2197. killall()
  2198. if own['dropinCol'] == True:
  2199. print("dropinanim")
  2200. own['requestAction'] = reg_dropin
  2201. else:
  2202. own['requestAction'] = 'reg_onboard'
  2203. force = (linVelocity.x -1, linVelocity.y, linVelocity.z)
  2204. own.setLinearVelocity(force, True)
  2205. own['dropinTimer'] = 60
  2206. if STANCE == 1:
  2207. skater.stopAction(fliplay)
  2208. deck.stopAction(fliplay)
  2209. trucks.stopAction(fliplay)
  2210. killall()
  2211. if own['dropinTimer'] > 30:
  2212. print("dropinanim2")
  2213. own['requestAction'] = fak_dropin
  2214. else:
  2215. own['requestAction'] = 'fak_onboard'
  2216. force = (linVelocity.x +1, linVelocity.y, linVelocity.z)
  2217. own.setLinearVelocity(force, True)
  2218. own['dropinTimer'] = 60
  2219. else:
  2220. num = own['dropinTimer']
  2221. if num > 0:
  2222. num = num - 1
  2223. own['dropinTimer'] = num
  2224. def offboard():
  2225. wheel1.stopAction(2)
  2226. wheel2.stopAction(2)
  2227. wheel3.stopAction(2)
  2228. wheel4.stopAction(2)
  2229. cont.deactivate(own.actuators["sroll"])
  2230. sact = own.actuators["sroll"]
  2231. sact.volume = .0001
  2232. own.actuators["sroll"].stopSound()
  2233. own['offboard_vel'] = own.linearVelocity
  2234. own['walk_timer'] = 0
  2235. def resetjumpstance():
  2236. if LAST_GRIND == True and grindHit == False:
  2237. own["lF_ground_frame"] = own['framenum']
  2238. lfg = own["lF_ground_frame"]
  2239. #print(lfg, "----- this?")
  2240. if own['jump_stance'] != 3:
  2241. own['jump_stance'] = 3
  2242. def grass():
  2243. try:
  2244. if 'grass' in r_ground.hitObject:
  2245. #print("grass")
  2246. linVel = own.getLinearVelocity(True)
  2247. linvelx = linVel.x * .98
  2248. own.setLinearVelocity((linvelx, linVel.y, linVel.z), 1)
  2249. except:
  2250. pass
  2251. def grindoutair():
  2252. skippy = 0
  2253. linVel = own.getLinearVelocity(True)
  2254. if own['LAST_GRIND'] == True and grindHit == True:
  2255. own['lg_stance'] = STANCE
  2256. lg_stance = own['lg_stance']
  2257. own.actuators["grindoutair"].useLocalLinV = True
  2258. if own['grindjumpturn'] == True and own['grindCountdown'] > 12 and skippy == 0:
  2259. grindoutspeed = .1
  2260. grindoutspeed2 = 5.4
  2261. if lLR > turnsens:
  2262. if own['last_grindpos'] == 'reg_5050':
  2263. if STANCE == 0:
  2264. own.actuators["grindoutair"].linV = [0, grindoutspeed, 0]
  2265. else:
  2266. own.actuators["grindoutair"].linV = [0, -grindoutspeed, 0]
  2267. cont.activate(own.actuators["grindoutair"])
  2268. if lLR < -turnsens:
  2269. if own['last_grindpos'] == 'reg_5050':
  2270. if STANCE == 0:
  2271. own.actuators["grindoutair"].linV = [0, -grindoutspeed, 0]
  2272. else:
  2273. own.actuators["grindoutair"].linV = [0, grindoutspeed, 0]
  2274. cont.activate(own.actuators["grindoutair"])
  2275. if lUD > turnsens:
  2276. js = own['lg_stance']
  2277. linvelx = own.getLinearVelocity(True)
  2278. if own['last_grindpos'] == 'reg_board':
  2279. if js == 1:
  2280. own.actuators["grindoutair"].linV = [-grindoutspeed, 0, 0]
  2281. cont.activate(own.actuators["grindoutair"])
  2282. else:
  2283. own.actuators["grindoutair"].linV = [grindoutspeed, 0, 0]
  2284. cont.activate(own.actuators["grindoutair"])
  2285. if lUD < -turnsens:
  2286. js = own['lg_stance']
  2287. if own['last_grindpos'] == 'reg_board':
  2288. if js == 0:
  2289. own.actuators["grindoutair"].linV = [-grindoutspeed, 0, 0]
  2290. cont.activate(own.actuators["grindoutair"])
  2291. else:
  2292. own.actuators["grindoutair"].linV = [grindoutspeed, 0, 0]
  2293. cont.activate(own.actuators["grindoutair"])
  2294. if LAST_GRIND == False and r_ground.triggered and own['grindjumpturn'] == True and own['grindCountdown'] < 1:
  2295. own['grindjumpturn'] = False
  2296. if r_ground.triggered:
  2297. own['grind_jump'] = False
  2298. if own['grindjumpturn'] == False or own['grindCountdown'] < 19:
  2299. cont.deactivate(own.actuators["grindoutair"])
  2300. def set_last_grindpos():
  2301. if own['grindpos'] != None:
  2302. own['last_grindpos'] = own['grindpos']
  2303. def air_pos():
  2304. grindpos = own['grindpos']
  2305. GRAB_ON = own["GRAB_ON"]
  2306. wr = own["wallride"]
  2307. if rUD > .040 and r_ground.triggered == False and GRAB_ON == False and wr == None and jump_timer < 50:
  2308. killact(2)
  2309. killact(4)
  2310. if STANCE == 0:
  2311. own['requestAction'] = 'reg_air_tail'
  2312. else:
  2313. own['requestAction'] = 'fak_air_tail'
  2314. elif rUD < -.040 and r_ground.triggered == False and GRAB_ON == False and wr == None and jump_timer < 50:
  2315. killact(2)
  2316. killact(4)
  2317. if STANCE == 0:
  2318. own['requestAction'] = 'reg_air_nose'
  2319. else:
  2320. own['requestAction'] = 'fak_air_nose'
  2321. def air_turn_boost():
  2322. pass
  2323. def revert():
  2324. own["Q3oncdl"] = 0
  2325. own["Q4oncdl"] = 0
  2326. own["Q5oncdl"] = 0
  2327. own["Q6oncdl"] = 0
  2328. own["Q7oncdl"] = 0
  2329. local = True
  2330. rot = [ 0.0, 0.0, 3.14]
  2331. own.applyRotation(rot,local)
  2332. if own['manual_v2_type'] == 'reg manual':
  2333. own['requestAction'] = 'reg_manual_revert_ccw'
  2334. print("reg")
  2335. elif own['manual_v2_type'] == 'reg nose manual':
  2336. skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2337. deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2338. trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2339. print("reg nose manual revert")
  2340. elif own['manual_v2_type'] == 'fak manual':
  2341. skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2342. deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2343. trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2344. print("fak manual revert")
  2345. elif own['manual_v2_type'] == 'fak nose manual':
  2346. skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2347. deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2348. trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2349. print("fak")
  2350. else:
  2351. own['requestAction'] = 'revert1'
  2352. own['revert_timer'] = 20
  2353. cont.activate(own.actuators["revertSound"])
  2354. def revert2():
  2355. own["Q3oncdl"] = 0
  2356. own["Q4oncdl"] = 0
  2357. own["Q5oncdl"] = 0
  2358. own["Q6oncdl"] = 0
  2359. own["Q7oncdl"] = 0
  2360. local = True
  2361. rot = [ 0.0, 0.0, -3.14]
  2362. own.applyRotation(rot,local)
  2363. if own['manual_v2_type'] == 'reg manual':
  2364. skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2365. deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2366. trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2367. print("reg")
  2368. elif own['manual_v2_type'] == 'reg nose manual':
  2369. skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2370. deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2371. trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2372. print("reg nose manual revert")
  2373. elif own['manual_v2_type'] == 'fak manual':
  2374. skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2375. deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2376. trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2377. print("fak manual revert")
  2378. elif own['manual_v2_type'] == 'fak nose manual':
  2379. skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2380. deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2381. trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2382. print("fak")
  2383. else:
  2384. own['requestAction'] = 'revert2'
  2385. own['revert_timer'] = 20
  2386. cont.activate(own.actuators["revertSound"])
  2387. def revert3():
  2388. own["Q7oncdl"] = 0
  2389. own["Q8oncdl"] = 0
  2390. own["Q1oncdl"] = 0
  2391. own["Q2oncdl"] = 0
  2392. own["Q3oncdl"] = 0
  2393. local = True
  2394. rot = [ 0.0, 0.0, 3.14]
  2395. own.applyRotation(rot,local)
  2396. print("real revert 3")
  2397. if own['manual_v2_type'] == 'reg manual':
  2398. skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2399. deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2400. trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2401. print("reg")
  2402. elif own['manual_v2_type'] == 'reg nose manual':
  2403. skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2404. deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2405. trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2406. print("reg nose manual revert")
  2407. elif own['manual_v2_type'] == 'fak manual':
  2408. skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2409. deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2410. trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2411. print("fak manual revert")
  2412. elif own['manual_v2_type'] == 'fak nose manual':
  2413. skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2414. deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2415. trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2416. print("fak")
  2417. else:
  2418. own['requestAction'] = 'revert3'
  2419. own['revert_timer'] = 20
  2420. cont.activate(own.actuators["revertSound"])
  2421. def revert4():
  2422. own["Q7oncdl"] = 0
  2423. own["Q8oncdl"] = 0
  2424. own["Q1oncdl"] = 0
  2425. own["Q2oncdl"] = 0
  2426. own["Q3oncdl"] = 0
  2427. local = True
  2428. rot = [ 0.0, 0.0, 3.14]
  2429. own.applyRotation(rot,local)
  2430. if own['manual_v2_type'] == 'reg manual':
  2431. skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2432. deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2433. trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2434. print("reg")
  2435. #elif own['reg_nmanual'] == 1:
  2436. elif own['manual_v2_type'] == 'reg nose manual':
  2437. skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2438. deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2439. trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2440. print("reg nose manual revert")
  2441. #elif own['fak_manual'] == 1 or own['fak_nmanual'] == 1:
  2442. elif own['manual_v2_type'] == 'fak manual':
  2443. skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2444. deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2445. trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2446. print("fak manual revert")
  2447. elif own['manual_v2_type'] == 'fak nose manual':
  2448. skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2449. deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2450. trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2451. print("fak")
  2452. else:
  2453. own['requestAction'] = 'revert4'
  2454. print("normal revert")
  2455. own['revert_timer'] = 20
  2456. cont.activate(own.actuators["revertSound"])
  2457. def powerslide():
  2458. own['powerslide_counter'] = own['powerslide_counter'] + 1
  2459. since_walk = own['framenum'] - own['last_walk_frame']
  2460. since_grind = own['framenum'] - own['last_grind_frame']
  2461. if own['powerslide_counter'] > 15 and since_walk > 100 and since_grind > 40:
  2462. own['powerslide_on'] = 1
  2463. if STANCE == 0:
  2464. own['powerslide'] = "reg2"
  2465. if STANCE == 1:
  2466. own['powerslide'] = "fak1"
  2467. linVelocity4 = own.getLinearVelocity(True)
  2468. if own['powerslide_counter'] > 15 and own['powerslide_counter'] < 18:
  2469. newx = linVelocity4.x * .9
  2470. else:
  2471. newx = linVelocity4.x * .98
  2472. force = [newx, linVelocity4.y, linVelocity4.z]
  2473. own.setLinearVelocity(force, True)
  2474. def powerslide2():
  2475. own['powerslide_counter'] = own['powerslide_counter'] + 1
  2476. since_walk = own['framenum'] - own['last_walk_frame']
  2477. since_grind = own['framenum'] - own['last_grind_frame']
  2478. if own['powerslide_counter'] > 15 and since_walk > 100 and since_grind > 100:
  2479. own['powerslide_on'] = 1
  2480. if STANCE == 0:
  2481. own['powerslide'] = "reg1"
  2482. if STANCE == 1:
  2483. own['powerslide'] = "fak2"
  2484. linVelocity4 = own.getLinearVelocity(True)
  2485. if own['powerslide_counter'] > 15 and own['powerslide_counter'] < 18:
  2486. newx = linVelocity4.x * .9
  2487. else:
  2488. newx = linVelocity4.x * .98
  2489. force = [newx, linVelocity4.y, linVelocity4.z]
  2490. own.setLinearVelocity(force, True)
  2491. def powerslide_state():
  2492. ####powerslide on#####
  2493. if own['powerslide_on'] == 1:
  2494. if own['powerslide'] == "reg2":
  2495. own['requestAction'] = 'reg_fs_powerslide'
  2496. if own['powerslide'] == "fak1":
  2497. own['requestAction'] = 'fak_fs_powerslide'
  2498. if own['powerslide'] == "reg1":
  2499. own['requestAction'] = 'reg_powerslide'
  2500. if own['powerslide'] == "fak2":
  2501. own['requestAction'] = 'fak_powerslide'
  2502. def powerslide_sound():
  2503. sact = own.actuators["powerslide_sound"]
  2504. if own['powerslide_on'] == 1:
  2505. sact = own.actuators["powerslide_sound"]
  2506. sact.volume = .2
  2507. new_pitch = (abs(linVelocity.x) / 3)
  2508. if new_pitch < 1.1 and new_pitch > .5:
  2509. sact.pitch = new_pitch
  2510. elif new_pitch <= .5:
  2511. sact.pitch = .5
  2512. else:
  2513. sact.pitch = 1.1
  2514. cont.activate(own.actuators["powerslide_sound"])
  2515. else:
  2516. sact.volume = .0
  2517. cont.deactivate(own.actuators["powerslide_sound"])
  2518. def check_powerslide():
  2519. try:
  2520. own['last_powerslide_on'] = own['powerslide_on']
  2521. except:
  2522. pass
  2523. psxvel = abs(linVelocity.x)
  2524. if (lUD > .08 or lUD < -.08) and own['manual_v2'] == False and r_ground.triggered == True and psxvel > .1:
  2525. if lUD > .08:
  2526. powerslide()
  2527. else:
  2528. powerslide2()
  2529. else:
  2530. own['powerslide_on'] = 0
  2531. own['powerslide_counter'] = 0
  2532. if own['last_powerslide_on'] == 0:
  2533. own['powerslide'] = None
  2534. def killmanuals():
  2535. if own['last_manual_v2'] == 1 and own['manual_v2'] == 0:
  2536. fak_manual_off()
  2537. reg_manual_off()
  2538. fak_nmanual_off()
  2539. reg_nmanual_off()
  2540. def killopos():
  2541. pass
  2542. stopAnims()
  2543. #nextframe()
  2544. air()
  2545. stance()
  2546. turn()
  2547. #grind()
  2548. rotmult()
  2549. airup()
  2550. onramp()
  2551. speedmult()
  2552. coping()
  2553. onboard()
  2554. resetjumpstance()
  2555. grass()
  2556. grindoutair()
  2557. set_last_grindpos()
  2558. air_pos()
  2559. air_turn_boost()
  2560. record_grindsound()
  2561. check_powerslide()
  2562. powerslide_state()
  2563. powerslide_sound()
  2564. killmanuals()
  2565. killopos()
  2566. grind()
  2567. ##################
  2568. ###realcontrols###
  2569. ##################
  2570. # q1
  2571. # q8 q2
  2572. # q7 q3
  2573. # q6 q4
  2574. # q5
  2575. ##################
  2576. #lq6
  2577. if lUD > .04 and lLR < -0.04 :
  2578. lq6on = 1
  2579. q6oncdl = countdown
  2580. own["Q6oncdl"] = q6oncdl
  2581. #print("lq6on")
  2582. elif q6oncdl > 0:
  2583. lq6on = 0
  2584. q6oncdl = q6oncdl - 1
  2585. own["Q6oncdl"] = q6oncdl
  2586. #lq8
  2587. if lUD < -.04 and lLR < -0.04 :
  2588. lq8on = 1
  2589. q8oncdl = countdown
  2590. own["Q8oncdl"] = q8oncdl
  2591. #print("lq8on")
  2592. elif q8oncdl > 0:
  2593. lq8on = 0
  2594. q8oncdl = q8oncdl - 1
  2595. own["Q8oncdl"] = q8oncdl
  2596. #lq2
  2597. if lUD < -.04 and lLR > 0.04 :
  2598. lq2on = 1
  2599. q2oncdl = countdown
  2600. own["Q2oncdl"] = q2oncdl
  2601. #print("lq2on")
  2602. elif q2oncdl > 0:
  2603. lq2on = 0
  2604. q2oncdl = q2oncdl - 1
  2605. own["Q2oncdl"] = q2oncdl
  2606. #q4
  2607. if lUD > 0.04 and lLR > 0.04 :
  2608. lq4on = 1
  2609. q4oncdl = countdown
  2610. own["Q4oncdl"] = q4oncdl
  2611. #print("lq4on")
  2612. elif q4oncdl > 0:
  2613. lq4on = 0
  2614. q4oncdl = q4oncdl - 1
  2615. own["Q4oncdl"] = q4oncdl
  2616. #q5
  2617. if lUD > .070 and lq4on == 0 and lq6on == 0:
  2618. lq5on = 1
  2619. q5oncdl = countdown
  2620. own["Q5oncdl"] = q5oncdl
  2621. #print("lq5on")
  2622. elif q5oncdl > 0:
  2623. lq5on = 0
  2624. q5oncdl = q5oncdl - 1
  2625. own["Q5oncdl"] = q5oncdl
  2626. #q1
  2627. if lUD < -0.070 and lq8on !=1 and lq2on != 1:
  2628. lq1on = 1
  2629. q1oncdl = countdown
  2630. own["Q1oncdl"] = q1oncdl
  2631. #print("lq1on")
  2632. elif q1oncdl > 0:
  2633. lq1on = 0
  2634. q1oncdl = q1oncdl - 1
  2635. own["Q1oncdl"] = q1oncdl
  2636. #q7
  2637. if lLR < -0.070 and lq8on != 1 and lq6on != 1:
  2638. lq7on = 1
  2639. q7oncdl = countdown
  2640. own["Q7oncdl"] = q7oncdl
  2641. #print("lq7on")
  2642. elif q7oncdl > 0:
  2643. lq7on = 0
  2644. q7oncdl = q7oncdl - 1
  2645. own["Q7oncdl"] = q7oncdl
  2646. #q3
  2647. if lLR > 0.070 and lq2on !=1 and lq4on != 1:
  2648. lq3on = 1
  2649. q3oncdl = countdown
  2650. own["Q3oncdl"] = q3oncdl
  2651. #print("lq3on")
  2652. elif q3oncdl > 0:
  2653. lq3on = 0
  2654. q3oncdl = q3oncdl - 1
  2655. own["Q3oncdl"] = q3oncdl
  2656. #34567
  2657. own['set_revert_timer'] = 0
  2658. if q3oncdl < q4oncdl < q5oncdl < q6oncdl < q7oncdl:
  2659. if r_ground.triggered == True:
  2660. print("REVERT!!!")
  2661. revert()
  2662. own['set_revert_timer'] = 1
  2663. if q3oncdl > q4oncdl > q5oncdl > q6oncdl > q7oncdl:
  2664. if r_ground.triggered == True:
  2665. print("REVERT2!!!")
  2666. revert2()
  2667. own['set_revert_timer'] = 1
  2668. if q7oncdl < q8oncdl < q1oncdl < q2oncdl < q3oncdl:
  2669. if r_ground.triggered == True:
  2670. print("REVERT3!!!")
  2671. revert3()
  2672. own['set_revert_timer'] = 1
  2673. if q7oncdl > q8oncdl > q1oncdl > q2oncdl > q3oncdl:
  2674. if r_ground.triggered == True:
  2675. print("REVERT4!!!")
  2676. revert4()
  2677. own['set_revert_timer'] = 1
  2678. ################
  2679. #q6
  2680. if rUD > .04 and rLR < -0.04 :
  2681. q6on = 1
  2682. q6oncd = countdown
  2683. own["Q6oncd"] = q6oncd
  2684. #print("q6on")
  2685. elif q6oncd > 0:
  2686. q6on = 0
  2687. q6oncd = q6oncd - 1
  2688. own["Q6oncd"] = q6oncd
  2689. #q8
  2690. if rUD < -.04 and rLR < -0.04 :
  2691. q8on = 1
  2692. q8oncd = countdown
  2693. own["Q8oncd"] = q8oncd
  2694. #print("q8on")
  2695. elif q8oncd > 0:
  2696. q8on = 0
  2697. q8oncd = q8oncd - 1
  2698. own["Q8oncd"] = q8oncd
  2699. #q2
  2700. if rUD < -.04 and rLR > 0.04 :
  2701. q2on = 1
  2702. q2oncd = countdown
  2703. own["Q2oncd"] = q2oncd
  2704. #print("q2on")
  2705. elif q2oncd > 0:
  2706. q2on = 0
  2707. q2oncd = q2oncd - 1
  2708. own["Q2oncd"] = q2oncd
  2709. #q4
  2710. if rUD > 0.04 and rLR > 0.04 :
  2711. q4on = 1
  2712. q4oncd = countdown
  2713. own["Q4oncd"] = q4oncd
  2714. #print("q4on")
  2715. elif q4oncd > 0:
  2716. q4on = 0
  2717. q4oncd = q4oncd - 1
  2718. own["Q4oncd"] = q4oncd
  2719. #q5
  2720. if rUD > .070:
  2721. if q4on == 0 and q6on == 0:
  2722. #print("q5on")
  2723. q5on = 1
  2724. q5oncd = countdown
  2725. own["Q5oncd"] = q5oncd
  2726. oposin()
  2727. if (rTrig > 0.02 and GRAB_ON == False and r_ground.triggered == 1) or (lTrig > 0.02 and GRAB_ON == False and r_ground.triggered == 1):
  2728. pump()
  2729. else:
  2730. own["lastPump"] = False
  2731. own["Pump"] = False
  2732. own['jump_stance'] = STANCE
  2733. if rUD > .02:
  2734. grindpos = own['grindpos']
  2735. jumpstance = own["jump_stance"]
  2736. if LAST_GRIND == False:
  2737. if grindpos == "reg_stall":
  2738. grindtype("nose_stall") #change
  2739. elif grindpos == "fak_stall":
  2740. grindtype("nose_stall")
  2741. elif grindpos == "reg_5050":
  2742. if jumpstance != 3:
  2743. if jumpstance == 0:
  2744. if rLR > .02:
  2745. grindtype("reg_tailgR")
  2746. elif rLR < -.02:
  2747. grindtype("reg_tailgL")
  2748. else:
  2749. grindtype("reg_tailg")
  2750. if jumpstance == 1:
  2751. if rLR > .02:
  2752. grindtype("fak_tailgR")
  2753. elif rLR < -.02:
  2754. grindtype("fak_tailgL")
  2755. else:
  2756. grindtype("fak_tailg")
  2757. else:
  2758. if STANCE == 0:
  2759. if rLR > .03:
  2760. grindtype("reg_tailgR")
  2761. elif rLR < -.02:
  2762. grindtype("reg_tailgL")
  2763. else:
  2764. grindtype("reg_tailg")
  2765. if STANCE == 1:
  2766. grindtype("fak_tailg")
  2767. elif grindpos == "reg_board":
  2768. if jumpstance != 3:
  2769. if jumpstance == 0:
  2770. grindtype("reg_tailslide")
  2771. if jumpstance == 1:
  2772. grindtype("fak_tailslide")
  2773. STANCE = jumpstance
  2774. own['stance'] = STANCE
  2775. else:
  2776. if STANCE == 0:
  2777. grindtype("reg_tailslide")
  2778. if STANCE == 1:
  2779. grindtype("fak_tailslide")
  2780. else:
  2781. if jumpstance == 0:
  2782. grindtype("reg_tailg")
  2783. if jumpstance == 1:
  2784. grindtype("fak_tailg")
  2785. if q5oncd > 0:
  2786. q5on = 0
  2787. q5oncd = q5oncd - 1
  2788. own["Q5oncd"] = q5oncd
  2789. own["last_Opos"] = False
  2790. #q1
  2791. if rUD < -0.070:
  2792. if q2on == 0 and q8on == 0:
  2793. print("q1on")
  2794. q1on = 1
  2795. q1oncd = countdown
  2796. own["Q1oncd"] = q1oncd
  2797. noposin()
  2798. if rUD < -0.020:
  2799. grindpos = own['grindpos']
  2800. jumpstance = own["jump_stance"]
  2801. if LAST_GRIND == False:
  2802. if grindpos == "reg_5050":
  2803. #print("nose something")
  2804. if jumpstance != 3:
  2805. if jumpstance == 0:
  2806. if rLR > .02:
  2807. grindtype("reg_nosegR")
  2808. elif rLR < -.02:
  2809. grindtype("reg_nosegL")
  2810. else:
  2811. #print("gtype reg_nosegR")
  2812. grindtype("reg_noseg")
  2813. if jumpstance == 1:
  2814. if rLR > .02:
  2815. grindtype("fak_nosegR")
  2816. elif rLR < -.02:
  2817. grindtype("fak_nosegL")
  2818. else:
  2819. grindtype("fak_noseg")
  2820. else:
  2821. if STANCE == 0:
  2822. if rLR > .02:
  2823. grindtype("reg_nosegR")
  2824. elif rLR < -.02:
  2825. grindtype("reg_nosegL")
  2826. else:
  2827. grindtype("reg_noseg")
  2828. if STANCE == 1:
  2829. if rLR > .02:
  2830. grindtype("fak_nosegR")
  2831. elif rLR < -.02:
  2832. grindtype("fak_nosegL")
  2833. else:
  2834. grindtype("fak_noseg")
  2835. elif grindpos == "reg_board":
  2836. #print("nose something")
  2837. if jumpstance != 3:
  2838. if jumpstance == 0:
  2839. grindtype("reg_noseslide")
  2840. if jumpstance == 1:
  2841. grindtype("fak_noseslide")
  2842. STANCE = jumpstance
  2843. own['stance'] = STANCE
  2844. else:
  2845. if STANCE == 0:
  2846. grindtype("reg_noseslide")
  2847. if STANCE == 1:
  2848. grindtype("fak_noseslide")
  2849. if rUD > -0.020 and rUD <= .020 and LAST_GRIND == False:
  2850. if own['grindpos'] == 'reg_5050':
  2851. grindtype("reg_5050")
  2852. if own['grindpos'] == 'fak_5050':
  2853. grindtype("fak_5050")
  2854. if q1oncd > 0:
  2855. q1on = 0
  2856. q1oncd = q1oncd - 1
  2857. own["Q1oncd"] = q1oncd
  2858. own["last_nOpos"] = False
  2859. #print(q1oncd)
  2860. #q7
  2861. if rLR < -0.070:
  2862. if q8on == 0 and q6on == 0:
  2863. q7on = 1
  2864. q7oncd = countdown
  2865. own["Q7oncd"] = q7oncd
  2866. #print("q7on")
  2867. elif q7oncd > 0:
  2868. q7on = 0
  2869. q7oncd = q7oncd - 1
  2870. own["Q7oncd"] = q7oncd
  2871. #q3
  2872. if rLR > 0.070:
  2873. if q4on == 0 and q2on == 0:
  2874. q3on = 1
  2875. q3oncd = countdown
  2876. own["Q3oncd"] = q3oncd
  2877. #print("q3on")
  2878. elif q3oncd > 0:
  2879. q3on = 0
  2880. q3oncd = q3oncd - 1
  2881. own["Q3oncd"] = q3oncd
  2882. #trick calls
  2883. # 360 flip
  2884. # 3 > 4 > 5 > 8
  2885. # laser flip
  2886. # 7 > 6 > 5 > 2
  2887. #nollie 360 shovit
  2888. if q7oncd > 0 and q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q3oncd > 0 and q7oncd <= q8oncd <= q1oncd <= q2oncd <= q3oncd:
  2889. print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2890. print ("Nollie 360 shovit")
  2891. dict['trick_string'] = 'Nollie 360 Shovit'
  2892. nollie_shovit360()
  2893. q7oncd = 0
  2894. q8oncd = 0
  2895. q1oncd = 0
  2896. q2oncd = 0
  2897. q3oncd = 0
  2898. own["Q7oncd"] = q7oncd
  2899. own["Q8oncd"] = q8oncd
  2900. own["Q1oncd"] = q1oncd
  2901. own["Q2oncd"] = q2oncd
  2902. own["Q3oncd"] = q3oncd
  2903. #nollie fs 360 shovit
  2904. if q7oncd > 0 and q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q3oncd > 0 and q3oncd <= q2oncd <= q1oncd <= q8oncd <= q7oncd:
  2905. #print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2906. print ("Nollie Front Side 360 shovit")
  2907. dict['trick_string'] = 'Nollie FS 360 Shovit'
  2908. nollie_fsshovit360()
  2909. q7oncd = 0
  2910. q8oncd = 0
  2911. q1oncd = 0
  2912. q2oncd = 0
  2913. q3oncd = 0
  2914. own["Q7oncd"] = q7oncd
  2915. own["Q8oncd"] = q8oncd
  2916. own["Q1oncd"] = q1oncd
  2917. own["Q2oncd"] = q2oncd
  2918. own["Q3oncd"] = q3oncd
  2919. # varial heelflip
  2920. # 7 < 6 < 2
  2921. if q7oncd > 0 and q6oncd > 0 and q2oncd > 0 and q7oncd < q6oncd < q2oncd:
  2922. dict['trick_string'] = 'Varial Heelflip'
  2923. varial_heelflip()
  2924. reset_rtimers()
  2925. # varial kickflip
  2926. # 3 < 4 < 8
  2927. if q3oncd > 0 and q4oncd > 0 and q8oncd > 0 and q3oncd < q4oncd < q8oncd:
  2928. dict['trick_string'] = 'Varial Kickflip'
  2929. varial_kickflip()
  2930. reset_rtimers()
  2931. # nollie varial kickflip
  2932. # 3 < 2 < 6
  2933. if q3oncd > 0 and q2oncd > 0 and q6oncd > 0 and q3oncd <= q2oncd <= q6oncd:
  2934. dict['trick_string'] = 'Nollie Varial Kickflip'
  2935. print('Nollie Varial Kickflip')
  2936. nollie_varial_kickflip()
  2937. reset_rtimers()
  2938. # nollie varial heelflip
  2939. # 7 < 8 < 4
  2940. if q7oncd > 0 and q8oncd > 0 and q4oncd > 0 and q7oncd <= q8oncd <= q4oncd:
  2941. dict['trick_string'] = 'Nollie Varial Heelflip'
  2942. print('Nollie Varial Heelflip')
  2943. nollie_varial_heelflip()
  2944. reset_rtimers()
  2945. #360 shovit
  2946. if q3oncd > 0 and q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q7oncd > 0 and q7oncd >= q6oncd >= q5oncd >= q4oncd >= q3oncd:
  2947. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2948. #print ("______-------360 shovit")
  2949. dict['trick_string'] = '360 Shovit'
  2950. shovit360()
  2951. q3oncd = 0
  2952. q4oncd = 0
  2953. q5oncd = 0
  2954. q6oncd = 0
  2955. q7oncd = 0
  2956. own["Q3oncd"] = q3oncd
  2957. own["Q4oncd"] = q4oncd
  2958. own["Q5oncd"] = q5oncd
  2959. own["Q6oncd"] = q6oncd
  2960. own["Q7oncd"] = q7oncd
  2961. #360 fs shovit
  2962. if q3oncd > 0 and q4oncd > 0 and q5oncd > 0 and q6oncd >= 0 and q7oncd > 0 and q7oncd <= q6oncd <= q5oncd <= q4oncd <= q3oncd:
  2963. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2964. #print ("______-------360 shovit")
  2965. dict['trick_string'] = '360 Frontside Shovit'
  2966. fsshovit360()
  2967. q3oncd = 0
  2968. q4oncd = 0
  2969. q5oncd = 0
  2970. q6oncd = 0
  2971. q7oncd = 0
  2972. own["Q3oncd"] = q3oncd
  2973. own["Q4oncd"] = q4oncd
  2974. own["Q5oncd"] = q5oncd
  2975. own["Q6oncd"] = q6oncd
  2976. own["Q7oncd"] = q7oncd
  2977. #ollie
  2978. if q5oncd > 0 and q1oncd > 0 and q5oncd < q1oncd:
  2979. JUMPSTRENGTH = q1oncd - q5oncd
  2980. #4,7
  2981. if JUMPSTRENGTH <= 4:
  2982. JUMPSTRENGTH = 1.1
  2983. if JUMPSTRENGTH > 4 and JUMPSTRENGTH < 7:
  2984. JUMPSTRENGTH = 1
  2985. if JUMPSTRENGTH >= 7:
  2986. JUMPSTRENGTH = .9
  2987. aollie()
  2988. q1oncd = 0
  2989. q5oncd = 0
  2990. own["Q1oncd"] = q1oncd
  2991. own["Q5oncd"] = q5oncd
  2992. #nollie
  2993. if q5oncd > 0 and q1oncd > 0 and q5oncd > q1oncd:
  2994. JUMPSTRENGTH = q5oncd - q1oncd
  2995. #4,7
  2996. if JUMPSTRENGTH <= 4:
  2997. JUMPSTRENGTH = 1.1
  2998. if JUMPSTRENGTH > 4 and JUMPSTRENGTH < 7:
  2999. JUMPSTRENGTH = 1
  3000. if JUMPSTRENGTH >= 7:
  3001. JUMPSTRENGTH = .9
  3002. nollie()
  3003. q1oncd = 0
  3004. q5oncd = 0
  3005. own["Q1oncd"] = q1oncd
  3006. own["Q5oncd"] = q5oncd
  3007. print("nollie")
  3008. #kickflip
  3009. if q5oncd > 0 and q8oncd > 0 and q5oncd < q8oncd and q3oncd < 1:
  3010. kickflip()
  3011. q8oncd = 0
  3012. q5oncd = 0
  3013. own["Q8oncd"] = q8oncd
  3014. own["Q5oncd"] = q5oncd
  3015. #nollie kickflip
  3016. if q1oncd > 0 and q6oncd > 0 and q1oncd < q6oncd:
  3017. nollie_kickflip()
  3018. q6oncd = 0
  3019. q1oncd = 0
  3020. own["Q6oncd"] = q6oncd
  3021. own["Q1oncd"] = q1oncd
  3022. #heelflip
  3023. if q5oncd > 0 and q2oncd > 0 and q5oncd < q2oncd:
  3024. heelflip()
  3025. q2oncd = 0
  3026. q5oncd = 0
  3027. own["Q2oncd"] = q2oncd
  3028. own["Q5oncd"] = q5oncd
  3029. #nollie_heelflip
  3030. if q1oncd > 0 and q4oncd > 0 and q1oncd < q4oncd:
  3031. nollie_heelflip()
  3032. q1oncd = 0
  3033. q4oncd = 0
  3034. own["Q1oncd"] = q1oncd
  3035. own["Q4oncd"] = q4oncd
  3036. #shovit
  3037. if q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q4oncd <= q5oncd <= q6oncd and q3oncd < 1:
  3038. shovit()
  3039. q4oncd = 0
  3040. q5oncd = 0
  3041. q6oncd = 0
  3042. own["Q4oncd"] = q4oncd
  3043. own["Q5oncd"] = q5oncd
  3044. own["Q6oncd"] = q6oncd
  3045. #nollie_shovit
  3046. if q2oncd > 0 and q1oncd > 0 and q8oncd > 0 and q2oncd <= q1oncd <= q8oncd and q3oncd == 0:
  3047. nollie_shovit()
  3048. print('nollie shuvit')
  3049. #nollie_fsshovit()
  3050. q2oncd = 0
  3051. q1oncd = 0
  3052. q8oncd = 0
  3053. own["Q2oncd"] = q2oncd
  3054. own["Q1oncd"] = q1oncd
  3055. own["Q8oncd"] = q8oncd
  3056. #fsshovit
  3057. if q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q6oncd <= q5oncd <= q4oncd and q7oncd < 1:
  3058. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  3059. # print ("^%*^%*^%*^%fsshovit")
  3060. fsshovit()
  3061. q4oncd = 0
  3062. q5oncd = 0
  3063. q6oncd = 0
  3064. own["Q4oncd"] = q4oncd
  3065. own["Q5oncd"] = q5oncd
  3066. own["Q6oncd"] = q6oncd
  3067. #nollie_fsshovit
  3068. if q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q8oncd <= q1oncd <= q2oncd and q7oncd == 0:
  3069. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  3070. print ("nollie fsshovit")
  3071. nollie_fsshovit()
  3072. #nollie_shovit()
  3073. q8oncd = 0
  3074. q1oncd = 0
  3075. q2oncd = 0
  3076. own["Q8oncd"] = q4oncd
  3077. own["Q1oncd"] = q5oncd
  3078. own["Q2oncd"] = q6oncd
  3079. #360 shovit
  3080. # 360 shovit
  3081. # 3 > 4 > 5 >6 > 7
  3082. # fs 360 shovit
  3083. # 7 > 6 > 5 > 4 > 3
  3084. def hippy_jump():
  3085. STANCE = own["stance"]
  3086. if own['hippy'] == 1 and own['last_hippy'] == 0:
  3087. if STANCE == 0:
  3088. #own['requestAction'] = 'reg_hippy'
  3089. skater.playAction("reg_hippy", 1,10, layer=1101, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3090. if STANCE == 1:
  3091. skater.playAction("fak_hippy", 1,10, layer=1101, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3092. if own['hippy'] == 1 and own['last_hippy'] == 1:
  3093. if STANCE == 0:
  3094. skater.playAction("reg_hippy", 10,10, layer=1100, priority=0, layer_weight=0, play_mode=1, speed=.5)
  3095. if STANCE == 1:
  3096. skater.playAction("fak_hippy", 10,10, layer=1100, priority=0, layer_weight=0, play_mode=1, speed=.5)
  3097. if own['hippy'] == 0 and own['last_hippy'] == 1:
  3098. killact(1100)
  3099. if rLR > turnsens:
  3100. local = True
  3101. rot = [ 0.0, 0.0, 3.14]
  3102. own.applyRotation(rot,local)
  3103. print("hippy turn")
  3104. if STANCE == 0:
  3105. own['requestAction'] = 'reg_hippy_ncw'
  3106. skater.playAction("reg_hippy_ncw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3107. print('%hip1')
  3108. if STANCE == 1:
  3109. own['requestAction'] = 'fak_hippy_ncw'
  3110. skater.playAction("fak_hippy_ncw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3111. print('%hip2')
  3112. elif rLR < -turnsens:
  3113. local = True
  3114. rot = [ 0.0, 0.0, -3.14]
  3115. own.applyRotation(rot,local)
  3116. print("hippy turn neg")
  3117. if STANCE == 0:
  3118. own['requestAction'] = 'fak_hippy_nccw'
  3119. skater.playAction("fak_hippy_nccw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3120. print('%hip3')
  3121. if STANCE == 1:
  3122. own['requestAction'] = 'reg_hippy_nccw'
  3123. skater.playAction("reg_hippy_nccw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3124. print('%hip4')
  3125. ##straight
  3126. else:
  3127. if STANCE == 0:
  3128. skater.playAction("reg_hippy", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3129. own['requestAction'] = 'reg_hippy'
  3130. if STANCE == 1:
  3131. own['requestAction'] = 'fak_hippy'
  3132. skater.playAction("fak_hippy", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3133. #pushing and hippy jumps
  3134. since_a = frame - lastaf
  3135. since_x = frame - lastxf
  3136. cush = 10
  3137. hippy = 0
  3138. own['hippy'] = 0
  3139. #print(since_a, "a", since_x, "x")
  3140. #if xBut == 1 and aBut == 1 and since_a <= cush and since_x <= cush and (lTrig < 0.02 and rTrig < 0.02):
  3141. if xBut == 1 and aBut == 1 and (lTrig < 0.02 and rTrig < 0.02) and r_ground.triggered == True:
  3142. #F"hippy")
  3143. hippy = 1
  3144. own['hippy'] = 1
  3145. #hippy_jump()
  3146. #print(hippy)
  3147. hippy_jump()
  3148. if since_a > cush and aBut == 1 and lasta == 1 and (lTrig < 0.02 and rTrig < 0.02) and own['last_hippy'] == 0:
  3149. #print("apush suckka", since_a)
  3150. if xBut == 0 and hippy == 0 and lastaBut_ground == True:
  3151. push()
  3152. if since_x > cush and xBut == 1 and lastx == 1 and (lTrig < 0.02 and rTrig < 0.02) and own['last_hippy'] == 0:
  3153. #print("push suckka", since_x)
  3154. if aBut == 0 and hippy == 0 and lastxBut_ground == True:
  3155. push_goof()
  3156. #cavemans
  3157. if LAST_GRIND == False and grindHit == False and r_ground.triggered:
  3158. if (aBut ==0 and own['lastaBut_ground'] == 1) and lTrig > 0.02:
  3159. brfoot()
  3160. if (aBut ==0 and own['lastaBut_ground'] == 1) and rTrig > 0.02:
  3161. frfoot()
  3162. if (xBut ==0 and own['lastxBut_ground'] == 1) and lTrig > 0.02:
  3163. blfoot()
  3164. if (xBut ==0 and own['lastxBut_ground'] == 1) and rTrig > 0.02:
  3165. flfoot()
  3166. #push b button
  3167. if bBut == 1:
  3168. #print("push suckka")
  3169. if linVelocity.x > .05 or linVelocity.x < -.05:
  3170. stop()
  3171. elif linVelocity.x < .05 or linVelocity.x > -.05:
  3172. if own["lastStop"] == True:
  3173. own["lastStop"] = False
  3174. elif bBut ==0:
  3175. own["lastStop"] = False
  3176. ##### falls
  3177. if own['fall'] == 1:
  3178. offboard()
  3179. own['getoffboard'] = True
  3180. ####
  3181. #y button
  3182. if own['lasty'] == 1 and yBut ==0:
  3183. offboard()
  3184. if own["GRAB_ON"] == True:
  3185. playing = skater.isPlayingAction(fliplay)
  3186. if playing == 1:
  3187. frame = skater.getActionFrame(fliplay)
  3188. #print("Flipping frame: ", frame)
  3189. if frame > 16:
  3190. skater.stopAction(fliplay)
  3191. #frontside grab
  3192. flipping = skater.isPlayingAction(fliplay)
  3193. if rTrig > 0.02 and r_ground.triggered == 0 and flipping == False:
  3194. GRAB_ON = True
  3195. own["GRAB_ON"] = GRAB_ON
  3196. #print(rTrig, GRAB_ON)
  3197. if STANCE == False and rUD >= -.07 and rUD <= .07:
  3198. frontside_grab_on()
  3199. elif STANCE == True and rUD >= -.07 and rUD <= .07:
  3200. fakbackside_grab_on()
  3201. #front_nose
  3202. if STANCE == True and rUD < -0.070:
  3203. fak_backside_nose_grab_on()
  3204. #front_tail
  3205. elif STANCE == True and rUD > 0.07:
  3206. fak_backside_tail_grab_on()
  3207. #
  3208. if STANCE == False and rUD < -0.070:
  3209. frontside_nose_grab_on()
  3210. #front_tail
  3211. elif STANCE == False and rUD > 0.07:
  3212. frontside_tail_grab_on()
  3213. #backside grab
  3214. #if lTrig > 0.02 and GRAB_ON == False and r_ground.triggered == 0:
  3215. if lTrig > 0.02 and r_ground.triggered == 0 and flipping == False:
  3216. GRAB_ON = True
  3217. own["GRAB_ON"] = GRAB_ON
  3218. #print(rTrig)
  3219. if STANCE == False and rUD >= -.07 and rUD <= .07:
  3220. backside_grab_on()
  3221. elif STANCE == True and rUD >= -.07 and rUD <= .07:
  3222. fakfrontside_grab_on()
  3223. #front_nose
  3224. if STANCE == True and rUD < -0.070:
  3225. fak_frontside_nose_grab_on()
  3226. #front_tail
  3227. elif STANCE == True and rUD > 0.07:
  3228. fak_frontside_tail_grab_on()
  3229. #front_nose
  3230. if STANCE == False and rUD < -0.070:
  3231. backside_nose_grab_on()
  3232. #front_tail
  3233. elif STANCE == False and rUD > 0.07:
  3234. backside_tail_grab_on()
  3235. #kill grabs
  3236. if lTrig <= 0.02 and GRAB_ON == True and lTrig >= -.02 and rTrig <= .02 and rTrig >= -.2:
  3237. GRAB_ON = False
  3238. own["GRAB_ON"] = GRAB_ON
  3239. GRAB_PLAYED = False
  3240. own["GRAB_PLAYED"] = GRAB_PLAYED
  3241. #frontside pump #backside pump
  3242. def footplant():
  3243. framenum = own['framenum']
  3244. last_ground_frame = own['lF_ground_frame']
  3245. lF_air_frame = own['lF_air_frame']
  3246. frames_since_ground = framenum - lF_air_frame
  3247. frames_since_grind = framenum - own['last_grind_frame']
  3248. #print(frames_since_ground, "fsg")
  3249. if LAST_GRIND == False and grindHit == True and aBut == True and frames_since_ground < 40 and touched:
  3250. own.setLinearVelocity([0,0,0],0)
  3251. killall()
  3252. if STANCE == 0:
  3253. skater.playAction("reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3254. deck.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3255. trucks.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3256. skater.playAction("reg_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3257. deck.playAction("a_reg_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3258. trucks.playAction("a_reg_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3259. if STANCE == 1:
  3260. skater.playAction("fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3261. deck.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3262. trucks.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3263. skater.playAction("fak_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3264. deck.playAction("a_fak_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3265. trucks.playAction("a_fak_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3266. own['footplant_on'] = 1
  3267. if grindHit == False:
  3268. own['footplant_on'] = 0
  3269. if own['footplant_on'] == True and rUD < turnsens and rUD > -turnsens:
  3270. own.setLinearVelocity([0,0,0],0)
  3271. if own['footplant_on'] == 1 and own['last_footplant'] == True:
  3272. if skater.isPlayingAction(2925) == False:
  3273. if STANCE == 0:
  3274. skater.playAction("reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3275. deck.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3276. trucks.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3277. if STANCE == 1:
  3278. skater.playAction("fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3279. deck.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3280. trucks.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3281. if own['last_footplant'] == True and own['footplant_on'] == 0:
  3282. killall()
  3283. if STANCE == 0:
  3284. skater.playAction("reg_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3285. deck.playAction("a_reg_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3286. trucks.playAction("a_reg_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3287. if STANCE == 1:
  3288. skater.playAction("fak_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3289. deck.playAction("a_fak_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3290. trucks.playAction("a_fak_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3291. def invert():
  3292. if LAST_GRIND == False and grindHit == True and own['grindpos'] == 'reg_board':
  3293. if lBump == 1:
  3294. #print("invert")
  3295. #if coping_on ==1 and lBump == 1:
  3296. print("IIIIIINVVERT")
  3297. own['invert_on'] = 1
  3298. own.setLinearVelocity([0,0,0],0)
  3299. if own["coping"] == 1 and invert_on == 1:
  3300. killact(25)
  3301. killact(24)
  3302. if own['invert_on'] == 1 and own['last_invert'] == False:
  3303. killall()
  3304. cont.activate(own.actuators['invertOn_sound'])
  3305. if STANCE == False:
  3306. own['invert_type'] = "reg_back_invert_in"
  3307. skater.playAction("reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1)
  3308. deck.playAction("a_reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1)
  3309. trucks.playAction("a_reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1)
  3310. if STANCE == True:
  3311. own['invert_type'] = "fak_fr_invert"
  3312. skater.playAction("fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1)
  3313. deck.playAction("a_fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1)
  3314. trucks.playAction("a_fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1)
  3315. if invert_on == 0 and own['last_invert'] == True:
  3316. #print("kill invert")
  3317. own['last_invert_frame'] = frame
  3318. cont.activate(own.actuators['invertOff_Sound'])
  3319. killact(300)
  3320. killact(301)
  3321. killact(302)
  3322. killact(303)
  3323. killact(304)
  3324. killact(305)
  3325. killact(700)
  3326. killact(700)
  3327. killact(700)
  3328. killact(290)
  3329. killact(291)
  3330. killact(292)
  3331. if own['invert_type'] == "reg_back_invert_in":
  3332. skater.playAction("reg_back_invert_in", 20,0, layer=306, play_mode=0, speed=1)
  3333. deck.playAction("a_reg_back_invert_in", 20,0, layer=306, play_mode=0, speed=1)
  3334. trucks.playAction("a_reg_back_invert_in", 20,0, layer=306, play_mode=0, speed=1)
  3335. if own['invert_type'] == "fak_fr_invert":
  3336. skater.playAction("fak_fr_invert", 20,0, layer=306, play_mode=0, speed=1)
  3337. deck.playAction("a_fak_fr_invert", 20,0, layer=306, play_mode=0, speed=1)
  3338. trucks.playAction("a_fak_fr_invert", 20,0, layer=306, play_mode=0, speed=1)
  3339. if invert_on == 1:
  3340. if own['invert_type'] == "reg_back_invert_in":
  3341. skater.playAction("reg_back_invert_in", 30,30, layer=290, play_mode=1, speed=1)
  3342. deck.playAction("a_reg_back_invert_in", 30,30, layer=290, play_mode=1, speed=1)
  3343. trucks.playAction("a_reg_back_invert_in", 30,30, layer=290, play_mode=1, speed=1)
  3344. if own['invert_type'] == "fak_fr_invert":
  3345. skater.playAction("fak_fr_invert", 30,30, layer=290, play_mode=1, speed=1)
  3346. deck.playAction("a_fak_fr_invert", 30,30, layer=290, play_mode=1, speed=1)
  3347. trucks.playAction("a_fak_fr_invert", 30,30, layer=290, play_mode=1, speed=1)
  3348. lif = own['last_invert_frame']
  3349. if frame - lif > 3 and invert_on == 0:
  3350. own['invert_type'] = None
  3351. invert()
  3352. footplant()
  3353. if own['invert_on'] == 0:
  3354. killact(900)
  3355. def reset_pos():
  3356. #reset
  3357. if ddPad == 1:
  3358. spawn_pos = own['spawn_pos']
  3359. spawn_rot = own['spawn_rot']
  3360. try:
  3361. own.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .1))
  3362. 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]]
  3363. except:
  3364. own.worldPosition = (0, 0, .1)
  3365. own.worldOrientation = [[1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
  3366. if own["spawn_stance"] == 1:
  3367. own.setLinearVelocity([.1,0,0], 1)
  3368. #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
  3369. #cam.applyMovement([0,-1,0], True)
  3370. #lx = cam.localPosition[1]
  3371. #lx = lx - 4
  3372. #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]]
  3373. #cam.localPosition[1] = lx
  3374. else:
  3375. own.setLinearVelocity([-.1,0,0], 1)
  3376. #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
  3377. #cam.applyMovement([0,1,0], True)
  3378. #lx = cam.localPosition[1]
  3379. #lx = lx - 4
  3380. #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]]
  3381. #cam.localPosition[1] = lx
  3382. if udPad == 1:
  3383. own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]]
  3384. 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]]
  3385. stance = own["stance"]
  3386. own["spawn_stance"] = stance
  3387. #start button
  3388. if stBut == True:
  3389. own.actuators["sroll"].volume = .0001
  3390. cont.deactivate(own.actuators["sroll"])
  3391. own.actuators["sroll"].stopSound()
  3392. def ylimit():
  3393. lgf = own['last_grind_frame']
  3394. frame = own['framenum']
  3395. frames_since_grinding = frame - lgf
  3396. if r_ground.triggered and touched == False and grindHit == 0 and frames_since_grinding > 20:
  3397. linVelocity4 = own.getLinearVelocity(True)
  3398. newy = linVelocity4.y * .8 #.4
  3399. force = [linVelocity4.x, newy, linVelocity4.z]
  3400. own.setLinearVelocity(force, True)
  3401. #print("limitting y")
  3402. # own["linVely"] = linVelocity.y
  3403. def getoffboard():
  3404. lasty = own['lasty']
  3405. getoffboard = own['getoffboard']
  3406. if getoffboard == 1 and own['fall'] == False:
  3407. own['getoffboard'] = 0
  3408. if yBut == False and lasty == True:
  3409. own['getoffboard'] = 1
  3410. def switchcam():
  3411. pass
  3412. # if ltsBut == False and own['lastlts'] == True and rtsBut == False:
  3413. # if own['camera'] == 1:
  3414. # own['camera'] = 0
  3415. # else:
  3416. # own['camera'] = 1
  3417. # if rtsBut == False and own['lastrts'] == True and ltsBut == False:
  3418. # if own['camera'] == 2:
  3419. # own['camera'] = 0
  3420. # else:
  3421. # own['camera'] = 2
  3422. #followcam
  3423. def move_followcam():
  3424. if own['camera'] == 2:
  3425. #if rtsBut == False and own['lastrts'] == True:
  3426. if own['lastbkBut'] == True and bkBut == False:
  3427. #print("activate move followcam")
  3428. if own['move_followcam'] == False:
  3429. own['move_followcam'] = True
  3430. else:
  3431. own['move_followcam'] = False
  3432. if own['move_followcam'] == True:
  3433. #act = followcam.actuators[
  3434. camspeed1 = .015
  3435. camspeed2 = .055
  3436. camrot1 = .005
  3437. camrot2 = .02
  3438. #up
  3439. if lUD < -0.080:
  3440. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  3441. cont.activate(followcam.actuators["up"])
  3442. #print("fastup")
  3443. else:
  3444. cont.deactivate(followcam.actuators["up"])
  3445. # #down
  3446. if lUD > .080:
  3447. followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  3448. cont.activate(followcam.actuators["down"])
  3449. else:
  3450. cont.deactivate(followcam.actuators["down"])
  3451. # #left
  3452. if lLR < -0.080:
  3453. followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  3454. cont.activate(followcam.actuators["left"])
  3455. else:
  3456. cont.deactivate(followcam.actuators["left"])
  3457. # #right
  3458. if lLR > 0.080:
  3459. followcam.actuators["right"].dLoc = [camspeed2, 0, 0]
  3460. cont.activate(followcam.actuators["right"])
  3461. else:
  3462. cont.deactivate(followcam.actuators["right"])
  3463. #up
  3464. if rUD < -0.080:
  3465. followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
  3466. cont.activate(followcam.actuators["rotup"])
  3467. #print("uppppppppppppppppppppppppppp")
  3468. else:
  3469. cont.deactivate(followcam.actuators["rotup"])
  3470. # #down
  3471. if rUD > .080:
  3472. followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]
  3473. cont.activate(followcam.actuators["rotdown"])
  3474. else:
  3475. cont.deactivate(followcam.actuators["rotdown"])
  3476. # #left
  3477. if rLR < -0.080:
  3478. followcam.actuators["rotleft"].dRot = [0, 0, camrot2]
  3479. cont.activate(followcam.actuators["rotleft"])
  3480. else:
  3481. cont.deactivate(followcam.actuators["rotleft"])
  3482. # #right
  3483. if rLR > 0.080:
  3484. followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
  3485. cont.activate(followcam.actuators["rotright"])
  3486. else:
  3487. cont.deactivate(followcam.actuators["rotright"])
  3488. #*********************************************
  3489. if lUD > -0.080 and lUD < -0.030:
  3490. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  3491. cont.activate(followcam.actuators["up"])
  3492. #print(lUD)
  3493. else:
  3494. cont.deactivate(followcam.actuators["up"])
  3495. # #down
  3496. if lUD < .080 and lUD > .03:
  3497. followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  3498. cont.activate(followcam.actuators["down"])
  3499. else:
  3500. cont.deactivate(followcam.actuators["down"])
  3501. # #left
  3502. if lLR > -0.080 and lLR < -0.030:
  3503. followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  3504. cont.activate(followcam.actuators["left"])
  3505. else:
  3506. cont.deactivate(followcam.actuators["left"])
  3507. # #right
  3508. if lLR < .080 and lLR > .03:
  3509. followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
  3510. cont.activate(followcam.actuators["right"])
  3511. else:
  3512. cont.deactivate(followcam.actuators["right"])
  3513. #up
  3514. if rUD > -0.080 and rUD < -0.030:
  3515. followcam.actuators["rotup"].dRot = [camrot1, 0, 0]
  3516. cont.activate(followcam.actuators["rotup"])
  3517. else:
  3518. cont.deactivate(followcam.actuators["rotup"])
  3519. # #down
  3520. if rUD < .080 and rUD > .03:
  3521. followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  3522. cont.activate(followcam.actuators["rotdown"])
  3523. else:
  3524. cont.deactivate(followcam.actuators["rotdown"])
  3525. # #left
  3526. if rLR > -0.080 and rLR < -0.030:
  3527. followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
  3528. cont.activate(followcam.actuators["rotleft"])
  3529. else:
  3530. cont.deactivate(followcam.actuators["rotleft"])
  3531. # #right
  3532. if rLR < .080 and rLR > .03:
  3533. followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
  3534. cont.activate(followcam.actuators["rotright"])
  3535. else:
  3536. cont.deactivate(followcam.actuators["rotright"])
  3537. def move_flycam():
  3538. if own['camera'] == 1:
  3539. #if rtsBut == False and own['lastrts'] == True:
  3540. if own['lastbkBut'] == True and bkBut == False:
  3541. if own['move_freecam'] == False:
  3542. own['move_freecam'] = True
  3543. else:
  3544. own['move_freecam'] = False
  3545. if own['move_freecam'] == True:
  3546. #act = freecam.actuators[
  3547. camspeed1 = .015
  3548. camspeed2 = .055
  3549. camrot1 = .005
  3550. camrot2 = .02
  3551. #up
  3552. if lUD < -0.080:
  3553. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  3554. cont.activate(freecam.actuators["up"])
  3555. #print("fastup")
  3556. else:
  3557. cont.deactivate(freecam.actuators["up"])
  3558. # #down
  3559. if lUD > .080:
  3560. freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  3561. cont.activate(freecam.actuators["down"])
  3562. else:
  3563. cont.deactivate(freecam.actuators["down"])
  3564. # #left
  3565. if lLR < -0.080:
  3566. freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  3567. cont.activate(freecam.actuators["left"])
  3568. else:
  3569. cont.deactivate(freecam.actuators["left"])
  3570. # #right
  3571. if lLR > 0.080:
  3572. freecam.actuators["right"].dLoc = [camspeed2, 0, 0]
  3573. cont.activate(freecam.actuators["right"])
  3574. else:
  3575. cont.deactivate(freecam.actuators["right"])
  3576. #up
  3577. if rUD < -0.080:
  3578. freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
  3579. cont.activate(freecam.actuators["rotup"])
  3580. else:
  3581. cont.deactivate(freecam.actuators["rotup"])
  3582. # #down
  3583. if rUD > .080:
  3584. freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]
  3585. cont.activate(freecam.actuators["rotdown"])
  3586. else:
  3587. cont.deactivate(freecam.actuators["rotdown"])
  3588. # #left
  3589. if rLR < -0.080:
  3590. freecam.actuators["rotleft"].dRot = [0, 0, camrot2]
  3591. cont.activate(freecam.actuators["rotleft"])
  3592. else:
  3593. cont.deactivate(freecam.actuators["rotleft"])
  3594. # #right
  3595. if rLR > 0.080:
  3596. freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
  3597. cont.activate(freecam.actuators["rotright"])
  3598. else:
  3599. cont.deactivate(freecam.actuators["rotright"])
  3600. #*********************************************
  3601. if lUD > -0.080 and lUD < -0.030:
  3602. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  3603. cont.activate(freecam.actuators["up"])
  3604. #print(lUD)
  3605. else:
  3606. cont.deactivate(freecam.actuators["up"])
  3607. # #down
  3608. if lUD < .080 and lUD > .03:
  3609. freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  3610. cont.activate(freecam.actuators["down"])
  3611. else:
  3612. cont.deactivate(freecam.actuators["down"])
  3613. # #left
  3614. if lLR > -0.080 and lLR < -0.030:
  3615. freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  3616. cont.activate(freecam.actuators["left"])
  3617. else:
  3618. cont.deactivate(freecam.actuators["left"])
  3619. # #right
  3620. if lLR < .080 and lLR > .03:
  3621. freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
  3622. cont.activate(freecam.actuators["right"])
  3623. else:
  3624. cont.deactivate(freecam.actuators["right"])
  3625. #up
  3626. if rUD > -0.080 and rUD < -0.030:
  3627. freecam.actuators["rotup"].dRot = [camrot1, 0, 0]
  3628. cont.activate(freecam.actuators["rotup"])
  3629. else:
  3630. cont.deactivate(freecam.actuators["rotup"])
  3631. # #down
  3632. if rUD < .080 and rUD > .03:
  3633. freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  3634. cont.activate(freecam.actuators["rotdown"])
  3635. else:
  3636. cont.deactivate(freecam.actuators["rotdown"])
  3637. # #left
  3638. if rLR > -0.080 and rLR < -0.030:
  3639. freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
  3640. cont.activate(freecam.actuators["rotleft"])
  3641. else:
  3642. cont.deactivate(freecam.actuators["rotleft"])
  3643. # #right
  3644. if rLR < .080 and rLR > .03:
  3645. freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
  3646. cont.activate(freecam.actuators["rotright"])
  3647. else:
  3648. cont.deactivate(freecam.actuators["rotright"])
  3649. if r_ground.triggered == False:
  3650. own["lF_air_frame"] = own["framenum"]
  3651. if r_ground.triggered == True:
  3652. own["lF_ground_frame"] = own["framenum"]
  3653. if own['LAST_GRIND'] == True:
  3654. own['last_grind_frame'] = own['framenum']
  3655. if own['LAST_GRIND'] == False and r_ground.triggered and own['jump_timer'] == 0:
  3656. if own['jump_stance'] != 3:
  3657. own['jump_stance'] = 3
  3658. def control_calib():
  3659. #controller calibration test
  3660. scenes = bge.logic.getSceneList()
  3661. controller_calib = [scene for scene in scenes if scene.name=="controller_calib"][0]
  3662. cq1 = controller_calib.objects['q1']
  3663. cq2 = controller_calib.objects['q2']
  3664. cq3 = controller_calib.objects['q3']
  3665. cq4 = controller_calib.objects['q4']
  3666. cq5 = controller_calib.objects['q5']
  3667. cq6 = controller_calib.objects['q6']
  3668. cq7 = controller_calib.objects['q7']
  3669. cq8 = controller_calib.objects['q8']
  3670. if lq1on == 1:
  3671. cq1["q1"] = 1
  3672. else:
  3673. cq1["q1"] = 0
  3674. if lq2on == 1:
  3675. cq2["q2"] = 1
  3676. else:
  3677. cq2["q2"] = 0
  3678. if lq3on == 1:
  3679. cq3["q3"] = 1
  3680. else:
  3681. cq3["q3"] = 0
  3682. if lq4on == 1:
  3683. cq4["q4"] = 1
  3684. else:
  3685. cq4["q4"] = 0
  3686. if lq5on == 1:
  3687. cq5["q5"] = 1
  3688. else:
  3689. cq5["q5"] = 0
  3690. if lq6on == 1:
  3691. cq6["q6"] = 1
  3692. else:
  3693. cq6["q6"] = 0
  3694. if lq7on == 1:
  3695. cq7["q7"] = 1
  3696. else:
  3697. cq7["q7"] = 0
  3698. if lq8on == 1:
  3699. cq8["q8"] = 1
  3700. else:
  3701. cq8["q8"] = 0
  3702. def grind_turn():
  3703. jumping = None
  3704. gotcd = 25
  3705. force = [0,0,0]
  3706. grindHit = own['grindTouch']
  3707. sincegrinding = own['framenum'] - own['grindstartFrame']
  3708. if rUD > turnsens or rLR > turnsens or rUD < -turnsens or rLR < -turnsens:
  3709. jumping = True
  3710. if grindHit == False:
  3711. cont.deactivate(own.actuators['grindoutRight'])
  3712. cont.deactivate(own.actuators['grindoutLeft'])
  3713. if grindHit == True and jumping == None and sincegrinding > 20:
  3714. #if grindHit == True and jumping == None:
  3715. outloc = 0.022
  3716. bsoutloc = .07
  3717. bsoutvel = .1
  3718. outrot = .02 #0.012
  3719. outrot2 = .24
  3720. outact = own.actuators["grindoutRight"]
  3721. if own['grindpos'] == 'reg_5050':
  3722. if lq3on == 1 or lq2on:
  3723. if own['gt_cd2'] == 0:
  3724. own['gt_cd2'] = 60
  3725. if STANCE == True:
  3726. if own['grind_out_type'] == None:
  3727. own['grind_out_type'] = 'fak right'
  3728. if STANCE == False:
  3729. if own['grind_out_type'] == None:
  3730. own['grind_out_type'] = 'reg right'
  3731. own["grindoutturn"] = gotcd
  3732. if lq7on == 1 or lq8on:
  3733. if own['gt_cd2'] == 0:
  3734. own['gt_cd2'] = 60
  3735. if STANCE == True:
  3736. if own['grind_out_type'] == None:
  3737. own['grind_out_type'] = 'fak left'
  3738. if STANCE == False:
  3739. if own['grind_out_type'] == None:
  3740. own['grind_out_type'] = 'reg left'
  3741. own["grindoutturn"] = gotcd
  3742. if lq4on == 1:
  3743. if own['gt_cd2'] == 0:
  3744. own['gt_cd2'] = 60
  3745. if STANCE == True:
  3746. if own['grind_out_type'] == None:
  3747. own['grind_out_type'] = 'fak fak right'
  3748. if STANCE == False:
  3749. if own['grind_out_type'] == None:
  3750. own['grind_out_type'] = 'reg fak right'
  3751. own["grindoutturn"] = gotcd
  3752. if lq6on == 1:
  3753. if own['gt_cd2'] == 0:
  3754. own['gt_cd2'] = 60
  3755. if STANCE == True:
  3756. if own['grind_out_type'] == None:
  3757. own['grind_out_type'] = 'fak fak left'
  3758. if STANCE == False:
  3759. if own['grind_out_type'] == None:
  3760. own['grind_out_type'] = 'reg fak left'
  3761. own["grindoutturn"] = gotcd
  3762. #use stance for 5050 and grindstance for boards
  3763. if own['grindpos'] == 'reg_board':
  3764. outvel = own.getLinearVelocity(1)
  3765. outact.dLoc = [0, 0, 0]
  3766. outact.dRot = [0, 0, 0]
  3767. if lq5on == 1:
  3768. if own['gt_cd2'] == 0:
  3769. own['gt_cd2'] = 60
  3770. if own['grind_stance'] == True:
  3771. if own['footplant_on'] == True:
  3772. own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
  3773. cont.activate(own.actuators["grindoutRight"])
  3774. if own['grind_out_type'] == None:
  3775. own['grind_out_type'] = 'bs fak back'
  3776. if own['grind_stance'] == False:
  3777. if own['footplant_on'] == True:
  3778. own.setLinearVelocity([(outvel.x + bsoutvel), outvel.y, outvel.z], 1)
  3779. cont.activate(own.actuators["grindoutRight"])
  3780. if own['grind_out_type'] == None:
  3781. own['grind_out_type'] = 'bs reg back'
  3782. own["grindoutturn"] = gotcd
  3783. own['invert_on'] = 0
  3784. if lq1on == 1:
  3785. if own['gt_cd2'] == 0:
  3786. own['gt_cd2'] = 60
  3787. if own['grind_stance'] == True:
  3788. if own['footplant_on'] == True:
  3789. own.setLinearVelocity([(outvel.x + bsoutvel), outvel.y, outvel.z], 1)
  3790. cont.activate(own.actuators["grindoutRight"])
  3791. if own['grind_out_type'] == None:
  3792. own['grind_out_type'] = 'bs fak forward'
  3793. if own['grind_stance'] == False:
  3794. if own['footplant_on'] == True:
  3795. own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
  3796. cont.activate(own.actuators["grindoutRight"])
  3797. if own['grind_out_type'] == None:
  3798. own['grind_out_type'] = 'bs reg forward'
  3799. own["grindoutturn"] = gotcd
  3800. own['invert_on'] = 0
  3801. if lq1on or lq2on or lq3on or lq4on or lq5on or lq6on or lq7on or lq8on:
  3802. gt_cd = own['gt_cd']
  3803. if gt_cd == 0:
  3804. gt_cd = 30
  3805. own['gt_cd'] = gt_cd
  3806. #else:
  3807. #else:
  3808. if own['grindoutturn'] == 0:
  3809. cont.deactivate(own.actuators["grindoutRight"])
  3810. own["grindoutturn"] = 0
  3811. gt_cd = own['gt_cd']
  3812. if gt_cd > 0:
  3813. own['gt_cd'] = gt_cd - 1
  3814. else:
  3815. own['gt_cd'] = 0
  3816. #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  3817. reg_move = .05
  3818. reg_rot = 0.01
  3819. reg_rot2 = .26
  3820. reg_move2 = .13
  3821. bsforce = 50
  3822. bs_dloc = .03
  3823. outvel = own.linearVelocity
  3824. if own['gt_cd2'] > 50:
  3825. if own['grind_out_type'] == 'reg right':
  3826. #print("do reg right")
  3827. own.applyMovement([0,reg_move,0], True)
  3828. own.applyRotation([0,0,reg_rot],True)
  3829. if own['grind_out_type'] == 'fak right':
  3830. own.applyMovement([0,-reg_move,0], True)
  3831. own.applyRotation([0,0,-reg_rot],True)
  3832. #print("do fak right")
  3833. if own['grind_out_type'] == 'reg left':
  3834. #print("do reg left")
  3835. own.applyMovement([0,-reg_move,0], True)
  3836. own.applyRotation([0,0,reg_rot],True)
  3837. if own['grind_out_type'] == 'fak left':
  3838. own.applyMovement([0,reg_move,0], True)
  3839. own.applyRotation([0,0,-reg_rot],True)
  3840. #print("do fak left")
  3841. if own['grind_out_type'] == 'reg fak right':
  3842. if own['gt_cd2'] > 55:
  3843. own.applyMovement([0,reg_move2,0], True)
  3844. own.applyRotation([0,0,reg_rot2],True)
  3845. #print("do reg fak right")
  3846. if own['grind_out_type'] == 'fak fak right':
  3847. if own['gt_cd2'] > 55:
  3848. own.applyMovement([0,-reg_move2,0], True)
  3849. own.applyRotation([0,0,reg_rot2],True)
  3850. #print("do fak fak right")
  3851. if own['grind_out_type'] == 'reg fak left':
  3852. if own['gt_cd2'] > 55:
  3853. own.applyMovement([0,-reg_move2,0], True)
  3854. own.applyRotation([0,0,-reg_rot2],True)
  3855. #print("do reg fak left")
  3856. if own['grind_out_type'] == 'fak fak left':
  3857. if own['gt_cd2'] > 55:
  3858. own.applyMovement([0,reg_move2,0], True)
  3859. own.applyRotation([0,0,-reg_rot2],True)
  3860. #print("do fak fak left")
  3861. if own['grind_out_type'] == 'reg right' or own['grind_out_type'] == 'reg left' or own['grind_out_type'] == 'fak right' or own['grind_out_type'] == 'fak left':
  3862. own.setLinearVelocity([outvel.x * 1.01, outvel.y, outvel.z], True)
  3863. if own['grind_out_type'] == 'reg fak right' or own['grind_out_type'] == 'reg fak left' or own['grind_out_type'] == 'fak fak right' or own['grind_out_type'] == 'fak fak left':
  3864. if own['gt_cd2'] == 51:
  3865. #print('outforce')
  3866. if STANCE == 0:
  3867. own.applyForce([-200, 0, 0], True)
  3868. if STANCE == 1:
  3869. own.applyForce([200, 0, 0], True)
  3870. if own['grind_out_type'] == 'bs reg back' or own['grind_out_type'] == 'bs fak forward':
  3871. if own['gt_cd2'] > 50:
  3872. if STANCE == True:
  3873. own.applyForce([bsforce, 0, 0], True)
  3874. if STANCE == False:
  3875. own.applyForce([bsforce, 0, 0], True)
  3876. own.applyMovement([bs_dloc,0,0], True)
  3877. if own['grind_out_type'] == 'bs fak back' or own['grind_out_type'] == 'bs reg forward':
  3878. if own['gt_cd2'] > 50:
  3879. if STANCE == True:
  3880. own.applyForce([-bsforce, 0, 0], True)
  3881. if STANCE == False:
  3882. own.applyForce([-bsforce, 0, 0], True)
  3883. own.applyMovement([-bs_dloc,0,0], True)
  3884. #print("setting linvel", own.linearVelocity, outvel)
  3885. if own['gt_cd2'] > 0:
  3886. own['gt_cd2'] -= 1
  3887. if own['gt_cd2'] == 0:
  3888. own['grind_out_type'] = None
  3889. #print(own['grind_out_type'])
  3890. #print(own["gt_cd"])
  3891. if own["grindoutturn"] > 0:
  3892. own["grindoutturn"] = own["grindoutturn"] - 1
  3893. def air_height():
  3894. height = own["air_height"]
  3895. if lf_ground == True and r_ground.triggered == False:
  3896. height = 0
  3897. #if
  3898. #wallride
  3899. def wallride():
  3900. wallride_off = own['wallride_off']
  3901. distance = own.getDistanceTo(gray.hitPosition)
  3902. upforce = 25
  3903. sideforce = 15
  3904. #distance = own["air_height"]
  3905. try:
  3906. obj = gray.hitObject
  3907. objpos = obj.worldPosition
  3908. ownpos = own.worldPosition
  3909. distance = ownpos.z - objpos.z
  3910. #print(distance)
  3911. except:
  3912. pass
  3913. if wallrideL.triggered and wallride_off == 0 and r_ground.triggered == False:
  3914. #print("wallrideL", distance)
  3915. own['jump_timer'] = 0
  3916. if r_ground.triggered == False:
  3917. own["wallride"] = "L"
  3918. #print(own["wallride"])
  3919. cont.activate(wallrideconstL)
  3920. force = [0,sideforce,upforce]
  3921. own.applyForce(force,1)
  3922. #own.alignAxisToVect(obj.worldPosition, 1, .9)
  3923. #align
  3924. if STANCE == 0:
  3925. skater.playAction("reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3926. else:
  3927. skater.playAction("fak_wall_l", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3928. deck.playAction("a_reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3929. trucks.playAction("a_reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3930. else:
  3931. if own["wallride"] != "R":
  3932. own["wallride"] = None
  3933. cont.deactivate(wallrideconstL)
  3934. killact(3000)
  3935. killact(3001)
  3936. killact(3002)
  3937. if wallrideR.triggered and wallride_off == 0:
  3938. own['jump_timer'] = 0
  3939. #print("wallrideR", distance)
  3940. if r_ground.triggered == False:
  3941. own["wallride"] = "R"
  3942. cont.activate(wallrideconstR)
  3943. force = [0,-sideforce,upforce]
  3944. own.applyForce(force,1)
  3945. #own.alignAxisToVect(obj.worldPosition, 1, .9)
  3946. if STANCE == 0:
  3947. skater.playAction("reg_wall_l", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3948. else:
  3949. skater.playAction("fak_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3950. deck.playAction("a_reg_wall_l2", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3951. trucks.playAction("a_reg_wall_l2", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3952. else:
  3953. if own["wallride"] != "L":
  3954. own["wallride"] = None
  3955. cont.deactivate(wallrideconstR)
  3956. killact(3003)
  3957. killact(3004)
  3958. killact(3005)
  3959. def wallride_sound():
  3960. sact = own.actuators["wallSound"]
  3961. if own["wallride"] != None:
  3962. sact.volume = .2
  3963. cont.activate(own.actuators["wallSound"])
  3964. else:
  3965. sact.volume = .001
  3966. sact.stopSound()
  3967. if own['revert_timer'] > 0:
  3968. own['revert_timer'] = own['revert_timer'] - 1
  3969. def shutoff_timers():
  3970. #print(wallride)
  3971. if (LAST_GRIND == False and grindHit == True) or (jump_timer > 10 and own['wallride'] == None):
  3972. own["Q1oncd"] = 0
  3973. own["Q2oncd"] = 0
  3974. own["Q3oncd"] = 0
  3975. own["Q4oncd"] = 0
  3976. own["Q5oncd"] = 0
  3977. own["Q6oncd"] = 0
  3978. own["Q7oncd"] = 0
  3979. own["Q8oncd"] = 0
  3980. def grindout_cleanup():
  3981. lgf = own['last_grind_frame']
  3982. def trans_jump():
  3983. if own['jump_from_trans'] == 1:
  3984. ground_ray = cont.sensors['ground_look']
  3985. jump_obj = own['trans_jump_obj']
  3986. jump_obj = scene.objects[str(own['trans_jump_obj'])]
  3987. #print(jump_obj)
  3988. worldVect = [1, 0, 0]
  3989. vect = jump_obj.getAxisVect(worldVect)
  3990. go = jump_obj.worldOrientation
  3991. grinder_axis = [0,1,0]
  3992. player_pos = own.worldPosition
  3993. jump_obj = jump_obj.worldPosition
  3994. try:
  3995. delta = player_pos - jump_obj
  3996. except:
  3997. #print("delta broke: ", player_pos, grinder_pos)
  3998. pass
  3999. delta = delta.cross(vect)
  4000. deltamove = delta[1] * .25
  4001. move = [deltamove, 0, 0]
  4002. #print(deltamove)
  4003. if abs(deltamove) < 1 and delta[1] < 1:
  4004. own.applyMovement(move, True)
  4005. #print(deltamove, delta, "delta.......")
  4006. #pos = ground_ray.hitPosition
  4007. #print(pos)
  4008. #linvelloc6 = own.getLinearVelocity(True)
  4009. #xvel6 = linvelloc6.x * .95
  4010. #force = (xvel6, linvelloc6.y, linvelloc6.z)
  4011. #own.setLinearVelocity(force, True)
  4012. #control_calib() #scene must be enabled in main
  4013. jump_Timer()
  4014. check_landing()
  4015. #SWAG()
  4016. #isplaying()
  4017. nextframe()
  4018. wheelroll()
  4019. rollsound()
  4020. reset_pos()
  4021. ylimit()
  4022. getoffboard()
  4023. #switchcam()
  4024. move_flycam()
  4025. move_followcam()
  4026. grind_turn()
  4027. air_height()
  4028. wallride()
  4029. wallride_sound()
  4030. shutoff_timers()
  4031. grindout_cleanup()
  4032. #trans_jump()
  4033. #printplaying()
  4034. #transmult()
  4035. linvelx = own.getLinearVelocity(True)
  4036. #print(linvelx)
  4037. own["linvelx"] = linvelx.x
  4038. LAST_STANCE = STANCE
  4039. LAST_STANCE = own["stance"]
  4040. own["last_stance"] = STANCE
  4041. own["lastGrab"] = GRAB_ON
  4042. own['ground'] = r_ground.triggered
  4043. own['last_ground'] = r_ground.triggered
  4044. own["LAST_GRIND"] = grindHit
  4045. own["rotz"] = rot.z
  4046. own['walk'] = 0
  4047. own['lasty'] = yBut
  4048. own['lastlts'] = ltsBut
  4049. own['lastrts'] = rtsBut
  4050. own["lF_ground2"] = own["lF_ground"]
  4051. own['last_invert'] = invert_on
  4052. own['lastbkBut'] = bkBut
  4053. own['grab_type'] = grab_type
  4054. own['last_last_manual'] = own['last_manual']
  4055. own['last_manual'] = own['manual']
  4056. own['last_reg_manual'] = own['reg_manual']
  4057. own['last_fak_manual'] = own['fak_manual']
  4058. own['last_fak_nmanual'] = own['fak_nmanual']
  4059. own['last_reg_nmanual'] = own['reg_nmanual']
  4060. if own['manual'] == 1:
  4061. own['last_manual_frame'] = frame
  4062. #print(own['hippy'], own['last_hippy'])
  4063. own['last_hippy'] = own['hippy']
  4064. #last pressed down frame
  4065. if aBut == 1 and own["lasta"] == 0:
  4066. own["lastaf"] = frame
  4067. if xBut == 1 and own["lastx"] == 0:
  4068. own["lastxf"] = frame
  4069. own["lasta"] = aBut
  4070. own["lastx"] = xBut
  4071. own['lastaBut_ground'] = aBut_ground
  4072. own['lastxBut_ground'] = xBut_ground
  4073. own["last_sel"] = own["sel"]
  4074. own["sel"] = bkBut
  4075. if r_ground.triggered and own["jump_timer"] < 20:
  4076. force2 = [0.0, 0, -10]
  4077. own.applyForce(force2, True)
  4078. #print('grindtouch = ', own['grindTouch'])
  4079. if grindDar == False and r_ground.triggered and own['grindTouch'] == False:
  4080. own['grindType'] = ''