123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065 |
- #shuvit.org
- #walk.py
-
- import bge
- import GameLogic
- import ctypes
- import random
- import math
-
- def main(cont):
- pass
-
- #---------------------------------------------------
-
-
-
- # scene = bge.logic.getCurrentScene()
- # objList = scene.objects
- # cont = GameLogic.getCurrentController()
- # obj = bge.logic.getCurrentScene().objects
- # char = bge.constraints.getCharacter
- # own = cont.owner
- # stance = own['stance']
- # STANCE = own['stance']
- # r_ground = cont.sensors["r_Ground"]
- # linvel = own.getLinearVelocity(True)
- # lasta = own['lasta']
- # lastx = own['lastx']
- # last_sit = own['sit']
- # dict = bge.logic.globalDict
-
- # try:
- # own['walk_timer'] = own['walk_timer'] +1
- # except:
- # own['walk_timer'] = 1
- # own['walk_targ_speed'] = 2.0
-
- # truckon = 450
- # deckon = 460
-
- # lLR = dict['lLR']
- # lUD = dict['lUD']
- # rLR = dict['rLR']
- # rUD = dict['rUD']
- # lTrig = dict['lTrig']
- # rTrig = dict['rTrig']
- # aBut = dict['aBut']
- # bBut = dict['bBut']
- # xBut = dict['xBut']
- # yBut = dict['yBut']
- # lBump = dict['lBump']
- # rBump = dict['rBump']
- # bkBut = dict['bkBut']
- # stBut = dict['stBut']
- # xbBut = dict['xbBut']
- # ltsBut = dict['ltsBut']
- # rtsBut = dict['rtsBut']
- # ldPad = dict['ldPad']
- # rdPad = dict['rdPad']
- # udPad = dict['udPad']
- # ddPad = dict['ddPad']
-
- # #user
- # sens = .04
- # fliplay = 30
- # dropinCol = own.sensors['dropinCol']
- # cube = scene.objects['control_cube.002']
- # skater = scene.objects["Char4"]
- # deck = scene.objects["b_deck"]
- # trucks = scene.objects["b_trucks"]
- # camobj2 = scene.objects['camobj']
- # throw_deck_empty = scene.objects["throw_deck_empty"]
- # wheel1 = scene.objects["wheel1"]
- # wheel2 = scene.objects["wheel2"]
- # wheel3 = scene.objects["wheel3"]
- # wheel4 = scene.objects["wheel4"]
- # camobj = scene.objects["Camera.003"]
- # camera = cont.actuators["Camera"]
- # replayCam = cont.actuators["replayCam"]
- # timer = own['dropinTimer']
- # cam = scene.objects["Camera.003"]
- # freecam = scene.objects["freecam"]
- # followcam = scene.objects["followcam"]
-
- # control_bottom = scene.objects['control_bottom']
- # cb = control_bottom.sensors['grindCol_bottom']
- # cb_td = control_bottom.sensors['td_bottom']
-
- # noidle = 0
-
- # #if skater.isPlayingAction(460):
- # # noidle = 1
-
-
- # try:
- # walk_inc = own['walk_inc']
- # except:
- # own['walk_inc'] = .01
- # walk_inc = own['walk_inc']
- # own['walk_jump_timer'] = 0
- # if own['stair_counter'] != 0:
- # walk_inc = own['walk_inc'] *10
-
- # if own["stance"] == None:
- # own["stance"] = True
- # STANCE = own["stance"]
- # def killact(layer):
- # if skater.isPlayingAction(layer):
- # skater.stopAction(layer)
- # if deck.isPlayingAction(layer):
- # deck.stopAction(layer)
- # if trucks.isPlayingAction(layer):
- # trucks.stopAction(layer)
- # def killall():
- # for x in range(5000):
- # skater.stopAction(x)
- # deck.stopAction(x)
- # trucks.stopAction(x)
- # def trucksisplaying():
- # for x in range(5000):
- # if deck.isPlayingAction(x):
- # print("deck is playing:", x)
-
- # def printplaying():
- # splaying_layers = "S: "
- # playing_layers = "D: "
- # tplaying_layers = "T: "
- # for x in range(9900):
- # if skater.isPlayingAction(x):
- # #if trucks.isPlayingAction(x):
- # #if skater.isPlayingAction(x):
- # splaying_layers += str(x)
- # splaying_layers += " "
- # if deck.isPlayingAction(x):
- # #if trucks.isPlayingAction(x):
- # #if skater.isPlayingAction(x):
- # playing_layers += str(x)
- # playing_layers += " "
- # if trucks.isPlayingAction(x):
- # #if trucks.isPlayingAction(x):
- # #if skater.isPlayingAction(x):
- # tplaying_layers += str(x)
- # tplaying_layers += " "
- # print(splaying_layers, playing_layers, tplaying_layers)
- # #printplaying()
- # ##
- # if r_ground.positive and xBut == False and lastx == False:
- # killact(10)
- # #killact(11)
- # killact(12)
- # killact(13)
- # ######################################
-
- # #idle
- # #if stance == 0 and skater.isPlayingAction(fliplay) == False and yBut == False and r_ground.triggered and xBut == False and noidle == 0 and own['walk_idling'] == 0 and own['sit'] == 0 and own['dropinTimer'] == 0 and own['lasty'] == False:
- # #own['requestAction'] = 'reg_idle'
- # #if own['throw_deck'] == True:
- # #own['requestAction'] = 'reg_idle_nb'
-
- # #if stance == 1 and skater.isPlayingAction(fliplay) == False and yBut == False and r_ground.triggered and xBut == False and noidle == 0 and own['walk_idling'] == 0 and own['sit'] == 0 and own['dropinTimer'] == 0 and own['lasty'] == False:
- # #own['requestAction'] = 'fak_idle'
- # #if own['throw_deck'] == True:
- # #own['requestAction'] = 'fak_idle_nb'
-
- # if lUD < -sens:
- # lup = 1
- # else:
- # lup = 0
- # if lUD > sens:
- # ldown = 1
- # else:
- # ldown = 0
- # if lLR < -sens:
- # lLeft = 1
- # else:
- # lLeft = 0
- # if lLR > sens:
- # lRight = 1
- # else:
- # lRight = 0
-
-
-
- # #turning
- # walk_turn_amt = .005#.05
- # turning = False
- # if r_ground.positive:
- # num = .4#.5
- # tilt = .015
- # if STANCE == 1:
- # num *= -1
- # tilt *= -1
- # if lRight == 1 or dict['kb_ra'] == 2:
- # #cont.activate(own.actuators['right'])
- # own.linearVelocity.y = num
- # if own['stair_counter'] > 0:
- # if STANCE == 0:
- # own.applyRotation([0,0,walk_turn_amt], True)
- # else:
- # own.applyRotation([0,0,-walk_turn_amt], True)
- # else:
- # own.applyRotation([-tilt, 0, 0], True)
- # turning = True
- # else:
- # #cont.deactivate(own.actuators['right'])
- # pass
-
- # if lLeft == 1 or dict['kb_la'] == 2:
- # #cont.activate(own.actuators['left'])
- # own.linearVelocity.y = -num
- # if own['stair_counter'] > 0:
- # if STANCE == 0:
- # own.applyRotation([0,0,walk_turn_amt], True)
- # else:
- # own.applyRotation([0,0,-walk_turn_amt], True)
- # else:
- # own.applyRotation([tilt, 0, 0], True)
- # turning = True
- # else:
- # #cont.deactivate(own.actuators['left'])
- # pass
-
- # #in air
- # #if (lup == 1 or dict['kb_ua'] != 0) and r_ground.positive == False:
- # if r_ground.positive == False:
- # airrot = .05
- # if lLeft == 1 or dict['kb_la'] == 2:
- # if stance == 0:
- # own.applyRotation([0,0,airrot], True)
- # if stance == 1:
- # own.applyRotation([0,0,airrot], True)
- # if lRight == 1 or dict['kb_ra'] == 2:
- # if stance == 0:
- # own.applyRotation([0,0,-airrot], True)
- # if stance == 1:
- # own.applyRotation([0,0,-airrot], True)
-
- # if lup == 1 or dict['kb_ua'] == 2:
- # if own.linearVelocity.x < 10 and own .linearVelocity.x > - 10:
- # if stance == 0:
- # own.linearVelocity.x -= .04
- # if stance == 1:
- # own.linearVelocity.x += .04
- # own['lF_air_frame'] = own['framenum']
- # own.actuators["walkondirt"].stopSound()
-
-
- # #walking
-
- # #new walking
- # vel = own.getLinearVelocity(True)
- # if own['walk_timer'] < 50:
- # velx = vel.x * .95
- # own.setLinearVelocity([velx, 0, vel.z], True)
- # #print('y is zero')
- # else:
- # pass
- # #own.setLinearVelocity([0, 0, vel.z], True)
-
- # wf = 1
- # if own['last_walk_frame'] - own['last_roll_frame'] > 55:
- # wf = 0
-
- # if ((lup == 1 and aBut == 0) or (dict['kb_ua'] == 2 and dict['kb_lsh'] == 0)) and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0 and wf == 0 and dict['kb_space'] == 0:
- # own['walking'] = "regular"
- # walking = "regular"
-
- # elif ((lup == 1 and aBut == 1) or (dict['kb_lsh'] == 2 and dict['kb_ua'] == 2)) and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0 and wf == 0 and dict['kb_space'] != 2:
- # own['walking'] = "fast"
- # walking = "fast"
- # else:
- # own['walking'] = None
- # walking = None
-
- # if walking == "regular":
- # if stance == 1:
- # if linvel.x < own['walk_targ_speed']:
- # own.linearVelocity.x = linvel.x + walk_inc
- # else:
- # own.linearVelocity.x = own['walk_targ_speed']
- # else:
- # if linvel.x > -own['walk_targ_speed']:
- # own.linearVelocity.x = linvel.x - walk_inc
- # else:
- # own.linearVelocity.x = -own['walk_targ_speed']
- # if walking == "fast":
- # if stance == 1:
- # if linvel.x < own['walk_fast_targ_speed']:
- # own.linearVelocity.x = linvel.x + walk_inc
- # else:
- # own.linearVelocity.x = own['walk_fast_targ_speed']
- # else:
- # if linvel.x > -own['walk_fast_targ_speed']:
- # own.linearVelocity.x = linvel.x - walk_inc
- # else:
- # own.linearVelocity.x = -own['walk_fast_targ_speed']
-
- # if walking == None and r_ground.positive and own['walk_jump_timer'] == 0:
- # if own['walk_timer'] < 50 and turning == False:
- # velx = vel.x * .95
- # own.setLinearVelocity([velx, 0, vel.z], True)
- # elif own['walk_timer'] > 50:
- # if own.linearVelocity.x > .1 or own.linearVelocity.x < -.1:
- # own.linearVelocity.x *= .01
- # else:
- # own.linearVelocity.x = 0
- # if turning == False:
- # if own.linearVelocity.y > .01 or own.linearVelocity.y < -.01:
- # own.linearVelocity.y *= .01
- # else:
- # own.linearVelocity.y = 0
- # #own.setLinearVelocity([0, 0, vel.z], True)
-
- # #old walking
- # if ((lup == 1 and aBut == 0) or (dict['kb_ua'] == 2 and dict['kb_lsh'] == 0) and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0) or (turning == True and aBut == 0):
- # own.actuators["walkondirt"].volume = .2
- # own.actuators["walkondirt"].pitch = 1
- # cont.activate(own.actuators["walkondirt"])
- # if stance == 0 and skater.isPlayingAction(fliplay) == False:
- # #without deck
- # if own['throw_deck'] == True:
- # own['requestAction'] = 'reg_walk_nb'
- # else:
- # own['requestAction'] = 'reg_walk'
-
- # if stance == 1 and skater.isPlayingAction(fliplay) == False:
- # #without deck
- # if own['throw_deck'] == True:
- # own['requestAction'] = 'fak_walk_nb'
- # else:
- # own['requestAction'] = 'fak_walk'
-
- # elif (((lup == 1 and aBut == 1) or (dict['kb_lsh'] == 2 and dict['kb_ua'] == 2)) and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0) or (turning == True and aBut == 1):
- # own.actuators["walkondirt"].volume = .2
- # #own.actuators["walkondirt"].pitch = 1.3
- # own.actuators["walkondirt"].pitch = 2
- # cont.activate(own.actuators["walkondirt"])
- # #print('fastwalk')
- # if stance == 0 and skater.isPlayingAction(fliplay) == False:
- # if own['throw_deck'] == True:
- # own['requestAction'] = 'reg_walkFast_nb'
- # else:
- # own['requestAction'] = 'reg_walkFast'
-
- # if stance == 1 and skater.isPlayingAction(fliplay) == False:
- # if own['throw_deck'] == True:
- # own['requestAction'] = 'fak_walkFast_nb'
- # else:
- # own['requestAction'] = 'fak_walkFast'
- # else:
- # vel = own.getLinearVelocity(True)
- # cont.deactivate(own.actuators["walkondirt"])
-
-
- # #---------------
- # if rLR > .05:
- # cont.activate(camobj.actuators['camRight'])
- # else:
- # cont.deactivate(camobj.actuators['camRight'])
- # if rLR < -.05:
- # cont.activate(camobj.actuators['camLeft'])
- # else:
- # cont.deactivate(camobj.actuators['camLeft'])
- # if rUD > .05:
- # cont.activate(camobj.actuators['camDown'])
- # else:
- # cont.deactivate(camobj.actuators['camDown'])
- # if rUD < -.05:
- # cont.activate(camobj.actuators['camUp'])
- # else:
- # cont.deactivate(camobj.actuators['camUp'])
-
- # #----------------
- # #camera.height = .01 #.9
- # #camera.min = 1.75
- # #camera.max = 2.25
- # lasty = own['lasty']
-
- # def onboard():
- # if own['walk'] == 0:
- # print("start walking")
- # own['walk_idling'] = 0
- # if own['framenum'] > 100 and own['fall'] == False:
- # #cont.activate(own.actuators['pop'])
- # camobj['sndmgr'].queue_sound(['pop', cube, camobj])
- # own['getoffboard'] = False
- # own["walk_idle_frame"] = own["framenum"]
- # own['grindcement_vol'] = 0
- # own['grindcement_pitch'] = 0
- # own['grindrail_vol'] = 0
- # own['grindrail_pitch'] = 0
- # own['sroll_vol'] = 0
- # own['sroll_pitch'] = 0
-
-
- # #camobj.worldPosition.z += 4
- # try:
- # vel = own['offboard_vel']
- # vel = [velx, vel.y, vel.z]
- # except:
- # pass
-
- # if STANCE == 0:
- # #own['requestAction'] = 'reg_offboard'
- # print('requesting off board')
-
- # #if STANCE == 1:
- # #own['requestAction'] = 'fak_offboard'
- # def jump():
- # pass
- # # #limit fall speed
- # # if linvel.z < -10:
- # # own.linearVelocity.z = -10
- # # if xBut == True or dict['kb_space'] == 1:
- # # if own['lastx'] == 0:
- # # #killact(3)
- # # #killact(4)
- # # #killact(5)
- # # #killact(6)
- # # #killact(7)
- # # if STANCE == 0:
- # # own['requestAction'] ='reg_jump'
- # # #print('jump')
- # # if STANCE == 1:
- # # own['requestAction'] ='fak_jump'
- # # #print('jump')
- # # JUMPHEIGHT = 1100
- # # force = [ 0.0, 0.0, JUMPHEIGHT]
- # # # use local axis
- # # local = False
- # # # apply force -- limit jump speed
- # # if linvel.z < 10:
- # # #own.applyForce(force, local)
- # # own.linearVelocity.z += 5
- # # own.linearVelocity.x = linvel.x
- # # own.linearVelocity.y = linvel.y
- # # own['walk_jump_timer'] = 6
- # # own['lastx'] = 1
- # # else:
- # # own['lastx'] = 0
-
- # def getonboard(dict, cont):
- # grindDar = cont.sensors['grindDar2']
- # getonboard = own['getonboard']
- # fliplay2 = 50#8560
- # if ((yBut == True and dict['last_yBut'] == False) or dict['kb_q'] == 2):# and (cont.sensors["vehicleNear"].positive == False and own['throw_deck'] == False):
- # fliplay3 = fliplay2 + 1
- # dar = 0
- # if grindDar.hitObjectList != None:
- # for x in grindDar.hitObjectList:
- # to_grinder = (x.worldPosition - own.worldPosition).length
- # #if 'coping' in x and to_grinder < .36:
- # if 'coping' in x:
- # dar = 1
- # if dropinCol.positive == True or dar == 1:
- # nearestObject = None
- # grindEmpty = scene.objects['grindEmpty']
- # grindDar = grindEmpty.sensors['grindDar2']
- # minDist = None
- # if grindDar.positive:
- # detectedObjects = grindDar.hitObjectList
- # dist = 0
- # for obj in detectedObjects:
- # dist = own.getDistanceTo(obj)
- # if (minDist is None or dist < minDist):
- # nearestObject = obj
- # minDist = dist
-
- # print('dropin')
- # if STANCE == 0:
- # own['requestAction'] ='reg_dropin'
- # own['dropinTimer'] = 60
-
- # if STANCE == 1:
- # own['requestAction'] ='fak_dropin'
- # own['dropinTimer'] = 60
-
- # if getonboard == 1:
- # fliplay3 = 6000
- # onboard_speed = .1
- # own['getonboard'] = 0
- # own['walk_idling'] = 0
- # if (yBut == False and lasty == True) or (yBut == True or dict['kb_q'] == 3) and dropinCol.positive:
- # print('getting on board')
- # deckact = deck.actuators["Visibility"]
- # trucksact = trucks.actuators["Visibility"]
- # wheel1act = wheel1.actuators["Visibility"]
- # wheel2act = wheel2.actuators["Visibility"]
- # wheel3act = wheel3.actuators["Visibility"]
- # wheel4act = wheel4.actuators["Visibility"]
- # deckact.visibility = True
- # trucksact.visibility = True
- # wheel1act.visibility = True
- # wheel2act.visibility = True
- # wheel3act.visibility = True
- # wheel4act.visibility = True
- # cont.activate(deck.actuators['Visibility'])
- # cont.activate(trucks.actuators['Visibility'])
- # cont.activate(wheel1.actuators['Visibility'])
- # cont.activate(wheel2.actuators['Visibility'])
- # cont.activate(wheel3.actuators['Visibility'])
- # cont.activate(wheel4.actuators['Visibility'])
- # own['throw_deck'] = False
- # throw_deck_empty = scene.objects["throw_deck_empty"]
- # throw_deck_empty['kill_deck'] = 1
- # if ((yBut == False and lasty == True) or dict['kb_q'] == 3):# and cont.sensors["vehicleNear"].positive == False:
- # print('secondary get on board')
- # own['getonboard'] = 1
- # own['walk_idling'] = 0
- # deckact = deck.actuators["Visibility"]
- # trucksact = trucks.actuators["Visibility"]
- # wheel1act = wheel1.actuators["Visibility"]
- # wheel2act = wheel2.actuators["Visibility"]
- # wheel3act = wheel3.actuators["Visibility"]
- # wheel4act = wheel4.actuators["Visibility"]
- # deckact.visibility = True
- # trucksact.visibility = True
- # wheel1act.visibility = True
- # wheel2act.visibility = True
- # wheel3act.visibility = True
- # wheel4act.visibility = True
- # cont.activate(deck.actuators['Visibility'])
- # cont.activate(trucks.actuators['Visibility'])
- # cont.activate(wheel1.actuators['Visibility'])
- # cont.activate(wheel2.actuators['Visibility'])
- # cont.activate(wheel3.actuators['Visibility'])
- # cont.activate(wheel4.actuators['Visibility'])
- # own['throw_deck'] = False
- # throw_deck_empty = scene.objects["throw_deck_empty"]
- # throw_deck_empty['kill_deck'] = 1
-
-
-
- # def nextframe():
- # framenumber = own["framenum"]
- # framenumber = framenumber + 1
- # if framenumber == 900000:
- # framenumber = 0
- # own["framenum"] = framenumber
- # own['last_walk_frame'] = framenumber
-
- # def checkidle():
- # idle = cont.sensors["idle"]
- # idle_frame = own["walk_idle_frame"]
- # if idle.positive:
- # own["walk_idle_frame"] = 0
- # cont.deactivate(camobj.actuators['idle_camRight'])
- # #camera.height = .5
- # camera.height = dict['cam_idle_height']
- # else:
- # if idle_frame == 0:
- # own["walk_idle_frame"] = own["framenum"]
- # diff = own["framenum"] - idle_frame
-
- # if (diff > 700 and idle_frame != 0 and dropinCol.positive == False and own['walk'] != 0) or own['sit'] == 1:
- # cont.activate(camobj.actuators['idle_camRight'])
- # #camera.height = .9
- # #camera.min = 2
- # #camera.max = 2.50
- # own['walk_idling'] = 1
- # else:
- # own['walk_idling'] = 0
-
- # def idle_anim():
- # if own['walk_idling'] == 1 and own['sit'] == 0:
- # walk_idle_frame = own['walk_idle_frame']
- # mod_num = (own["framenum"] - walk_idle_frame) % 240
- # idle_lay = 300
- # if mod_num == 0:
- # if own['idle_skipper'] > 0:
- # own['idle_skipper'] -= 1
- # ran_num = random.randint(1, 8)
- # if own['last_idle_num'] == ran_num:
- # ran_num = 1
- # if own['idle_skipper'] == 0:
- # own['last_idle_num'] = ran_num
- # if ran_num == 1 or ran_num > 7:
- # killact(3)
- # if STANCE == 0 and own['throw_deck'] == 0:
- # own['requestAction'] = 'reg_idle1'
- # elif STANCE == 0 and own['throw_deck'] == 1:
- # own['requestAction'] = 'reg_idle1'
- # elif STANCE == 1 and own['throw_deck'] == 0:
- # own['requestAction'] = 'fak_idle1'
- # elif STANCE == 1 and own['throw_deck'] == 1:
- # own['requestAction'] = 'fak_idle1'
-
- # elif ran_num == 2:
- # killact(3)
- # if STANCE == 0 and own['throw_deck'] == 0:
- # own['requestAction'] = 'reg_idle2'
- # elif STANCE == 0 and own['throw_deck'] == 1:
- # own['requestAction'] = 'reg_idle2_nb'
- # elif STANCE == 1 and own['throw_deck'] == 0:
- # own['requestAction'] = 'fak_idle1'
- # elif STANCE == 1 and own['throw_deck'] == 1:
- # own['requestAction'] = 'fak_idle1'
- # elif ran_num == 3:
- # killact(3)
- # if STANCE == 0 and own['throw_deck'] == 0:
- # own['requestAction'] = 'reg_idle3'
- # elif STANCE == 0 and own['throw_deck'] == 1:
- # own['requestAction'] = 'reg_idle3'
- # elif STANCE == 1 and own['throw_deck'] == 0:
- # own['requestAction'] = 'fak_idle1'
- # elif STANCE == 1 and own['throw_deck'] == 1:
- # own['requestAction'] = 'fak_idle1'
- # own['idle_skipper'] = 2
- # elif ran_num == 4:
- # killact(3)
- # if STANCE == 0 and own['throw_deck'] == 0:
- # own['requestAction'] = 'reg_idle4'
- # elif STANCE == 0 and own['throw_deck'] == 1:
- # own['requestAction'] = 'reg_idle4'
- # elif STANCE == 1 and own['throw_deck'] == 0:
- # own['requestAction'] = 'fak_idle4'
- # elif STANCE == 1 and own['throw_deck'] == 1:
- # own['requestAction'] = 'fak_idle4'
- # elif ran_num == 5:
- # killact(3)
- # if STANCE == 0 and own['throw_deck'] == 0:
- # own['requestAction'] = 'reg_idle5'
- # elif STANCE == 0 and own['throw_deck'] == 1:
- # own['requestAction'] = 'reg_idle5'
- # elif STANCE == 1 and own['throw_deck'] == 0:
- # own['requestAction'] = 'fak_idle5'
- # elif STANCE == 1 and own['throw_deck'] == 1:
- # own['requestAction'] = 'fak_idle5'
- # elif ran_num == 6:
- # killact(3)
- # if STANCE == 0 and own['throw_deck'] == 0:
- # own['requestAction'] = 'reg_idle6'
- # elif STANCE == 0 and own['throw_deck'] == 1:
- # own['requestAction'] = 'reg_idle6'
- # elif STANCE == 1 and own['throw_deck'] == 0:
- # own['requestAction'] = 'fak_idle6'
- # elif STANCE == 1 and own['throw_deck'] == 1:
- # own['requestAction'] = 'fak_idle6'
- # elif ran_num == 7:
- # killact(3)
- # if STANCE == 0 and own['throw_deck'] == 0:
- # own['requestAction'] = 'reg_idle7'
- # elif STANCE == 0 and own['throw_deck'] == 1:
- # own['requestAction'] = 'reg_idle7'
- # elif STANCE == 1 and own['throw_deck'] == 0:
- # own['requestAction'] = 'fak_idle6'
- # elif STANCE == 1 and own['throw_deck'] == 1:
- # own['requestAction'] = 'fak_idle6'
-
- # def reset_pos():
- # #reset
- # if ddPad == 1:
- # spawn_pos = own['spawn_pos']
- # spawn_rot = own['spawn_rot']
- # spawn_cam_pos = own['spawn_cam_pos']
- # spawn_cam_rot = own['spawn_cam_rot']
- # try:
- # own.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .1))
- # 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]]
- # cam.worldPosition = (spawn_cam_pos[0], spawn_cam_pos[1], (spawn_cam_pos[2]))
- # cam.worldOrientation = [[spawn_cam_rot[0][0],spawn_cam_rot[0][1],spawn_cam_rot[0][2]], [spawn_cam_rot[1][0],spawn_cam_rot[1][1],spawn_cam_rot[1][2]], [0.0, 0.0, 1.0]]
- # except:
- # own.worldPosition = (5, 2, .1)
- # own.worldOrientation = [[1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
- # own['stance'] = own['spawn_stance']
- # if own["spawn_stance"] == 1:
- # own.setLinearVelocity([.1,0,0], 1)
- # else:
- # own.setLinearVelocity([-.1,0,0], 1)
-
- # if udPad == 1:
- # own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]]
- # 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]]
- # own['spawn_cam_pos'] = [cam.worldPosition[0], cam.worldPosition[1], cam.worldPosition[2]]
- # own['spawn_cam_rot'] = [[cam.worldOrientation[0][0],cam.worldOrientation[0][1],cam.worldOrientation[0][2]], [cam.worldOrientation[1][0],cam.worldOrientation[1][1],cam.worldOrientation[1][2]], cam.worldOrientation[2][2]]
- # stance = own["stance"]
- # own["spawn_stance"] = stance
- # def falldeck():
- # throw_deck_empty = scene.objects["throw_deck_empty"]
- # throw_deck_empty.worldPosition.y += .5
- # throw_deck_empty.worldPosition.x += .5
- # deckact = deck.actuators["Visibility"]
- # trucksact = trucks.actuators["Visibility"]
- # wheel1act = wheel1.actuators["Visibility"]
- # wheel2act = wheel2.actuators["Visibility"]
- # wheel3act = wheel3.actuators["Visibility"]
- # wheel4act = wheel4.actuators["Visibility"]
- # print('doing falldeck')
- # if own['throw_deck'] == False:
- # own['throw_deck'] = True
- # deckact.visibility = False
- # trucksact.visibility = False
- # wheel1act.visibility = False
- # wheel2act.visibility = False
- # wheel3act.visibility = False
- # wheel4act.visibility = False
- # act = throw_deck_empty.actuators['throw_dec_act']
- # if STANCE == True:
- # act.linearVelocity = [0.0, 1.0, 1.0]
- # if STANCE == False:
- # act.linearVelocity = [0.0, 1.0, -1.0]
- # cont.activate(act)
- # print('running falldeck()')
- # else:
- # own['throw_deck'] = False
- # deckact.visibility = True
- # trucksact.visibility = True
- # wheel1act.visibility = True
- # wheel2act.visibility = True
- # wheel3act.visibility = True
- # wheel4act.visibility = True
- # throw_deck_empty['kill_deck'] = 1
- # cont.activate(deck.actuators['Visibility'])
- # cont.activate(trucks.actuators['Visibility'])
- # cont.activate(wheel1.actuators['Visibility'])
- # cont.activate(wheel2.actuators['Visibility'])
- # cont.activate(wheel3.actuators['Visibility'])
- # cont.activate(wheel4.actuators['Visibility'])
-
- # def throwdeck(strength, ud):
- # throw_deck_empty = scene.objects["throw_deck_empty"]
- # deckact = deck.actuators["Visibility"]
- # trucksact = trucks.actuators["Visibility"]
- # wheel1act = wheel1.actuators["Visibility"]
- # wheel2act = wheel2.actuators["Visibility"]
- # wheel3act = wheel3.actuators["Visibility"]
- # wheel4act = wheel4.actuators["Visibility"]
-
- # if own['throw_deck'] == False:
- # own['throw_deck'] = True
- # deckact.visibility = False
- # trucksact.visibility = False
- # wheel1act.visibility = False
- # wheel2act.visibility = False
- # wheel3act.visibility = False
- # wheel4act.visibility = False
- # act = throw_deck_empty.actuators['throw_dec_act']
- # hard = strength * .08
- # if hard > 9:
- # hard = 9
- # if hard < 1:
- # hard = 1
- # ud = ud * 4
- # own['bbut_timer'] = 0
- # if STANCE == True:
- # own['requestAction'] = 'fak_throw'
- # act.linearVelocity = [0.0, ud, hard]
- # if STANCE == False:
- # own['requestAction'] = 'fak_throw'
- # act.linearVelocity = [0.0, ud, -hard]
- # cont.activate(act)
- # else:
- # own['throw_deck'] = False
- # deckact.visibility = True
- # trucksact.visibility = True
- # wheel1act.visibility = True
- # wheel2act.visibility = True
- # wheel3act.visibility = True
- # wheel4act.visibility = True
- # throw_deck_empty['kill_deck'] = 1
- # cont.activate(deck.actuators['Visibility'])
- # cont.activate(trucks.actuators['Visibility'])
- # cont.activate(wheel1.actuators['Visibility'])
- # cont.activate(wheel2.actuators['Visibility'])
- # cont.activate(wheel3.actuators['Visibility'])
- # cont.activate(wheel4.actuators['Visibility'])
- # def throwdeck_trigger():
- # lastb = own['lastb']
- # throw_deck_empty = scene.objects["throw_deck_empty"]
- # if bBut == True:
- # own['bbut_timer'] += 1
- # ud = (rUD * 10) +1
- # if bBut == False:
- # throw_deck_empty['kill_deck'] = 0
- # if bBut == False and own['lastb'] == True:
- # strength = own['bbut_timer']
- # ud = (rUD * 10) +1
- # throwdeck(strength, ud)
-
- # def focus_deck():
- # since_air = own['framenum'] - own['lF_air_frame']
- # if cb_td.positive and since_air < 10:
- # object = 'focus_deckA'
- # object2 = 'focus_deckB'
- # other = throw_deck_empty
- # throw_deck = scene.objects["throw_deck"]
- # throw_deck.endObject()
- # scene.addObject(object, other, 0)
- # scene.addObject(object2, other, 0)
-
- # if own['throw_deck'] == True:
- # if dict['ldPad'] == False and dict['last_ldPad'] == True:
- # object = 'focus_deckA'
- # object2 = 'focus_deckB'
- # other = throw_deck_empty
- # scene.addObject(object, other, 0)
- # scene.addObject(object2, other, 0)
-
- # def fall():
- # if own['fall'] == True:
- # falldeck()
- # if STANCE == 1:
- # own['requestAction'] = 'fak_air-walk_air'
- # #own.setLinearVelocity([3,2,0], True)
- # else:
- # own['requestAction'] = 'reg_air-walk_air'
- # #own.setLinearVelocity([-3,-2,0], True)
- # own['fall'] = False
- # own.worldPosition.z += .3
- # print('falling from walk.py')
-
- # def sit():
- # #turn off sit
- # if lup == 1 or ldown == 1 or lUD > sens or lUD < -sens:
- # if own['sit'] == 1:
- # killact(300)
- # killact(299)
- # own['sit'] = 0
-
- # if aBut == True and lasta == False:
- # try:
- # if 'sit' in r_ground.hitObject:
- # #print("sit")
- # own['sit'] = 1
- # killact(3)
- # if STANCE == 0:
- # own['requestAction'] = 'reg_sit'
- # elif STANCE == 1:
- # own['requestAction'] = 'fak_sit'
- # except:
- # pass
- # if own['sit'] == 1:
- # try:
- # killact(3)
- # sit_vect = r_ground.hitObject.getAxisVect( [0, 1, 0])
- # if STANCE == 0:
- # own.alignAxisToVect(-sit_vect, 0, .2)
- # own['requestAction'] = 'reg_sit'
-
- # elif STANCE == 1:
- # own['requestAction'] = 'fak_sit'
- # own.alignAxisToVect(sit_vect, 0, .2)
- # except:
- # pass
-
-
- # if r_ground.triggered == False:
- # cont.deactivate(own.actuators["walk_align"])
- # else:
- # cont.activate(own.actuators["walk_align"])
-
- # #walking on stairs
- # if r_ground.triggered:
- # try:
- # if 'stair' in r_ground.hitObject:
- # own['stair_counter'] = 20
-
- # except:
- # pass
- # if own['stair_counter'] > 0:
- # own.linearVelocity.z += .1
- # own['stair_counter'] -= 1
-
- # if yBut == True:
- # own['walk_idling'] = 0
- # own["walk_idle_frame"] = 0
-
-
-
- # if own['stair_counter'] > 5 and r_ground.triggered == False:
- # own.applyForce([0,0,-200], True)
-
- # if deck.visible:
- # own['deckvis'] = 1
- # else:
- # own['deckvis'] = 0
-
- # if own['requestAction'] == 'empty' or own['requestAction'] == None:
- # if STANCE == 0:
- # own['requestAction'] = 'reg_idle1'
- # if STANCE == 1:
- # own['requestAction'] = 'fak_idle1'
-
- # def onground():
- # if r_ground.positive:
- # own['lF_ground_frame'] = own['framenum']
- # if 'grind' in r_ground.hitObject:
- # if own['framenum'] - own['last_fall_frame'] < 90:
- # #own.applyForce([0,100,0], True)
- # pass
- # #print('moving away from rail')
-
- # yvel = own.linearVelocity.y
- # yvel = yvel *.1
- # if own.linearVelocity.y > .01 or own.linearVelocity.y < -.01 and own['stair_counter'] == 0:
- # if STANCE == 0:
- # own.applyRotation([0,0,-yvel], True)
- # else:
- # own.applyRotation([0,0,yvel], True)
- # else:
- # own.linearVelocity.y = 0
-
- # else:
- # #print('in air')
- # if own['framenum'] - own['lF_ground_frame'] > 10:
- # if STANCE == 0:
- # own['requestAction'] = 'reg_walk_air'
- # else:
- # own['requestAction'] = 'fak_walk_air'
- # #if control bottom is touching ground object, turn ground on
- # if cb.positive:
- # if own['framenum'] - own['last_fall_frame'] < 90:
- # own['lF_ground_frame'] = own['framenum']
-
-
-
- # def get_in_car():
- # vehicleNear = cont.sensors["vehicleNear"]
- # #print('vh', vehicleNear.positive)
- # scene = bge.logic.getCurrentScene()
- # cam = scene.active_camera
- # #dict = bge.logic.globalDict
- # if vehicleNear.positive and 'car' in vehicleNear.hitObject:
- # obj = vehicleNear.hitObject
- # if yBut == True:
- # obj['driving'] = True
- # own['driving'] = True
- # cube.suspendDynamics(True)
- # cube.worldPosition = obj.worldPosition
- # cube.worldOrientation = obj.worldOrientation
- # rot = [ 0.0, 0.0, 1.570796327]
- # cube.applyRotation(rot,False)
- # compound = False
-
- # # child is solid
- # ghost = True
-
- # # set parent
- # cube.setParent( obj, compound, ghost)
-
-
-
- # #cam.target = obj
- # #cam.state = 2
- # cont.actuators['Camera'].object = obj
- # cont.actuators['Camera'].height = 3
- # cont.actuators['Camera'].min = 6
- # cont.actuators['Camera'].max = 10
- # own.state = 2
- # #print('near car')
-
- # if dict['last_driving'] == True:
- # cont.actuators['Camera'].object = scene.objects['camCube']
- # cont.activate(cont.actuators['walk'])
- # if own['driving'] == False:
- # #cont.actuators['Camera'].object = scene.objects['camCube']
- # #cont.activate(cont.actuators['walk'])
- # dict['last_driving'] = False
-
- # def get_on_bike(dict, own):
- # #bikeCol = cont.sensors['bikeCol']
- # vehicleNear = cont.sensors["vehicleNear"]
- # #print('vh', vehicleNear.positive)
- # scene = bge.logic.getCurrentScene()
- # #cam = scene.active_camera
- # #dict = bge.logic.globalDict
- # try:
- # if vehicleNear.positive and 'bike' in vehicleNear.hitObject:
- # if yBut == True and dict['last_yBut'] == False and own['throw_deck'] == True:
- # vehicleNear.hitObject.endObject()
- # dict['bike'] = True
- # cont.activate(own.actuators['bike_state'])
-
- # object = "player_bike"
- # # instantly add bullet
- # newbike = scene.addObject(object, own, 0)
- # #bike.localScale = 4.6
- # newbike.setParent(cube, False, False)
- # #rot = [ 0.0, 0.0, 1.570796327]
- # #bike.applyRotation(rot,False)
- # except:
- # pass
-
- # if dict['driving_reset'] == True:
- # scene.resume()
- # cube.suspendDynamics(False)
- # cont.actuators['Camera'].object = camobj2
- # cont.activate(own.actuators['walk'])
- # #dict['driving_reset'] = False
- # #print('reseting driving')
- # if own['walk_jump_timer'] != 0:
- # own['walk_jump_timer'] = own['walk_jump_timer'] - 1
- # wts = own['walk_targ_speed'] +1
- # if own['requestAction'] == 'reg_walkFast' and own.linearVelocity.x > (wts * -1):
- # own['requestAction'] = 'reg_walk'
- # if own['requestAction'] == 'fak_walkFast' and own.linearVelocity.x < wts:
- # own['requestAction'] = 'fak_walk'
- # if own['requestAction'] == 'reg_walkFast_nb' and own.linearVelocity.x > (wts * -1):
- # own['requestAction'] = 'reg_walk_nb'
- # if own['requestAction'] == 'fak_walkFast_nb' and own.linearVelocity.x < wts:
- # own['requestAction'] = 'fak_walk_nb'
-
-
- # if r_ground.triggered:
- # #force2 = [0.0, 0, dict['antibounce']]
- # #own.applyForce(force2, True)
-
- # gdist = ((own.worldPosition.z - r_ground.hitPosition[2]))
- # #print(gdist)
- # if gdist < .28 and gdist > .1:
- # #move = 2.875 - gdist
- # move = (.28 - gdist)*.5
- # #move = (own.worldPosition.z + gdist)
- # if move > 0:
- # own.worldPosition.z = own.worldPosition.z + move
- # else:
- # own.worldPosition.z = own.worldPosition.z - move
- # own.linearVelocity.z = 0
-
-
- # jump()
- # #dropin()
- # throwdeck_trigger()
-
- # nextframe()
- # checkidle()
-
- # reset_pos()
- # #switchcam()
- # #move_flycam()
- # #move_followcam()
- # fall()
- # idle_anim()
- # sit()
- # onground()
- # getonboard(dict, cont)
- # onboard()
- # focus_deck()
- # get_in_car()
- # get_on_bike(dict, own)
-
- # #printplaying()
-
- # own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
- # #own.actuators["sroll"].stopSound()
- # camobj['sndmgr'].stop_sound(['roll'])
- # wheel1 = scene.objects["wheel1"]
- # wheel2 = scene.objects["wheel2"]
- # wheel3 = scene.objects["wheel3"]
- # wheel4 = scene.objects["wheel4"]
- # wheel1.stopAction(2)
- # wheel2.stopAction(2)
- # wheel3.stopAction(2)
- # wheel4.stopAction(2)
- # own['lasty'] = yBut
- # own['lastb'] = bBut
- # own['lasta'] = aBut
- # own['lastx'] = xBut
- # own['lastlts'] = ltsBut
- # own['lastrts'] = rtsBut
- # own['lastbkBut'] = bkBut
- # own['dropinCol'] = dropinCol
- # own['walk'] = 1
- # dict['walk'] = 1
- #
|