def __init__(self,settings): bs.TeamGameActivity.__init__(self,settings) if self.settings['Epic Mode']: self._isSlowMotion = True # print messages when players die since it matters here.. self.announcePlayerDeaths = True self._scoreBoard = bs.ScoreBoard() self._swipSound = bs.getSound("swip") self._tickSound = bs.getSound('tick') self._scoreToWin = self.settings['Capsules to Collect'] self._capsuleModel = bs.getModel('bomb') self._capsuleTex = bs.getTexture('bombColor') self._capsuleLuckyTex = bs.getTexture('bombStickyColor') self._collectSound = bs.getSound('powerup01') self._luckyCollectSound = bs.getSound('cashRegister2') self._capsuleMaterial = bs.Material() self._capsuleMaterial.addActions(conditions=("theyHaveMaterial",bs.getSharedObject('playerMaterial')), actions=(("call","atConnect",self._onCapsulePlayerCollide),)) self._capsules = [] self._flagRegionMaterial = bs.Material() self._flagRegionMaterial.addActions(conditions=("theyHaveMaterial",bs.getSharedObject('playerMaterial')), actions=(("modifyPartCollision","collide",True), ("modifyPartCollision","physical",False), ("call","atConnect",bs.Call(self._handlePlayerFlagRegionCollide,1)), ("call","atDisconnect",bs.Call(self._handlePlayerFlagRegionCollide,0))))
def onTransitionIn(self): bs.CoopGameActivity.onTransitionIn(self, music='Football') self._scoreBoard = bs.ScoreBoard() self._flagSpawnPos = self.getMap().getFlagPosition(None) self._spawnFlag() # set up the two score regions self.scoreRegions = [] defs = self.getMap().defs self.scoreRegions.append( bs.NodeActor( bs.newNode('region', attrs={ 'position': defs.boxes['goal1'][0:3], 'scale': defs.boxes['goal1'][6:9], 'type': 'box', 'materials': [self._scoreRegionMaterial] }))) self.scoreRegions.append( bs.NodeActor( bs.newNode('region', attrs={ 'position': defs.boxes['goal2'][0:3], 'scale': defs.boxes['goal2'][6:9], 'type': 'box', 'materials': [self._scoreRegionMaterial] }))) bs.playSound(self._chantSound)
def onBegin(self): self.bombSurvivor = None self.light = None self.set = False #Do normal stuff: calls to the main class to operate everything that usually would be done bs.TeamGameActivity.onBegin(self) self.b = [] self.queueLine = [] self.playerIndex = 0 for player in self.players: player.gameData['dead'] = False if player.actor is not None: player.actor.handleMessage(bs.DieMessage()) player.actor.node.delete() self.queueLine.append(player) self.spawnPlayerSpaz( self.queueLine[self.playerIndex % len(self.queueLine)], (0, 3, -2)) self.lastPrize = 'none' self.currentPlayer = self.queueLine[0] #Declare a set of bots (enemies) that we will use later self._bots = bs.BotSet() #make another scoreboard? IDK why I did this, probably to make it easier to refer to in the future self._scoredis = bs.ScoreBoard() #for each team in the game's directory, give them a score of zero for team in self.teams: team.gameData['score'] = 0 #Now we go ahead and put that on the scoreboard for player in self.queueLine: self._scoredis.setTeamValue(player.getTeam(), player.getTeam().gameData['score']) self.resetFlags()
def __init__(self,settings): bs.TeamGameActivity.__init__(self,settings) self._scoreBoard = bs.ScoreBoard() self._cheerSound = bs.getSound("cheer") self._chantSound = bs.getSound("crowdChant") self._foghornSound = bs.getSound("foghorn") self._swipSound = bs.getSound("swip") self._whistleSound = bs.getSound("refWhistle") self._puckModel = bs.getModel("puck") self._puckTex = bs.getTexture("puckColor") self._puckSound = bs.getSound("metalHit") self._puckMaterial = bs.Material() self._puckMaterial.addActions(actions=( ("modifyPartCollision","friction",0.5))) self._puckMaterial.addActions(conditions=("theyHaveMaterial",bs.getSharedObject('pickupMaterial')), actions=( ("modifyPartCollision","collide",False) ) ) self._puckMaterial.addActions(conditions=( ("weAreYoungerThan",100),'and', ("theyHaveMaterial",bs.getSharedObject('objectMaterial')) ), actions=( ("modifyNodeCollision","collide",False) ) ) self._puckMaterial.addActions(conditions=("theyHaveMaterial",bs.getSharedObject('footingMaterial')), actions=(("impactSound",self._puckSound,0.2,5))) # keep track of which player last touched the puck self._puckMaterial.addActions(conditions=("theyHaveMaterial",bs.getSharedObject('playerMaterial')), actions=(("call","atConnect",self._handlePuckPlayerCollide),)) # we want the puck to kill powerups; not get stopped by them self._puckMaterial.addActions(conditions=("theyHaveMaterial",bs.Powerup.getFactory().powerupMaterial), actions=(("modifyPartCollision","physical",False), ("message","theirNode","atConnect",bs.DieMessage()))) self._scoreRegionMaterial = bs.Material() self._scoreRegionMaterial.addActions(conditions=("theyHaveMaterial",self._puckMaterial), actions=(("modifyPartCollision","collide",True), ("modifyPartCollision","physical",False), ("call","atConnect",self._handleScore)))
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) self._scoreBoard = bs.ScoreBoard() self._swipSound = bs.getSound("swip") self._tickSound = bs.getSound('tick') self._countDownSounds = { 10: bs.getSound('announceTen'), 9: bs.getSound('announceNine'), 8: bs.getSound('announceEight'), 7: bs.getSound('announceSeven'), 6: bs.getSound('announceSix'), 5: bs.getSound('announceFive'), 4: bs.getSound('announceFour'), 3: bs.getSound('announceThree'), 2: bs.getSound('announceTwo'), 1: bs.getSound('announceOne') } self._flagRegionMaterial = bs.Material() self._flagRegionMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('playerMaterial')), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("call", "atConnect", bs.Call(self._handlePlayerFlagRegionCollide, 1)), ("call", "atDisconnect", bs.Call(self._handlePlayerFlagRegionCollide, 0))))
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) if self.settings['Epic Mode']: self._isSlowMotion = True self.info = bs.NodeActor( bs.newNode('text', attrs={ 'vAttach': 'bottom', 'hAlign': 'center', 'vrDepth': 0, 'color': (0, .2, 0), 'shadow': 1.0, 'flatness': 1.0, 'position': (0, 0), 'scale': 0.8, 'text': "Modified by Mr.Smoothy", })) self.possession = True self.heldLast = None self.fouled = False self.firstFoul = False self.jb = True self._bots = bs.BotSet() self.hoop = Hoop((0, 5, -8), (1, 1, 1)) self.threePointLine = ThreePointLine().autoRetain() self._scoredis = bs.ScoreBoard() self.referee = Referee bs.gameTimer( 10, bs.Call(self._bots.spawnBot, self.referee, pos=(-6, 3, -6), spawnTime=1))
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) self._scoreBoard = bs.ScoreBoard() if self.settings['Epic Mode']: self._isSlowMotion = True self._lastScoreTime = 0 self._scoreSound = bs.getSound("score")
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) if self.settings['Epic Mode']: self._isSlowMotion = True self.announcePlayerDeaths = True self._scoreBoard = bs.ScoreBoard()
def __init__(self,settings): bs.TeamGameActivity.__init__(self, settings) if self.settings['Epic Mode']: self._isSlowMotion = True # print messages when players die (since its meaningful in this game) self.announcePlayerDeaths = True self._scoreBoard = bs.ScoreBoard() #self._lastPlayerDeathTime = None self.minOverlap = 0.2 # This is the minimum amount of linear overlap for a spaz's own area to guarantee they can walk to it self.claimRad = math.sqrt(self.settings['Claim Size']/3.1416) #This is so that the settings can be in units of area, same as score self.updateRate = 200 #update the mine radii etc every this many milliseconds #This game's score calculation is very processor intensive. #Score only updated 2x per second during game, at lower resolution self.scoreUpdateRate = 1000 self.inGameScoreRes = 40 self.finalScoreRes = 300 self._eggModel = bs.getModel('egg') try: myFactory = self._sharedSpazFactory except Exception: myFactory = self._sharedSpazFactory = bsSpaz.SpazFactory() m=myFactory._getMedia('Frosty') self._ballModel = m['pelvisModel'] self._bombMat = bsBomb.BombFactory().bombMaterial self._mineIconTex=bs.Powerup.getFactory().texLandMines
def onTransitionIn(self): bs.CoopGameActivity.onTransitionIn(self, music='Epic') bs.gameTimer(1300, bs.Call(bs.playSound, self._newWaveSound)) self._scoreBoard = bs.ScoreBoard(label=bs.Lstr(resource='scoreText'), scoreSplit=0.5) # we use this in place of a regular int to make it harder to hack scores self._score = bs.SecureInt(0)
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) if self.settings['Epic Mode']: self._isSlowMotion = True # print messages when players die since it matters here.. self.announcePlayerDeaths = True self._scoreBoard = bs.ScoreBoard()
def __init__(self, settings): self._raceStarted = False bs.TeamGameActivity.__init__(self, settings) self._scoreBoard = bs.ScoreBoard() if self.settings['Epic Mode']: self._isSlowMotion = True self._scoreSound = bs.getSound("score") self._swipSound = bs.getSound("swip") self._lastTeamTime = None self._frontRaceRegion = None
def onTransitionIn(self): bs.CoopGameActivity.onTransitionIn(self) # show special landmine tip on rookie preset if self._preset in ['rookie', 'rookieEasy']: # show once per session only (then we revert to regular tips) if not hasattr(bs.getSession(), '_gShowedOnslaughtLandMineTip'): bs.getSession()._gShowedOnslaughtLandMineTip = True self.tips = [ {'tip': "Land-mines are a good way to stop speedy enemies.", 'icon': bs.getTexture('powerupLandMines'), 'sound': bs.getSound('ding')}] # show special tnt tip on pro preset if self._preset in ['pro', 'proEasy']: # show once per session only (then we revert to regular tips) if not hasattr(bs.getSession(), '_gShowedOnslaughtTntTip'): bs.getSession()._gShowedOnslaughtTntTip = True self.tips = [{ 'tip': "Take out a group of enemies by\nsetting" " off a bomb near a TNT box.", 'icon': bs.getTexture('tnt'), 'sound': bs.getSound('ding')}] # show special curse tip on uber preset if self._preset in ['uber', 'uberEasy']: # show once per session only (then we revert to regular tips) if not hasattr(bs.getSession(), '_gShowedOnslaughtCurseTip'): bs.getSession()._gShowedOnslaughtCurseTip = True self.tips = [{ 'tip': "Curse boxes turn you into a ticking time bomb.\n" "The only cure is to quickly grab a health-pack.", 'icon': bs.getTexture('powerupCurse'), 'sound': bs.getSound('ding')}] self._spawnInfoText = bs.NodeActor( bs.newNode( "text", attrs={'position': (15, -130), 'hAttach': "left", 'vAttach': "top", 'scale': 0.55, 'color': (0.3, 0.8, 0.3, 1.0), 'text': ''})) bs.playMusic('Onslaught') self._scoreBoard = bs.ScoreBoard( label=bs.Lstr(resource='scoreText'), scoreSplit=0.5) self._gameOver = False self._wave = 0 self._canEndWave = True # we use this in place of a regular int to make it harder to hack scores self._score = bs.SecureInt(0) self._timeBonus = 0
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) self._scoreBoard = bs.ScoreBoard() if self.settings['Epic Mode']: self._isSlowMotion = True self._alarmSound = bs.getSound("alarm") self._tickingSound = bs.getSound("ticking") self._lastScoreTime = 0 self._scoreSound = bs.getSound("score") self._swipSound = bs.getSound("swip") self._allBasesMaterial = bs.Material()
def onTransitionIn(self): bs.screenMessage( bs.Lstr(resource='musicText').evaluate()+'Violet7rip - For everything') bs.CoopGameActivity.onTransitionIn(self, music='ForEverything') bs.gameTimer(1300, bs.Call(bs.playSound, self._newWaveSound)) self._scoreBoard = bs.ScoreBoard( label=bs.Lstr(resource='scoreText'), scoreSplit=0.5) # we use this in place of a regular int to make it harder to hack scores self._score = bs.SecureInt(0)
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) self._isSlowMotion = random.choice([True, False]) # show messages when players die since it's meaningful here self.announcePlayerDeaths = True if isinstance(self.getSession(), bs.FreeForAllSession): self.gameData = {} self._scoreBoard = bs.ScoreBoard()
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) if self.settings['Epic Mode']: self._isSlowMotion = True # show messages when players die since it's meaningful here self.announcePlayerDeaths = True try: self._soloMode = settings['Solo Mode'] except Exception: self._soloMode = False self._scoreBoard = bs.ScoreBoard()
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) self._scoreBoard = bs.ScoreBoard() if self.settings['Epic Mode']: self._isSlowMotion = True self._cheerSound = bs.getSound("cheer") self._chantSound = bs.getSound("") self._glSound = bs.getSound("orchestraHitBig2") self._swipSound = bs.getSound("") self._spwnSound = bs.getSound("orchestraHitBig1") self._puckModel = bs.getModel("shield") self._puckTex = bs.getTexture("levelIcon") #self._puckSound = bs.getSound("block") self._rollSound = bs.getSound("bombRoll01") self._dinkSounds = (bs.getSound('bombDrop01'), bs.getSound('bombDrop02')) self._puckMaterial = bs.Material() self._puckMaterial.addActions( conditions=('theyHaveMaterial', bs.getSharedObject('footingMaterial')), actions=(('impactSound', self._dinkSounds, 2, 0.8), ('rollSound', self._rollSound, 3, 6))) self._puckMaterial.addActions(actions=(("modifyPartCollision", "friction", 500.0))) self._puckMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('pickupMaterial')), actions=(("modifyPartCollision", "collide", True))) self._puckMaterial.addActions( conditions=(("weAreYoungerThan", 100), 'and', ("theyHaveMaterial", bs.getSharedObject('objectMaterial'))), actions=(("modifyNodeCollision", "collide", False))) # self._puckMaterial.addActions(conditions=("theyHaveMaterial",bs.getSharedObject('footingMaterial')), # actions=(("impactSound",self._puckSound,0.2,2))) # keep track of which player last touched the puck self._puckMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('playerMaterial')), actions=(("call", "atConnect", self._handlePuckPlayerCollide), )) # we want physical self._puckMaterial.addActions( conditions=("theyHaveMaterial", bs.Powerup.getFactory().powerupMaterial), actions=(("modifyPartCollision", "physical", True), ("message", "theirNode", "atConnect", bs.DieMessage()))) self._scoreRegionMaterial = bs.Material() self._scoreRegionMaterial.addActions( conditions=("theyHaveMaterial", self._puckMaterial), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("call", "atConnect", self._handleScore)))
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) if self.settings['Epic Mode']: self._isSlowMotion = True self._maxArrows = self.settings[JungleHunterLanguage.arrowInit] * 2 # print messages when players die (since its meaningful in this game) self.announcePlayerDeaths = True self._lastPlayerDeathTime = None self.positionSpan = None self._scoreBoard = bs.ScoreBoard()
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) if self.settings['Epic Mode']: self._isSlowMotion = True self.announcePlayerDeaths = True try: self._soloMode = settings['Solo Mode'] except Exception: self._soloMode = False self._scoreBoard = bs.ScoreBoard()
def onBegin(self): bs.TeamGameActivity.onBegin(self) # End the game in a minute bs.gameTimer(60000, bs.WeakCall(self.endGame)) bs.OnScreenCountdown(60).start() # Call the method to spawn our kronks bs.gameTimer(1000, bs.WeakCall(self.spawnBots)) self._gamescore = 0 # Set up a scoreboard self._scoredis = bs.ScoreBoard() self._scoredis.setTeamValue(self.teams[0], self._gamescore) # Enable powerups with TNT self.setupStandardPowerupDrops(enableTNT=True)
def __init__(self,settings): bs.TeamGameActivity.__init__(self,settings) if self.settings['Epic Mode']: self._isSlowMotion = True self._scoreBoard = bs.ScoreBoard() self._scoreSound = bs.getSound('score') self._swipSound = bs.getSound('swip') self._extraFlagMaterial = bs.Material() # we want flags to tell us they've been hit but not react physically self._extraFlagMaterial.addActions(conditions=('theyHaveMaterial',bs.getSharedObject('playerMaterial')), actions=(('modifyPartCollision','collide',True), ('call','atConnect',self._handleFlagPlayerCollide)))
def onBegin(self): bs.TeamGameActivity.onBegin(self) self.characters = {'king':'Mel','queen':'Pixel','rook':'Agent Johnson','knight':'Snake Shadow','bishop':'Pascal','pawn':'Spaz'} self.points = {'king':0,'queen':9,'rook':7,'knight':3,'bishop':3,'pawn':1} self._scoredis = bs.ScoreBoard() for team in self.teams: team.gameData['score'] = 0 self._scoredis.setTeamValue(team,team.gameData['score']) for i in range(len(self.teams[0].players)): player = self.teams[0].players[i] if i < 1: player.gameData['piece'] = 'king' elif i < 2: player.gameData['piece'] = 'queen' elif i < 4: player.gameData['piece'] = 'rook' elif i < 6: player.gameData['piece'] = 'knight' elif i < 8: player.gameData['piece'] = 'bishop' else: self.teams[0].players[i].gameData['piece'] = 'pawn' self.spawnPlayerSpaz(player,self.getMap().getStartPosition(0)) self.teams[0].gameData['botSet'] = PieceSet() self.teams[0].gameData['botSet'].team = 0 for j in range(i+1,16): if j < 1: bot = AIKing(player) elif j < 2: bot = AIQueen(player) elif j < 4: bot = AIRook(player) elif j < 6: bot = AIKnight(player) elif j < 8: bot = AIBishop(player) else: bot = AIPawn(player) self.teams[0].gameData['botSet'].addBot(bot) bot.team = self.teams[0] bot.handleMessage(bs.StandMessage(self.getMap().getStartPosition(0))) for i in range(len(self.teams[1].players)): player = self.teams[1].players[i] if i < 1: player.gameData['piece'] = 'king' elif i < 2: player.gameData['piece'] = 'queen' elif i < 4: player.gameData['piece'] = 'rook' elif i < 6: player.gameData['piece'] = 'knight' elif i < 8: player.gameData['piece'] = 'bishop' else: player.gameData['piece'] = 'pawn' self.spawnPlayerSpaz(player,self.getMap().getStartPosition(1)) self.teams[1].gameData['botSet'] = PieceSet() self.teams[1].gameData['botSet'].team = 1 for j in range(i+1,16): if j < 1: bot = AIKing(player) elif j < 2: bot = AIQueen(player) elif j < 4: bot = AIRook(player) elif j < 6: bot = AIKnight(player) elif j < 8: bot = AIBishop(player) else: bot = AIPawn(player) self.teams[1].gameData['botSet'].addBot(bot) bot.team = self.teams[1] bot.handleMessage(bs.StandMessage(self.getMap().getStartPosition(1)))
def __init__(self,settings): bs.TeamGameActivity.__init__(self,settings) self._lastPlayerDeathTime = None self._scoreBoard = bs.ScoreBoard() self._eggModel = bs.getModel('egg') self._eggTex1 = bs.getTexture('eggTex1') self._eggTex2 = bs.getTexture('eggTex2') self._eggTex3 = bs.getTexture('eggTex3') self._collectSound = bs.getSound('powerup01') self._proMode = settings.get('Pro Mode',False) self._maxEggs = 1.0 self._eggMaterial = bs.Material() self._eggMaterial.addActions(conditions=("theyHaveMaterial",bs.getSharedObject('playerMaterial')), actions=(("call","atConnect",self._onEggPlayerCollide),)) self._eggs = []
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) self._scoreBoard = bs.ScoreBoard() self._cheerSound = bs.getSound("cheer") self._chantSound = bs.getSound("crowdChant") self._scoreSound = bs.getSound("score") self._swipSound = bs.getSound("swip") self._whistleSound = bs.getSound("refWhistle") self.scoreRegionMaterial = bs.Material() self.scoreRegionMaterial.addActions( conditions=("theyHaveMaterial", bs.Bomb.getFactory().bombMaterial), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("call", "atConnect", self._handleScore)))
def __init__(self,settings): bs.TeamGameActivity.__init__(self,settings) if self.settings['Epic Mode']: self._isSlowMotion = True # print messages when players die since it matters here.. self.announcePlayerDeaths = True self._scoreBoard = bs.ScoreBoard() #Initiate the SnoBall factory self.snoFact = SnoBallz.snoBall().getFactory() self.snoFact.defaultBallTimeout = self.settings['Snowball Rate'] self.snoFact._ballsMelt = self.settings['Snowballs Melt'] self.snoFact._ballsBust = self.settings['Snowballs Bust'] self.snoFact._powerExpire = False
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) self._scoreBoard = bs.ScoreBoard() self._swipSound = bs.getSound("swip") self._tickSound = bs.getSound('tick') self._countDownSounds = {10:bs.getSound('announceTen'), 9:bs.getSound('announceNine'), 8:bs.getSound('announceEight'), 7:bs.getSound('announceSeven'), 6:bs.getSound('announceSix'), 5:bs.getSound('announceFive'), 4:bs.getSound('announceFour'), 3:bs.getSound('announceThree'), 2:bs.getSound('announceTwo'), 1:bs.getSound('announceOne')}
def __init__(self,settings): bs.TeamGameActivity.__init__(self,settings) if self.settings['Epic Mode']: self._isSlowMotion = True self._scoreBoard = bs.ScoreBoard() self._chosenOnePlayer = None self._swipSound = bs.getSound("swip") self._countDownSounds = {10:bs.getSound('announceTen'), 9:bs.getSound('announceNine'), 8:bs.getSound('announceEight'), 7:bs.getSound('announceSeven'), 6:bs.getSound('announceSix'), 5:bs.getSound('announceFive'), 4:bs.getSound('announceFour'), 3:bs.getSound('announceThree'), 2:bs.getSound('announceTwo'), 1:bs.getSound('announceOne')}
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) if self.settings['Epic Mode']: self._isSlowMotion = True if self.settings["Night Mode"]: bs.getSharedObject('globals').tint = (0.5, 0.7, 1) # show messages when players die since it's meaningful here self.announcePlayerDeaths = True try: self._soloMode = settings['Solo Mode'] except Exception: self._soloMode = False self._scoreBoard = bs.ScoreBoard() self._bots = myBots() self.spazClones = []
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) self._lastPlayerDeathTime = None self._scoreBoard = bs.ScoreBoard() self._eggModel = bs.getModel('shield') self._eggTex1 = bs.getTexture('eggTex1') self._eggTex2 = bs.getTexture('eggTex2') self._eggTex3 = bs.getTexture('eggTex3') self._collectSound = bs.getSound('powerup01') self._maxEggs = 1.0 self._eggMaterial = bs.Material() self._eggMaterial.addActions( conditions=(("weAreYoungerThan", 100), 'and', ("theyHaveMaterial", bs.getSharedObject('objectMaterial'))), actions=(("modifyNodeCollision", "collide", True))) self._eggs = []