from __future__ import generatorsimport plusimport Arenasimport randomimport Hazardsimport mathfrom random import randintimport time import HazardsBlueRayimport stringimport Gooeyclass Twisted_Loser(Arenas.SuperArena): "The official arena for all BTTB tournaments." name = "Twiiisted Arena" preview = "twisted/twi_preview.bmp" game_types = ['DEATHMATCH', 'BATTLE ROYAL', 'TEAM MATCH'] extent = (-15, 15, 15, -15) def __init__(self): Arenas.SuperArena.__init__(self, "Arenas/twisted/twisted_L.gmf") #plus.Arena.__init__(self, "") plus.setBackColor(0, 0, 0) degrad = 0.01745 self.AddStaticCamera("Main View", (0, 30, -20), (68*degrad,0), 55*degrad) self.AddStaticCamera("Battle View", (19.5, 25, 19.5), (56*degrad,225*degrad), 40*degrad) self.AddStaticCamera("High Flipper View", (-19.5, 45, -19.5), (48*degrad,45*degrad), 84*degrad) self.AddStaticCamera("Birds Eye View", (0, 45, 0), (90*degrad,0), 50*degrad) self.AddWatchCamera("Combat Cam", (-12, 8, 12), (16, 36, 65*degrad, 30*degrad)) self.AddWatchCamera("Aerial Cam", (-19.5, 35, -19.5), (50, 60, 45*degrad, 60*degrad)) self.AddWatchCamera("Ground Cam", (8, -5, -8), (15, 40, 75*degrad, 35*degrad)) self.AddWatchCamera("Spectator Cam", (13, 15, 13), (6, 18, 45*degrad, 45*degrad)) self.players = () ################## Bot Flames + Smoke ##################------------- self.RI_1 = 0 self.RI_2 = 0 self.RI_3 = 0 self.RI_4 = 0 self.RI_5 = 0 self.RI_6 = 0 self.RI_7 = 0 self.RI_8 = 0 self.RI_9 = 0 self.RI_D = 0 self.RI_Y = 0 self.RI_SandF_0 = random.randint(-4, 4) ### Random Smoke and Flames self.RI_SandF_1 = random.randint(-4, 4) ### Random Smoke and Flames self.RI_SandF_2 = random.randint(-4, 4) ### Random Smoke and Flames self.RI_SandF_3 = random.randint(-4, 4) ### Random Smoke and Flames ################## Bot Flames + Smoke ##################------------- def AddShadowReceivers(self): self.SetShadowSource(5.897, 19.159, 5.899) def HazardsOn(self, on): if on: ################## Bot Flames + Smoke ##################------------- self.BOT_Flame_0 = HazardsBlueRay.BotFlame((0, 0, 0), (0, 1, 0), (.2, .4, .2), .8) self.AddHazard(self.BOT_Flame_0) self.BOT_Flame_1 = HazardsBlueRay.BotFlame((0, 0, 0), (0, 1, 0), (.2, .4, .2), .8) self.AddHazard(self.BOT_Flame_1) self.BOT_Flame_2 = HazardsBlueRay.BotFlame((0, 0, 0), (0, 1, 0), (.2, .4, .2), .8) self.AddHazard(self.BOT_Flame_2) self.BOT_Flame_3 = HazardsBlueRay.BotFlame((0, 0, 0), (0, 1, 0), (.2, .4, .2), .8) self.AddHazard(self.BOT_Flame_3) self.BOT_Flame_4 = HazardsBlueRay.BotFlame((0, 0, 0), (0, 1, 0), (.2, .4, .2), .8) self.AddHazard(self.BOT_Flame_4) #self.BOT_Flame_5 = HazardsBlueRay.BotFlame((0, 0, 0), (0, 1, 0), (.2, .4, .2), .8) #self.AddHazard(self.BOT_Flame_5) #self.BOT_Flame_6 = HazardsBlueRay.BotFlame((0, 0, 0), (0, 1, 0), (.2, .4, .2), .8) #self.AddHazard(self.BOT_Flame_6) #self.BOT_Flame_7 = HazardsBlueRay.BotFlame((0, 0, 0), (0, 1, 0), (.2, .4, .2), .8) #self.AddHazard(self.BOT_Flame_7) #self.BOT_Flame_8 = HazardsBlueRay.BotFlame((0, 0, 0), (0, 1, 0), (.2, .4, .2), .8) #self.AddHazard(self.BOT_Flame_8) ################## Bot Flames + Smoke ##################------------- return Arenas.SuperArena.HazardsOn(self, on) ################## Bot Flames + Smoke ##################------------- self.RI_0 = randint(-4, 4) self.RI_1 = randint(-4, 4) self.RI_2 = randint(-4, 4) self.RI_3 = randint(-2, 2) self.RI_4 = randint(-2, 2) self.RI_5 = randint(-2, 2) self.RI_6 = randint(-2, 2) self.RI_7 = randint(-2, 2) self.RI_8 = randint(-2, 2) self.RI_9 = randint(-2, 2) self.RI_D = randint(1, 4) self.RI_Y = randint(0, 2) self.BOT_Flame_0.Tick() # Individual bot flames self.BOT_Flame_1.Tick() # "" self.BOT_Flame_2.Tick() # "" self.BOT_Flame_3.Tick() # "" #self.BOT_Flame_4.Tick() # Generic Lightning striking bot_flame. #self.BOT_Flame_5.Tick() #self.BOT_Flame_6.Tick() #self.BOT_Flame_7.Tick() #self.BOT_Flame_8.Tick() if 0 in self.players: if plus.getHealth(0,0) < 0.2: # if self.RI_SandF_0 <= 2: plus.emitSmoke(1, (plus.getLocation(0)), (self.RI_3, 1 ,self.RI_4), (.2,.4,.2)) if plus.getHealth(0,0) < 0.1: # if self.RI_SandF_0 < 0: plus.emitSmoke(1, (plus.getLocation(0)), (self.RI_4, self.RI_Y, self.RI_5), (.2,.4,.2)) self.BOT_Flame_0.BotFlameOff() self.BOT_Flame_0 = HazardsBlueRay.BotFlame(plus.getLocation(0), (self.RI_4, self.RI_Y, self.RI_5), (.2, .4, .2), .8) self.BOT_Flame_0.BotFlameOn() if 1 in self.players: if plus.getHealth(1,0) < 0.2: # if self.RI_SandF_1 <= 2: plus.emitSmoke(1, (plus.getLocation(1)), (self.RI_4, 1 ,self.RI_5), (.2,.4,.2)) if plus.getHealth(1,0) < 0.1: # if self.RI_SandF_1 < 20: plus.emitSmoke(1, (plus.getLocation(1)), (self.RI_5, self.RI_Y, self.RI_6), (.2,.4,.2)) self.BOT_Flame_1.BotFlameOff() self.BOT_Flame_1 = HazardsBlueRay.BotFlame(plus.getLocation(1), (self.RI_5, self.RI_Y, self.RI_6), (.2, .4, .2), .8) self.BOT_Flame_1.BotFlameOn() if 2 in self.players: if plus.getHealth(2,0) < 0.2: # if self.RI_SandF_2 <= 2: plus.emitSmoke(1, (plus.getLocation(2)), (self.RI_5, 1 ,self.RI_6), (.2,.4,.2)) if plus.getHealth(2,0) < 0.1: # if self.RI_SandF_2 < 0: plus.emitSmoke(1, (plus.getLocation(2)), (self.RI_6, self.RI_Y ,self.RI_7), (.2,.4,.2)) self.BOT_Flame_2.BotFlameOff() self.BOT_Flame_2 = HazardsBlueRay.BotFlame(plus.getLocation(2), (self.RI_6, self.RI_Y, self.RI_7), (.2, .4, .2), .8) self.BOT_Flame_2.BotFlameOn() if 3 in self.players: if plus.getHealth(3,0) < 0.2: # if self.RI_SandF_3 <= 2: plus.emitSmoke(1, (plus.getLocation(3)), (self.RI_6, 1 ,self.RI_7), (.2,.4,.2)) if plus.getHealth(3,0) < 0.1: # if self.RI_SandF_3 < 0: plus.emitSmoke(1, (plus.getLocation(3)), (self.RI_8, self.RI_Y, self.RI_9), (.2,.4,.2)) self.BOT_Flame_3.BotFlameOff() self.BOT_Flame_3 = HazardsBlueRay.BotFlame(plus.getLocation(3), (self.RI_8, self.RI_Y, self.RI_9), (.2, .4, .2), .8) self.BOT_Flame_3.BotFlameOn() ################## Bot Flames + Smoke ##################------------- def Activate(self, on): if on: self.players = plus.getPlayers() Arenas.SuperArena.Activate(self, on) def Introduction(self): sounds = self.intro_sounds # set initial camera & fade from black plus.setCameraPosition(23.7554,14.3743,-47.141) plus.setCameraRotation(0.266024,-0.472956) plus.setCameraFOV(0.675) plus.fadeFromBlack(.25) #start playing music loop self.intro_music = plus.createSound("Sounds/intro_music/smell_glue.wav", False, (0,0,0)) plus.setVolume(self.intro_music, 0, 0) plus.loopSound(self.intro_music) yield .25 #load all sounds now to decrease lag later sounds['crowd'] = plus.createSound("Sounds/crowd/LoudCheer_Loop.wav", False, (0,0,0)) sounds['arena'] = plus.createSound("Sounds/announcers/Twisted_WinnersIntroduction.wav", False, (0,0,0)) sounds['generic'] = plus.createSound("Sounds/announcers/Twisted_EliminationCorners.wav"), False, (0,0,0)) hazardOpt = ("Sounds/announcers/Twisted_StuckArenaFloor.wav", "Sounds/announcers/Twisted_LowLag.wav", "Sounds/announcers/Twisted_LegalDisclaimer.wav") sounds['hazards'] = plus.createSound(random.choice(hazardOpt), False, (0,0,0)) sounds['bots'] = plus.createSound("Sounds/announcers/Twisted_CrowdArmed.wav"), False, (0,0,0)) #intro cam, welcom comment plus.playSound(sounds['arena']) plus.fadeInToLoop(sounds['crowd'], -100, 800) plus.animateCamera((23.7554,14.3743,-47.141), (0.266024,-0.472956), 0.675, (30.3992,6.28651,8.97787), (0.193915,-1.86089), 0.675, 0, 8) yield 2 plus.fadeOutLoop(sounds['crowd'], 8000) yield 1 #play a generic (or specific) secondary comment plus.playSound(sounds['generic']) yield 5 #hazard cams if self.bHazardsOn: plus.playSound(sounds['hazards']) plus.animateCamera((12.0623,13.9558,-10.831), (0.666964,-0.640974), 0.66, (12.0623,13.9558,-10.831), (0.666964,-0.640974), 0.24, 0, .5) plus.animateCamera((8.6126,4.07693,2.09747), (0.416206,-2.1045), 0.8862, (8.6126,4.07693,2.09747), (0.416206,-2.1045), 0.3162, 1, 1.5) yield 4 players = plus.getPlayers() pcount = len(players) if pcount>0: plus.playSound(sounds['bots']) delaytime = 6 - pcount if 0 in players: #bot 1 cam plus.animateCamera((-8.06563,1.12132,-3.88764), (0.210442,-0.141627), 0.8862, (-3.39987,1.12132,7.25815), (0.394558,-1.12997), 0.8862, 0, delaytime) yield delaytime if 1 in players: #bot 2 cam plus.animateCamera((5.22435,3.09861,-1.95753), (0.47197,2.53793), 0.8862, (4.59523,-0.911434,-5.42526), (0.147264,2.22609), 0.8862, 0, delaytime) yield delaytime if 2 in players: #bot 3 cam plus.animateCamera((5.59557,1.02128,2.1188), (0.294276,0.484751), 0.8862, (2.4611,1.02128,4.21063), (0.284205,0.877072), 0.5712, 0, delaytime) yield delaytime if 3 in players: #bot 4 cam plus.animateCamera((-5.57326,2.86185,-4.16246), (0.612217,-2.45323), 0.825, (-4.44016,-0.507445,-5.44161), (0.203219,-2.19922), 0.825, 0, delaytime) yield delaytime #fade out music plus.fadeOutLoop(self.intro_music, 2000) yield 2 # done yield 0 def Tick(self): for each in self.players: if plus.getLocation(each)[1] < -10: # Adjust this parameter to floor height(s). plus.eliminatePlayer(each) return Arenas.SuperArena.Tick(self) Arenas.register(Twisted_Loser)
plus.animateCamera((8.6126,4.07693,2.09747), (0.416206,-2.1045), 0.8862, (8.6126,4.07693,2.09747), (0.416206,-2.1045), 0.3162, 1, 1.5)
#plus.animateCamera(XYZ-StartingLocation, (V-Angle, H-Angle), Starting Zoom, XYZ-EndingLocation, (V-Swing, H-Swing), End Zoom, Delay, Duration) - camera movement (the first half of the parameters correspond to the starting values and the second half corresponds to the ending values followed by the delay and duration. Anything starting with XYZ corresponds to coordinates (given as a tuple). The V-Angle and H-Angle determine the direction of the camera. Delay can be negative but that just causes it to go slow then quickly get to the end of the sequence in the last tick. Once an animation has started, there isn't any way of stopping it.#plus.fadeFromBlack(Duration) - suddenly turns screen black then fades back in over the given duration.#plus.setCameraFOV(0.675) - creates an orbit cam at the selected distance from the chassis#plus.setCameraFOVRange(self.range[0], self.range[1], self.range[2], self.range[3]) - TBD#plus.setCameraPosition(X, Y, Z) - places a camera at the specified coordinates#plus.setCameraRotation(V-Angle, H-Angle) - changes the direction of the current camera (works on all camera types).