def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) self._nightModel = bs.getModel("shield") self._nightTex = bs.getTexture("black") # print messages when players die since it matters here.. self.announcePlayerDeaths = True self._scoreBoard = bs.ScoreBoard() self._nightMaterial = bs.Material() self._nightMaterial.addActions( conditions=(('theyHaveMaterial', bs.getSharedObject('pickupMaterial')), 'or', ('theyHaveMaterial', bs.getSharedObject('attackMaterial'))), actions=(('modifyPartCollision', 'collide', False))) # we also dont want anything moving it self._nightMaterial.addActions( conditions=(('theyHaveMaterial', bs.getSharedObject('objectMaterial')), 'or', ('theyDontHaveMaterial', bs.getSharedObject('footingMaterial'))), actions=(('modifyPartCollision', 'collide', False), ('modifyPartCollision', 'physical', False))) #drunk self._scoreRegionMaterial = bs.Material() self._scoreRegionMaterial.addActions( conditions=(('theyHaveMaterial', bs.getSharedObject('objectMaterial')), 'or', ('theyDontHaveMaterial', bs.getSharedObject('footingMaterial'))), actions=(('modifyPartCollision', 'collide', True), ('modifyPartCollision', 'physical', True))) self._scoreRegionMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('playerMaterial')), actions=(("call", "atConnect", self._DrunkPlayerCollide), ))
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 __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) if self.settings['Epic Mode']: self._isSlowMotion = True self.announcePlayerDeaths = True self._lastPlayerDeathTime = None #A safe zone from player self.safeRegionMaterial = bs.Material() self.safeRegionMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('playerMaterial')), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", True)))
def __init__(self): """ Instantiate a FlagFactory. You shouldn't need to do this; call bs.Flag.getFactory() to get a shared instance. """ self.flagMaterial = bs.Material() self.flagMaterial.addActions( conditions=( ('weAreYoungerThan',100),'and',('theyHaveMaterial',bs.getSharedObject('objectMaterial'))), actions=( ('modifyNodeCollision','collide',False))) self.flagMaterial.addActions( conditions=('theyHaveMaterial',bs.getSharedObject('footingMaterial')), actions=(('message','ourNode','atConnect','footing',1), ('message','ourNode','atDisconnect','footing',-1))) self.impactSound = bs.getSound('metalHit'); self.skidSound = bs.getSound('metalSkid'); self.flagMaterial.addActions( conditions=('theyHaveMaterial',bs.getSharedObject('footingMaterial')), actions=(('impactSound',self.impactSound,2,5), ('skidSound',self.skidSound,2,5))) self.noHitMaterial = bs.Material() self.noHitMaterial.addActions( conditions=(('theyHaveMaterial',bs.getSharedObject('pickupMaterial')),'or', ('theyHaveMaterial',bs.getSharedObject('attackMaterial'))), actions=(('modifyPartCollision','collide',False))) # we also dont want anything moving it self.noHitMaterial.addActions( conditions=(('theyHaveMaterial',bs.getSharedObject('objectMaterial')),'or', ('theyDontHaveMaterial',bs.getSharedObject('footingMaterial'))), actions=(('modifyPartCollision','collide',False), ('modifyPartCollision','physical',False))) self.flagTexture = bs.getTexture('flagColor')
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) 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): """ Instantiate a SnoBallFactory. You shouldn't need to do this; call snoBallz.snoBall.getFactory() to get a shared instance. """ self.texSno = bs.getTexture("bunnyColor") self.snoModel = bs.getModel("frostyPelvis") self.ballMaterial = bs.Material() self.impactSound = bs.getSound('impactMedium') #First condition keeps balls from damaging originating player by preventing collisions immediately after they appear. #Time is very short due to balls move fast. self.ballMaterial.addActions( conditions=((('weAreYoungerThan', 5), 'or', ('theyAreYoungerThan', 100)), 'and', ('theyHaveMaterial', bs.getSharedObject('objectMaterial'))), actions=(('modifyNodeCollision', 'collide', False))) # we want pickup materials to always hit us even if we're currently not # colliding with their node (generally due to the above rule) self.ballMaterial.addActions( conditions=('theyHaveMaterial', bs.getSharedObject('pickupMaterial')), actions=(('modifyPartCollision', 'useNodeCollide', False))) self.ballMaterial.addActions(actions=('modifyPartCollision', 'friction', 0.3)) #This action disables default physics when the ball hits a spaz. Sends a snoMessage to #itself so that it can try to damage spazzes. self.ballMaterial.addActions( conditions=('theyHaveMaterial', bs.getSharedObject('playerMaterial')), actions=(('modifyPartCollision', 'physical', False), ('message', 'ourNode', 'atConnect', snoMessage()))) #This message sends a different message to our ball just to see if it should bust or not self.ballMaterial.addActions( conditions=(('theyDontHaveMaterial', bs.getSharedObject('playerMaterial')), 'and', ('theyHaveMaterial', bs.getSharedObject('objectMaterial')), 'or', ('theyHaveMaterial', bs.getSharedObject('footingMaterial'))), actions=('message', 'ourNode', 'atConnect', otherHitMessage())) #The below can be changed after the factory is created self.defaultBallTimeout = 300 self._ballsMelt = True self._ballsBust = True self._powerExpire = True self._powerLife = 20000
def __init__(self): """ Instantiate a SnoBallFactory. You shouldn't need to do this; call random_door.randomDoor.getFactory() to get a shared instance. """ self.model = bs.getModel("powerup") self.modelSimple = bs.getModel("powerupSimple") self.kronkModel = bs.getModel("kronkHead") self.kronkModelSimple = bs.getModel("kronkHead") self.texKronk = bs.getTexture("kronk") self.texBomb = bs.getTexture("powerupBomb") self.texPunch = bs.getTexture("powerupPunch") self.texIceBombs = bs.getTexture("powerupIceBombs") self.texStickyBombs = bs.getTexture("powerupStickyBombs") self.texShield = bs.getTexture("powerupShield") self.texImpactBombs = bs.getTexture("powerupImpactBombs") self.texHealth = bs.getTexture("powerupHealth") self.texLandMines = bs.getTexture("powerupLandMines") self.texCurse = bs.getTexture("powerupCurse") self.texTNT = bs.getTexture("tnt") self.randTex = [self.texTNT, self.texPunch, self.texIceBombs, self.texStickyBombs, self.texImpactBombs, self.texCurse, self.texHealth, self.texLandMines, self.texShield] self.brickMaterial = bs.Material() self.impactSound = bs.getSound('impactMedium') self.brickMaterial.addActions(conditions=( ('theyDontHaveMaterial', bs.getSharedObject('playerMaterial')), 'and', ('theyHaveMaterial', bs.getSharedObject('objectMaterial')), 'or', ('theyHaveMaterial', bs.getSharedObject('footingMaterial'))), actions=( ('modifyNodeCollision', 'collide', True), # ('modifyPartCollision', 'friction', 1) )) # self.brickMaterial.addActions(conditions=('theyHaveMaterial', bs.getSharedObject('playerMaterial')), # actions=( # ('modifyPartCollision', 'physical', True), # ('message', 'ourNode', 'atConnect', changeOwnerMessage()))) self.brickMaterial.addActions( conditions=( ('theyHaveMaterial', self.brickMaterial) ), actions=(('modifyNodeCollision', 'collide', True)))
def onBegin(self): bs.TeamGameActivity.onBegin(self) self.setupStandardTimeLimit(self.settings['Time Limit']) self.setupStandardPowerupDrops() self._baseRegionMaterials = {} for team in self.teams: m = self._baseRegionMaterials[team.getID()] = bs.Material() m.addActions(conditions=('theyHaveMaterial', bs.getSharedObject('playerMaterial')), actions=(('modifyPartCollision', 'collide', True), ('modifyPartCollision', 'physical', False), ('call', 'atConnect', bs.Call(self._handleBaseCollide, team)))) # create a score region and flag for each team for team in self.teams: team.gameData['basePos'] = self.getMap().getFlagPosition( team.getID()) bs.newNode('light', attrs={ 'position': team.gameData['basePos'], 'intensity': 0.6, 'heightAttenuated': False, 'volumeIntensityScale': 0.1, 'radius': 0.1, 'color': team.color }) self.projectFlagStand(team.gameData['basePos']) team.gameData['flag'] = bs.Flag(touchable=False, position=team.gameData['basePos'], color=team.color) p = team.gameData['basePos'] region = bs.newNode('region', owner=team.gameData['flag'].node, attrs={ 'position': (p[0], p[1] + 0.75, p[2]), 'scale': (0.5, 0.5, 0.5), 'type': 'sphere', 'materials': [self._baseRegionMaterials[team.getID()]] })
def __init__(self, position=(0, 1, 0), color=(1, 0, 0), player=None): bs.Actor.__init__(self) self.radius = .6 self.position = position self.player = player self.color = color self.erupted = False self.volcanoMaterial = bs.Material() self.volcanoMaterial.addActions( conditions=(('theyHaveMaterial', bs.getSharedObject('playerMaterial'))), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("message", "theirNode", "atConnect", bs.DieMessage()), ("call", "atConnect", self.erupt))) self.node1 = bs.newNode('region', attrs={ 'position': (self.position[0], self.position[1], self.position[2]), 'scale': (self.radius, self.radius, self.radius), 'materials': [self.volcanoMaterial] }) self.light = bs.newNode('locator', attrs={ 'shape': 'circle', 'position': (self.position[0], self.position[1] - 2, self.position[2]), 'color': (1, 0, 0), 'opacity': 0.5, 'drawBeauty': True, 'additive': True }) bsUtils.animateArray(self.node1, "scale", 3, { 0: (0, 0, 0), 500: (self.radius, self.radius, self.radius) }) bs.gameTimer(10000, self.die)
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) self._puckMaterial = bs.Material() self._puckMaterial.addActions(actions=(("modifyPartCollision", "friction", 100000))) 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.pucks = [] self.flag = bs.Flag(color=(1, 1, 1), position=(0, 1, -2), touchable=True)
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) self._scoreBoard = bs.ScoreBoard() self.boxes = [] self.mines = [] # load some media we need 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.Flag.getFactory().flagMaterial), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("message", 'theirNode', 'atConnect', boxCrossMessage())))
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 = []
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) self._winSound = bs.getSound("score") 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.1))) 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()))) # dis is kill self._puckMaterial.addActions(conditions=("theyHaveMaterial",bs.getSharedObject('playerMaterial')), actions=(("modifyPartCollision","physical",False), ("message", "ourNode", "atConnect", PuckTouchedMessage()))) self._scoreBoard = bs.ScoreBoard() self._killsToWin = self.settings['Kills to Win'] self._scoreSound = bs.getSound("score") self.pucks = []
def __init__(self, settings={}): settings['map'] = 'Tower D' bs.CoopGameActivity.__init__(self, settings) try: self._preset = self.settings['preset'] except Exception: self._preset = 'pro' self._playerDeathSound = bs.getSound('playerDeath') self._newWaveSound = bs.getSound('scoreHit01') self._winSound = bs.getSound("score") self._cashRegisterSound = bs.getSound('cashRegister') self._badGuyScoreSound = bs.getSound("shieldDown") self._heartTex = bs.getTexture('heart') self._heartModelOpaque = bs.getModel('heartOpaque') self._heartModelTransparent = bs.getModel('heartTransparent') self._aPlayerHasBeenKilled = False self._spawnCenter = self._mapType.defs.points['spawn1'][0:3] self._tntSpawnPosition = self._mapType.defs.points['tntLoc'][0:3] self._powerupCenter = self._mapType.defs.boxes['powerupRegion'][0:3] self._powerupSpread = (self._mapType.defs.boxes['powerupRegion'][6] * 0.5, self._mapType.defs.boxes['powerupRegion'][8] * 0.5) self._scoreRegionMaterial = bs.Material() self._scoreRegionMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('playerMaterial')), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("call", "atConnect", self._handleReachedEnd))) self._lastWaveEndTime = bs.getGameTime() self._playerHasPickedUpPowerup = False
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) self._scoreBoard = bs.ScoreBoard() # load some media we need 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") # jasonhu5 self._playerMissions = {} # self.scoreRegionMaterial = bs.Material() self.scoreRegionMaterial.addActions( conditions=("theyHaveMaterial", bs.Flag.getFactory().flagMaterial), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("call", "atConnect", self._handleScore)))
def onTransitionIn(self): bs.TeamGameActivity.onTransitionIn( self, music='Epic Race' if self.settings['Epic Mode'] else 'Race') self._nubTex = bs.getTexture('nub') self._beep1Sound = bs.getSound('raceBeep1') self._beep2Sound = bs.getSound('raceBeep2') pts = self.getMap().getDefPoints('racePoint') m = self._raceRegionMaterial = bs.Material() m.addActions(conditions=("theyHaveMaterial", bs.getSharedObject('playerMaterial')), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("call", "atConnect", self._handleRacePointCollide))) self._regions = [] for pt in pts: self._regions.append(RaceRegion(pt, len(self._regions)))
def __init__(self): self.ballMaterial = bs.Material() self.ballMaterial.addActions( conditions=((('weAreYoungerThan', 5), 'or', ('theyAreYoungerThan', 50)), 'and', ('theyHaveMaterial', bs.getSharedObject('objectMaterial'))), actions=(('modifyNodeCollision', 'collide', False))) self.ballMaterial.addActions( conditions=('theyHaveMaterial', bs.getSharedObject('pickupMaterial')), actions=(('modifyPartCollision', 'useNodeCollide', False))) self.ballMaterial.addActions(actions=('modifyPartCollision', 'friction', 0)) self.ballMaterial.addActions( conditions=('theyHaveMaterial', bs.getSharedObject('playerMaterial')), actions=(('modifyPartCollision', 'physical', False), ('message', 'ourNode', 'atConnect', TouchedToSpaz()))) self.ballMaterial.addActions( conditions=(('theyDontHaveMaterial', bs.getSharedObject('playerMaterial')), 'and', ('theyHaveMaterial', bs.getSharedObject('objectMaterial'))), actions=('message', 'ourNode', 'atConnect', TouchedToAnything())) self.ballMaterial.addActions( conditions=(('theyDontHaveMaterial', bs.getSharedObject('playerMaterial')), 'and', ('theyHaveMaterial', bs.getSharedObject('footingMaterial'))), actions=('message', 'ourNode', 'atConnect', TouchedToFootingMaterial()))
def __init__(self, pos=(0, 5, 0), scale=1.35, owner=None): self.owner = owner bs.Actor.__init__(self) box_material = bs.Material() box_material.addActions( conditions=((('weAreYoungerThan', 0),'or',('theyAreYoungerThan', 0)), 'and', ('theyHaveMaterial', bs.getSharedObject('objectMaterial'))), actions=(('modifyNodeCollision', 'collide', True))) box_material.addActions(conditions=('theyHaveMaterial', bs.getSharedObject('pickupMaterial')), actions=(('modifyPartCollision', 'useNodeCollide', False))) box_material.addActions(actions=('modifyPartCollision','friction', 1000)) self.node = bs.newNode('prop', delegate=self, attrs={ 'position': pos, 'velocity': (0, 0, 0), 'model': bs.getModel('tnt'), 'modelScale': scale, 'body': 'crate', 'bodyScale': scale, 'shadowSize': 0.26 * scale, 'colorTexture': bs.getTexture(random.choice(["flagColor", "frameInset"])), 'reflection': 'soft', 'reflectionScale': [0.23], 'materials': (bs.getSharedObject('footingMaterial'), bs.getSharedObject('objectMaterial'))})
def __init__(self): self._lastPowerupType = None self.model = bs.getModel("powerup") self.modelSimple = bs.getModel("powerupSimple") self.texBomb = bs.getTexture("powerupBomb") self.texJumpingBomb = bs.getTexture("eggTex3") self.texPunch = bs.getTexture("powerupPunch") self.texYellowShield = bs.getTexture("coin") self.texKillLaKillBomb = bs.getTexture("black") self.texPoisonBomb = bs.getTexture("black") self.texSpeedPunch = bs.getTexture("achievementSuperPunch") self.texPandoraBox = bs.getTexture("black") self.texMultiBombs = bs.getTexture("logo") self.texFireworkBomb = bs.getTexture("eggTex1") self.texIceBombs = bs.getTexture("powerupIceBombs") self.texStickyBombs = bs.getTexture("powerupStickyBombs") self.texTpBombs = bs.getTexture("bombStickyColor") self.texShield = bs.getTexture("powerupShield") self.texImpactBombs = bs.getTexture("powerupImpactBombs") self.texHealth = bs.getTexture("powerupHealth") self.texLandMines = bs.getTexture("powerupLandMines") self.LandMinesModel = bs.getModel("frostyPelvis") self.texCurse = bs.getTexture("powerupCurse") self.texBalls = bs.getTexture("achievementOutline") self.texUnb = bs.getTexture("puckColor") self.texDirt = bs.getTexture('nub') #beggining of my powerups!!!;-; self.texSpeed = bs.getTexture("powerupSpeed") self.texAlan = bs.getTexture("agentIconColorMask") self.texRDM = bs.getTexture("logo") self.RandomCharacter = bs.getTexture("touchArrowsActions") self.Troll = bs.getTexture("star") self.texmj = bs.getTexture("agentIconColorMask") self.texMotion = bs.getTexture("usersButton") self.texInvisibility = bs.getTexture("cyborgIcon") self.texHiJump = bs.getTexture("buttonJump") self.texBallon = bs.getTexture('nextLevelIcon') self.texBlock = bs.getTexture('flagColor') self.texBox = bs.getTexture('achievementTNT') self.texiceImpact = bs.getTexture('bombColorIce') self.texGoldenBomb = bs.getTexture('bombColor') self.textbomb = bs.getTexture("buttonBomb") self.texgluebomb = bs.getTexture("eggTex2") self.texweedbomb = bs.getTexture("gameCenterIcon") self.texBot = bs.getTexture("achievementFreeLoader") self.texFloatingMine = bs.getTexture('achievementMine') self.texTouchMe = bs.getTexture('shield') self.texcelebrate = bs.getTexture("neoSpazIconColorMask") self.texRadius = bs.getTexture("night") self.texSleep = bs.getTexture("powerupSleep") self.texNight = bs.getTexture("shield") self.texSpazBomb = bs.getTexture("neoSpazIcon") self.texcurseBomb = bs.getTexture("powerupCurse") self.texhealBomb = bs.getTexture("night") self.texNightBomb = bs.getTexture("shield") self.texknockBomb = bs.getTexture("medalGold") self.texspeedBomb = bs.getTexture("achievementGotTheMoves") self.texcharacterBomb = bs.getTexture("chestOpenIcon") self.texmjBomb = bs.getTexture("menuButton") self.textrioBomb = bs.getTexture("star") self.texstickyIce = bs.getTexture("crossOutMask") self.texstickyIceTrio = bs.getTexture("egg4") self.texstickyIceMess = bs.getTexture("gameCenterIcon") self.teximpactMess = bs.getTexture("heart") self.texStickyMess = bs.getTexture("powerupStickyBombs") self.texIcyMess = bs.getTexture("night") self.texicyTrio = bs.getTexture("gameCircleIcon") self.texWeee = bs.getTexture("night") self.texboomBomb = bs.getTexture("achievementOffYouGo") self.texTnt = bs.getTexture("tnt") self.texName = bs.getTexture("achievementEmpty") self.texHighlight = bs.getTexture("tv") self.texSpotlight = bs.getTexture("black") self.texjumpFly = bs.getTexture("achievementOffYouGo") self.texblastBomb = bs.getTexture("achievementCrossHair") self.texrevengeBomb = bs.getTexture("achievementOutline") self.texSno = bs.getTexture("bunnyColor") self.snoModel = bs.getModel("frostyPelvis") self.texuse = bs.getTexture("achievementOutline") self.texBlackHole = bs.getTexture("circleOutlineNoAlpha") self.texSlippery = bs.getTexture("settingsIcon") self.texAntiGrav = bs.getTexture("achievementFootballShutout") self.healthPowerupSound = bs.getSound("healthPowerup") self.powerupSound = bs.getSound("ooh") self.powerdownSound = bs.getSound("pixie2") self.dropSound = bs.getSound("boxDrop") # material for powerups self.powerupMaterial = bs.Material() # material for anyone wanting to accept powerups self.powerupAcceptMaterial = bs.Material() # pass a powerup-touched message to applicable stuff self.powerupMaterial.addActions( conditions=(("theyHaveMaterial", self.powerupAcceptMaterial)), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("message", "ourNode", "atConnect", _TouchedMessage()))) # we dont wanna be picked up self.powerupMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('pickupMaterial')), actions=(("modifyPartCollision", "collide", True))) self.powerupMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('footingMaterial')), actions=(("impactSound", self.dropSound, 0.5, 0.1))) self._powerupDist = [] for p, freq in getDefaultPowerupDistribution(): for i in range(int(freq)): self._powerupDist.append(p)
def __init__(self): """ Instantiate a PowerupFactory. You shouldn't need to do this; call bs.Powerup.getFactory() to get a shared instance. """ self._lastPowerupType = None self.model = bs.getModel("powerup") self.modelSimple = bs.getModel("powerupSimple") self.texBomb = bs.getTexture("powerupBomb") self.texPunch = bs.getTexture("powerupPunch") self.texSpeed = bs.getTexture("achievementGotTheMoves") self.texRchar = bs.getTexture("achievementEmpty") self.texInv = bs.getTexture("achievementMedalSmall") self.texTroll = bs.getTexture("achievementOffYouGo") self.texParty = bs.getTexture("eggTex1") self.texBunny = bs.getTexture('achievementFreeLoader') self.texBot = bs.getTexture('star') self.texIceBombs = bs.getTexture("powerupIceBombs") self.texStickyBombs = bs.getTexture("powerupStickyBombs") self.texShield = bs.getTexture("powerupShield") self.texImpactBombs = bs.getTexture("powerupImpactBombs") self.texHealth = bs.getTexture("powerupHealth") self.texLandMines = bs.getTexture("powerupLandMines") self.texCurse = bs.getTexture("powerupCurse") self.texiceMine = bs.getTexture("gameCircleIcon") self.textrioBomb = bs.getTexture("crossOutMask") self.healthPowerupSound = bs.getSound("healthPowerup") self.powerupSound = bs.getSound("powerup01") self.powerdownSound = bs.getSound("powerdown01") self.dropSound = bs.getSound("boxDrop") # material for powerups self.powerupMaterial = bs.Material() # material for anyone wanting to accept powerups self.powerupAcceptMaterial = bs.Material() # pass a powerup-touched message to applicable stuff self.powerupMaterial.addActions( conditions=(("theyHaveMaterial",self.powerupAcceptMaterial)), actions=(("modifyPartCollision","collide",True), ("modifyPartCollision","physical",False), ("message","ourNode","atConnect",_TouchedMessage()))) # we dont wanna be picked up self.powerupMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('pickupMaterial')), actions=( ("modifyPartCollision","collide",False))) self.powerupMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('footingMaterial')), actions=(("impactSound",self.dropSound,0.5,0.1))) self._powerupDist = [] for p,freq in getDefaultPowerupDistribution(): for i in range(int(freq)): self._powerupDist.append(p)
def __init__(self): """ Instantiate a BombFactory. You shouldn't need to do this; call bs.Bomb.getFactory() to get a shared instance. """ self.bombModel = bs.getModel('frostyHead') self.stickyBombModel = bs.getModel('zoeHead') self.impactBombModel = bs.getModel('impactBomb') self.landMineModel = bs.getModel('flagPole') self.tntModel = bs.getModel('tnt') self.regularTex = bs.getTexture('eggTex1') self.iceTex = bs.getTexture('egg2') self.stickyTex = bs.getTexture('bombStickyColor') self.impactTex = bs.getTexture('impactBombColor') self.impactLitTex = bs.getTexture('impactBombColorLit') self.landMineTex = bs.getTexture('landMine') self.landMineLitTex = bs.getTexture('landMineLit') self.tntTex = bs.getTexture('landMineLit') self.atomTex = bs.getTexture('tnt') self.hissSound = bs.getSound('hiss') self.debrisFallSound = bs.getSound('debrisFall') self.woodDebrisFallSound = bs.getSound('woodDebrisFall') self.explodeSounds = (bs.getSound('explosion01'), bs.getSound('explosion02'), bs.getSound('explosion03'), bs.getSound('explosion04'), bs.getSound('explosion05')) self.freezeSound = bs.getSound('freeze') self.fuseSound = bs.getSound('fuse01') self.activateSound = bs.getSound('activateBeep') self.warnSound = bs.getSound('warnBeep') # set up our material so new bombs dont collide with objects # that they are initially overlapping self.bombMaterial = bs.Material() self.normalSoundMaterial = bs.Material() self.stickyMaterial = bs.Material() self.bombMaterial.addActions( conditions=((('weAreYoungerThan',100),'or',('theyAreYoungerThan',100)), 'and',('theyHaveMaterial',bs.getSharedObject('objectMaterial'))), actions=(('modifyNodeCollision','collide',False))) # we want pickup materials to always hit us even if we're currently not # colliding with their node (generally due to the above rule) self.bombMaterial.addActions( conditions=('theyHaveMaterial',bs.getSharedObject('pickupMaterial')), actions=(('modifyPartCollision','useNodeCollide',False))) self.bombMaterial.addActions(actions=('modifyPartCollision','friction',0.3)) self.landMineNoExplodeMaterial = bs.Material() self.landMineBlastMaterial = bs.Material() self.landMineBlastMaterial.addActions( conditions=(('weAreOlderThan',200), 'and',('theyAreOlderThan',200), 'and',('evalColliding',), 'and',(('theyDontHaveMaterial',self.landMineNoExplodeMaterial), 'and',(('theyHaveMaterial',bs.getSharedObject('objectMaterial')), 'or',('theyHaveMaterial',bs.getSharedObject('playerMaterial'))))), actions=(('message','ourNode','atConnect',ImpactMessage()))) self.impactBlastMaterial = bs.Material() self.impactBlastMaterial.addActions( conditions=(('weAreOlderThan',200), 'and',('theyAreOlderThan',200), 'and',('evalColliding',), 'and',(('theyHaveMaterial',bs.getSharedObject('footingMaterial')), 'or',('theyHaveMaterial',bs.getSharedObject('objectMaterial')))), actions=(('message','ourNode','atConnect',ImpactMessage()))) self.blastMaterial = bs.Material() self.blastMaterial.addActions( conditions=(('theyHaveMaterial',bs.getSharedObject('objectMaterial'))), actions=(('modifyPartCollision','collide',True), ('modifyPartCollision','physical',False), ('message','ourNode','atConnect',ExplodeHitMessage()))) self.dinkSounds = (bs.getSound('bombDrop01'), bs.getSound('bombDrop02')) self.stickyImpactSound = bs.getSound('stickyImpact') self.rollSound = bs.getSound('bombRoll01') # collision sounds self.normalSoundMaterial.addActions( conditions=('theyHaveMaterial',bs.getSharedObject('footingMaterial')), actions=(('impactSound',self.dinkSounds,2,0.8), ('rollSound',self.rollSound,3,6))) self.stickyMaterial.addActions( actions=(('modifyPartCollision','stiffness',0.1), ('modifyPartCollision','damping',1.0))) self.stickyMaterial.addActions( conditions=(('theyHaveMaterial',bs.getSharedObject('playerMaterial')),'or',('theyHaveMaterial',bs.getSharedObject('footingMaterial'))), actions=(('message','ourNode','atConnect',SplatMessage())))
def __init__(self): """ Instantiate a PowerupFactory. You shouldn't need to do this; call bs.Powerup.getFactory() to get a shared instance. """ self._lastPowerupType = None self.model = bs.getModel("powerup") self.modelSimple = bs.getModel("powerupSimple") self.texSpeed = bs.getTexture("achievementGotTheMoves") self.texBomb = bs.getTexture("powerupBomb") self.texPunch = bs.getTexture("powerupPunch") self.texIceBombs = bs.getTexture("powerupIceBombs") self.texStickyBombs = bs.getTexture("powerupStickyBombs") self.texAtomBombs = bs.getTexture('eggTex') self.texShield = bs.getTexture("powerupShield") self.texImpactBombs = bs.getTexture("powerupImpactBombs") self.texHealth = bs.getTexture("powerupHealth") self.texLandMines = bs.getTexture("powerupLandMines") self.texCurse = bs.getTexture("powerupCurse") self.texIvincible = bs.getTexture("achievementFlawlessVictory") self.texLuckyBlock = bs.getTexture("achievementEmpty") self.shockWaveTex = bs.getTexture("medalGold") self.texEgg = bs.getTexture('eggTex2') self.texSno = bs.getTexture( "bunnyColor") #Bunny is most uniform plain white color. self.snoModel = bs.getModel("frostyPelvis") self.texSlow = bs.getTexture('coin') self.texNight = bs.getTexture('empty') self.inv = bs.getTexture('rock') self.healthPowerupSound = bs.getSound("healthPowerup") self.powerupSound = bs.getSound("powerup01") self.powerdownSound = bs.getSound("powerdown01") self.dropSound = bs.getSound("boxDrop") # material for powerups self.powerupMaterial = bs.Material() # material for anyone wanting to accept powerups self.powerupAcceptMaterial = bs.Material() # pass a powerup-touched message to applicable stuff self.powerupMaterial.addActions( conditions=(("theyHaveMaterial", self.powerupAcceptMaterial)), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("message", "ourNode", "atConnect", _TouchedMessage()))) # we dont wanna be picked up self.powerupMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('pickupMaterial')), actions=(("modifyPartCollision", "collide", False))) self.powerupMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('footingMaterial')), actions=(("impactSound", self.dropSound, 0.5, 0.1))) self._powerupDist = [] for p, freq in getDefaultPowerupDistribution(): for i in range(int(freq)): self._powerupDist.append(p)
def __init__(self): self._lastPowerupType = None self.model = bs.getModel("powerup") self.modelSimple = bs.getModel("powerupSimple") self.texBomb = bs.getTexture("powerupBomb") self.texJumpingBomb = bs.getTexture("eggTex3") self.texPunch = bs.getTexture("powerupPunch") self.texYellowShield = bs.getTexture("coin") self.texKillLaKillBomb = bs.getTexture("black") self.texPoisonBomb = bs.getTexture("black") self.texSpeedPunch = bs.getTexture("achievementSuperPunch") self.texPandoraBox = bs.getTexture("chestIcon") self.texMultiBombs = bs.getTexture("logo") self.texFireworkBomb = bs.getTexture("eggTex1") self.texIceBombs = bs.getTexture("powerupIceBombs") self.texStickyBombs = bs.getTexture("powerupStickyBombs") self.texTpBombs = bs.getTexture("bombStickyColor") self.texShield = bs.getTexture("powerupShield") self.texImpactBombs = bs.getTexture("powerupImpactBombs") self.texHealth = bs.getTexture("powerupHealth") self.texLandMines = bs.getTexture("powerupLandMines") self.texCurse = bs.getTexture("powerupCurse") self.texBalls = bs.getTexture("achievementOutline") self.texUnb = bs.getTexture("puckColor") self.texDirt = bs.getTexture('nub') self.healthPowerupSound = bs.getSound("healthPowerup") self.powerupSound = bs.getSound("powerup01") self.powerdownSound = bs.getSound("pixie2") self.dropSound = bs.getSound("boxDrop") # material for powerups self.powerupMaterial = bs.Material() # material for anyone wanting to accept powerups self.powerupAcceptMaterial = bs.Material() # pass a powerup-touched message to applicable stuff self.powerupMaterial.addActions( conditions=(("theyHaveMaterial", self.powerupAcceptMaterial)), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("message", "ourNode", "atConnect", _TouchedMessage()))) # we dont wanna be picked up self.powerupMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('pickupMaterial')), actions=(("modifyPartCollision", "collide", True))) self.powerupMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('footingMaterial')), actions=(("impactSound", self.dropSound, 0.5, 0.1))) self._powerupDist = [] for p, freq in getDefaultPowerupDistribution(): for i in range(int(freq)): self._powerupDist.append(p)
def onTeamJoin(self, team): team.gameData['score'] = 0 team.gameData['flagReturnTouches'] = 0 team.gameData['homeFlagAtBase'] = True team.gameData['touchReturnTimer'] = None team.gameData['enemyFlagAtBase'] = False team.gameData['basePos'] = self.getMap().getFlagPosition(team.getID()) self.projectFlagStand(team.gameData['basePos']) bs.newNode('light', attrs={ 'position': team.gameData['basePos'], 'intensity': 0.6, 'heightAttenuated': False, 'volumeIntensityScale': 0.1, 'radius': 0.1, 'color': team.color }) baseRegionMat = team.gameData['baseRegionMaterial'] = bs.Material() p = team.gameData['basePos'] team.gameData['baseRegion'] = bs.newNode( "region", attrs={ 'position': (p[0], p[1] + 0.75, p[2]), 'scale': (0.5, 0.5, 0.5), 'type': 'sphere', 'materials': [baseRegionMat, self._allBasesMaterial] }) # create some materials for this team spazMatNoFlagPhysical = team.gameData[ 'spazMaterialNoFlagPhysical'] = bs.Material() spazMatNoFlagCollide = team.gameData[ 'spazMaterialNoFlagCollide'] = bs.Material() flagMat = team.gameData['flagMaterial'] = bs.Material() # some parts of our spazzes don't collide physically with our # flags but generate callbacks spazMatNoFlagPhysical.addActions( conditions=('theyHaveMaterial', flagMat), actions=(('modifyPartCollision', 'physical', False), ('call', 'atConnect', lambda: self._handleHitOwnFlag(team, 1)), ('call', 'atDisconnect', lambda: self._handleHitOwnFlag(team, 0)))) # other parts of our spazzes don't collide with our flags at all spazMatNoFlagCollide.addActions(conditions=('theyHaveMaterial', flagMat), actions=('modifyPartCollision', 'collide', False)) # we wanna know when *any* flag enters/leaves our base baseRegionMat.addActions( conditions=('theyHaveMaterial', bs.Flag.getFactory().flagMaterial), actions=(('modifyPartCollision', 'collide', True), ('modifyPartCollision', 'physical', False), ('call', 'atConnect', lambda: self._handleFlagEnteredBase(team)), ('call', 'atDisconnect', lambda: self._handleFlagLeftBase(team)))) self._spawnFlagForTeam(team) self._updateScoreBoard()
def __init__(self): """ Instantiate a PowerupFactory. You shouldn't need to do this; call bs.Powerup.getFactory() to get a shared instance. """ self._lastPowerupType = None self.model = bs.getModel("powerup") self.modelSimple = bs.getModel("powerupSimple") self.texBomb = bs.getTexture("powerupBomb") self.texPunch = bs.getTexture("powerupPunch") self.texIceBombs = bs.getTexture("powerupIceBombs") self.texStickyBombs = bs.getTexture("powerupStickyBombs") self.texShield = bs.getTexture("powerupShield") self.texImpactBombs = bs.getTexture("powerupImpactBombs") self.texPortal = bs.getTexture("coin") self.texRainbow = bs.getTexture("achievementFlawlessVictory") self.texHealth = bs.getTexture("powerupHealth") self.texLandMines = bs.getTexture("powerupLandMines") self.texcurseBomb = bs.getTexture("powerupCurse") self.texHeatSeeker = bs.getTexture("landMineLit") self.texQuake = bs.getTexture("levelIcon") self.texCurse = random.choice( (bs.getTexture("powerupHealth"), bs.getTexture("powerupShield"))) self.texDroneStrike = bs.getTexture("sparks") self.texAim = bs.getTexture("ouyaAButton") self.texBubblePower = bs.getTexture("light") self.texTriggerBombs = bs.getTexture("egg4") self.texClusterBombs = bs.getTexture("menuIcon") self.healthPowerupSound = bs.getSound("healthPowerup") self.powerupSound = bs.getSound("powerup01") self.powerdownSound = bs.getSound("powerdown01") self.dropSound = bs.getSound("boxDrop") # material for powerups self.powerupMaterial = bs.Material() # material for anyone wanting to accept powerups self.powerupAcceptMaterial = bs.Material() # pass a powerup-touched message to applicable stuff self.powerupMaterial.addActions( conditions=(("theyHaveMaterial", self.powerupAcceptMaterial)), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("message", "ourNode", "atConnect", _TouchedMessage()))) # we dont wanna be picked up if not some.interactive_powerups: self.powerupMaterial.addActions( conditions=("theyHaveMaterial",bs.getSharedObject('pickupMaterial')), actions=( ("modifyPartCollision","collide",False))) self.powerupMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('footingMaterial')), actions=(("impactSound", self.dropSound, 0.5, 0.1))) self._powerupDist = [] for p, freq in getDefaultPowerupDistribution(): for i in range(int(freq)): self._powerupDist.append(p)
def __init__(self, position1=(0, 1, 0), color=(random.random(), random.random(), random.random()), r=1.0, activity=None): bs.Actor.__init__(self) self.radius = r if position1 is None: self.position1 = self.getRandomPosition(activity) else: self.position1 = position1 self.position2 = self.getRandomPosition(activity) self.portal1Material = bs.Material() self.portal1Material.addActions( conditions=(('theyHaveMaterial', bs.getSharedObject('playerMaterial'))), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("call", "atConnect", self.Portal1))) self.portal2Material = bs.Material() self.portal2Material.addActions( conditions=(('theyHaveMaterial', bs.getSharedObject('playerMaterial'))), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("call", "atConnect", self.Portal2))) # uncomment the following lines to teleport objects also # self.portal1Material.addActions(conditions=(('theyHaveMaterial', bs.getSharedObject('objectMaterial')),'and',('theyDontHaveMaterial', bs.getSharedObject('playerMaterial'))),actions=(("modifyPartCollision","collide",True), # ("modifyPartCollision","physical",False), # ("call","atConnect", self.objPortal1))) # self.portal2Material.addActions(conditions=(('theyHaveMaterial', bs.getSharedObject('objectMaterial')),'and',('theyDontHaveMaterial', bs.getSharedObject('playerMaterial'))),actions=(("modifyPartCollision","collide",True), # ("modifyPartCollision","physical",False), # ("call","atConnect", self.objPortal2))) self.node1 = bs.newNode('region', attrs={ 'position': (self.position1[0], self.position1[1], self.position1[2]), 'scale': (self.radius, self.radius, self.radius), 'type': 'sphere', 'materials': [self.portal1Material] }) self.visualRadius = bs.newNode('shield', attrs={ 'position': self.position1, 'color': color, 'radius': 0.1 }) bsUtils.animate(self.visualRadius, "radius", { 0: 0, 500: self.radius * 2 }) bsUtils.animateArray(self.node1, "scale", 3, { 0: (0, 0, 0), 500: (self.radius, self.radius, self.radius) }) self.node2 = bs.newNode('region', attrs={ 'position': (self.position2[0], self.position2[1], self.position2[2]), 'scale': (self.radius, self.radius, self.radius), 'type': 'sphere', 'materials': [self.portal2Material] }) self.visualRadius2 = bs.newNode('shield', attrs={ 'position': self.position2, 'color': color, 'radius': 0.1 }) bsUtils.animate(self.visualRadius2, "radius", { 0: 0, 500: self.radius * 2 }) bsUtils.animateArray(self.node2, "scale", 3, { 0: (0, 0, 0), 500: (self.radius, self.radius, self.radius) })
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._ballModel = bs.getModel("shield") self._ballTex = bs.getTexture("eggTex1") self._ballSound = bs.getSound("impactMedium2") self._flagKaleTex = bs.getTexture("star") self._kaleSound = bs.getSound("metalHit") self._nightModel = bs.getModel("shield") self._nightTex = bs.getTexture("black") self._kaleMaterial = bs.Material() #add friction to flags for standing our position (as far as) self._kaleMaterial.addActions(conditions=("theyHaveMaterial",bs.getSharedObject('footingMaterial')), actions=( ("modifyPartCollision","friction",9999.5))) self._kaleMaterial.addActions(conditions=("theyHaveMaterial",bs.getSharedObject('pickupMaterial')), actions=( ("modifyPartCollision","collide",False) ) ) self._kaleMaterial.addActions(conditions=( ("weAreYoungerThan",100),'and', ("theyHaveMaterial",bs.getSharedObject('objectMaterial')) ), actions=( ("modifyNodeCollision","collide",False) ) ) #dont collide with bombs #FIXME "standing" self._kaleMaterial.addActions(conditions=("theyHaveMaterial",bs.Bomb.getFactory().blastMaterial), actions=(("modifyPartCollision","collide",False), ("modifyPartCollision","physical",False))) self._kaleMaterial.addActions(conditions=("theyHaveMaterial",bs.Bomb.getFactory().bombMaterial), actions=(("modifyPartCollision","collide",False), ("modifyPartCollision","physical",False))) self._kaleMaterial.addActions( conditions=('theyHaveMaterial',bs.getSharedObject('objectMaterial')), actions=(('impactSound',self._kaleSound,2,5))) #we dont wanna hit the night so self._nightMaterial = bs.Material() self._nightMaterial.addActions( conditions=(('theyHaveMaterial',bs.getSharedObject('pickupMaterial')),'or', ('theyHaveMaterial',bs.getSharedObject('attackMaterial'))), actions=(('modifyPartCollision','collide',False))) # we also dont want anything moving it self._nightMaterial.addActions( conditions=(('theyHaveMaterial',bs.getSharedObject('objectMaterial')),'or', ('theyDontHaveMaterial',bs.getSharedObject('footingMaterial'))), actions=(('modifyPartCollision','collide',False), ('modifyPartCollision','physical',False))) self._ballMaterial = bs.Material() self._ballMaterial.addActions(actions=( ("modifyPartCollision","friction",0.75))) self._ballMaterial.addActions(conditions=("theyHaveMaterial",bs.getSharedObject('pickupMaterial')), actions=( ("modifyPartCollision","collide",False) ) ) self._ballMaterial.addActions(conditions=( ("weAreYoungerThan",100),'and', ("theyHaveMaterial",bs.getSharedObject('objectMaterial')) ), actions=( ("modifyNodeCollision","collide",False) ) ) self._ballMaterial.addActions(conditions=("theyHaveMaterial",bs.getSharedObject('footingMaterial')), actions=(("impactSound",self._ballSound,2,0.8))) # keep track of which player last touched the ball self._ballMaterial.addActions(conditions=("theyHaveMaterial",bs.getSharedObject('playerMaterial')), actions=(("call","atConnect",self._handleBallPlayerCollide),)) # we want the ball to kill powerups; not get stopped by them self._ballMaterial.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._ballMaterial), actions=(("modifyPartCollision","collide",True), ("modifyPartCollision","physical",False), ("call","atConnect",self._handleScore)))
def __init__(self, settings): bs.TeamGameActivity.__init__(self, settings) 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': "Created by MattZ45986 on Github", })) self._safeZoneMaterial = bs.Material() self._scoredis = bs.ScoreBoard() self._safeZoneMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('playerMaterial')), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("call", "atConnect", bs.Call(self.handleSafeZoneEnter)))) self.safeZone1 = bs.newNode( 'region', attrs={ 'position': (-11, 0, 0), 'scale': (1.8, 1.8, 1.8), 'type': 'sphere', 'materials': [self._safeZoneMaterial, bs.getSharedObject('regionMaterial')] }) self.safeZone2 = bs.newNode( 'region', attrs={ 'position': (11, 0, 0), 'scale': (1.8, 1.8, 1.8), 'type': 'sphere', 'materials': [self._safeZoneMaterial, bs.getSharedObject('regionMaterial')] }) self.zoneLocator1 = bs.newNode('locator', attrs={ 'shape': 'circle', 'position': (-11, 0, 0), 'color': (1, 1, 1), 'opacity': 1, 'drawBeauty': True, 'additive': True }) bs.animateArray(self.zoneLocator1, 'size', 1, { 0: [0.0], 200: [1.8 * 2.0] }) self.zoneLocator2 = bs.newNode('locator', attrs={ 'shape': 'circle', 'position': (11, 0, 0), 'color': (1, 1, 1), 'opacity': 1, 'drawBeauty': True, 'additive': True }) bs.animateArray(self.zoneLocator2, 'size', 1, { 0: [0.0], 200: [1.8 * 2.0] })
def __init__(self): """ Instantiate a PowerupFactory. You shouldn't need to do this; call bs.Powerup.getFactory() to get a shared instance. """ self._lastPowerupType = None self.model = bs.getModel("powerup") self.modelSimple = bs.getModel("powerupSimple") self.texBot = bs.getTexture("achievementFreeLoader") self.texGoldenBomb = bs.getTexture('bombColor') self.texInvincible = bs.getTexture("star") self.texCineticTrap = bs.getTexture("upButton") self.texBallon = bs.getTexture('nextLevelIcon') self.texPlantBomb = bs.getTexture('buttonBomb') self.texFloatingMine = bs.getTexture('achievementMine') self.texSmokeBomb = bs.getTexture('achievementOnslaught') self.texJump = bs.getTexture('achievementOffYouGo') self.texBlock = bs.getTexture('flagColor') self.texIceImpact = bs.getTexture('bombColorIce') self.texBomb = bs.getTexture("powerupBomb") self.texPunch = bs.getTexture("powerupPunch") self.texIceBombs = bs.getTexture("powerupIceBombs") self.texStickyBombs = bs.getTexture("powerupStickyBombs") self.texShield = bs.getTexture("powerupShield") self.texImpactBombs = bs.getTexture("powerupImpactBombs") self.texHealth = bs.getTexture("powerupHealth") self.texLandMines = bs.getTexture("powerupLandMines") self.texCurse = bs.getTexture("powerupCurse") self.healthPowerupSound = bs.getSound("healthPowerup") self.powerupSound = bs.getSound("powerup01") self.powerdownSound = bs.getSound("powerdown01") self.dropSound = bs.getSound("boxDrop") # material for powerups self.powerupMaterial = bs.Material() # material for anyone wanting to accept powerups self.powerupAcceptMaterial = bs.Material() # pass a powerup-touched message to applicable stuff self.powerupMaterial.addActions( conditions=(("theyHaveMaterial", self.powerupAcceptMaterial)), actions=(("modifyPartCollision", "collide", True), ("modifyPartCollision", "physical", False), ("message", "ourNode", "atConnect", _TouchedMessage()))) # we dont wanna be picked up self.powerupMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('pickupMaterial')), actions=(("modifyPartCollision", "collide", False))) self.powerupMaterial.addActions( conditions=("theyHaveMaterial", bs.getSharedObject('footingMaterial')), actions=(("impactSound", self.dropSound, 0.5, 0.1))) self._powerupDist = [] for p, freq in getDefaultPowerupDistribution(): for i in range(int(freq)): self._powerupDist.append(p)