def spawnPlayer(self, player):
        position = self.getMap().getFFAStartPosition(self.players)
        angle = None
        name = player.getName()
        lightColor = bsUtils.getNormalizedColor(player.color)
        displayColor = bs.getSafeColor(player.color, targetIntensity=0.75)

        spaz = NewPlayerSpaz(color=player.color,
                             highlight=player.highlight,
                             character=player.character,
                             player=player)
        player.setActor(spaz)
        player.gameData['boxes'] = 0

        spaz.node.name = name
        spaz.node.nameColor = displayColor
        spaz.connectControlsToPlayer(enablePickUp=False)
        if self.settings['Equip Boxing Gloves']:
            spaz.equipBoxingGloves()
        if self.settings['Equip Shield']:
            spaz.equipShields()

        spaz.playBigDeathSound = True
        self.scoreSet.playerGotNewSpaz(player, spaz)

        spaz.handleMessage(
            bs.StandMessage(
                position,
                angle if angle is not None else random.uniform(0, 360)))
        t = bs.getGameTime()
        bs.playSound(self._spawnSound, 1, position=spaz.node.position)
        light = bs.newNode('light', attrs={'color': lightColor})
        spaz.node.connectAttr('position', light, 'position')
        bsUtils.animate(light, 'intensity', {0: 0, 250: 1, 500: 0})
        bs.gameTimer(500, light.delete)
Exemple #2
0
	def spawnPlayer(self, player):



		if isinstance(self.getSession(), bs.TeamsSession):
			position = self.getMap().getStartPosition(player.getTeam().getID())
		else:
			# otherwise do free-for-all spawn locations
			position = self.getMap().getFFAStartPosition(self.players)

		angle = None


		#spaz = self.spawnPlayerSpaz(player)

		# lets reconnect this player's controls to this
		# spaz but *without* the ability to attack or pick stuff up
		#spaz.connectControlsToPlayer(enablePunch=False,
		#							 enableBomb=False,
		#							 enablePickUp=False)

		# also lets have them make some noise when they die..
		#spaz.playBigDeathSound = True

		name = player.getName()

		lightColor = bsUtils.getNormalizedColor(player.color)
		displayColor = bs.getSafeColor(player.color, targetIntensity=0.75)

		spaz = Player(color=player.color,
							 highlight=player.highlight,
							 character=player.character,
							 player=player)
		player.setActor(spaz)

		# we want a bigger area-of-interest in co-op mode
		# if isinstance(self.getSession(),bs.CoopSession): spaz.node.areaOfInterestRadius = 5.0
		# else: spaz.node.areaOfInterestRadius = 5.0

		# if this is co-op and we're on Courtyard or Runaround, add the material that allows us to
		# collide with the player-walls
		# FIXME; need to generalize this
		if isinstance(self.getSession(), bs.CoopSession) and self.getMap().getName() in ['Courtyard', 'Tower D']:
			mat = self.getMap().preloadData['collideWithWallMaterial']
			spaz.node.materials += (mat,)
			spaz.node.rollerMaterials += (mat,)

		spaz.node.name = name
		spaz.node.nameColor = displayColor
		spaz.connectControlsToPlayer( enableJump=True, enablePunch=True, enablePickUp=False, enableBomb=True, enableRun=True, enableFly=False)
		self.scoreSet.playerGotNewSpaz(player,spaz)

		# move to the stand position and add a flash of light
		spaz.handleMessage(bs.StandMessage(position,angle if angle is not None else random.uniform(0, 360)))
		t = bs.getGameTime()
		bs.playSound(self._spawnSound, 1, position=spaz.node.position)
		light = bs.newNode('light', attrs={'color': lightColor})
		spaz.node.connectAttr('position', light, 'position')
		bsUtils.animate(light, 'intensity', {0:0, 250:1, 500:0})
		bs.gameTimer(500, light.delete)
Exemple #3
0
    def spawnPlayerSpaz(self, player, position=(0, 0, 0), angle=None):
        name = player.getName()
        color = player.color
        highlight = player.highlight

        lightColor = bsUtils.getNormalizedColor(color)
        displayColor = bs.getSafeColor(color, targetIntensity=0.75)
        spaz = AntiGravityPlayerSpaz(color=color,
                                     highlight=highlight,
                                     character=player.character,
                                     player=player)
        player.setActor(spaz)
        if isinstance(self.getSession(),
                      bs.CoopSession) and self.getMap().getName() in [
                          'Courtyard', 'Tower D'
                      ]:
            mat = self.getMap().preloadData['collideWithWallMaterial']
            spaz.node.materials += (mat, )
            spaz.node.rollerMaterials += (mat, )
        spaz.node.name = name
        spaz.node.nameColor = displayColor
        spaz.connectControlsToPlayer()
        spaz.handleMessage(
            bs.StandMessage(
                position,
                angle if angle is not None else random.uniform(0, 360)))
        t = bs.getGameTime()
        bs.playSound(self._spawnSound, 1, position=spaz.node.position)
        light = bs.newNode('light', attrs={'color': lightColor})
        spaz.node.connectAttr('position', light, 'position')
        bsUtils.animate(light, 'intensity', {0: 0, 250: 1, 500: 0})
        bs.gameTimer(500, light.delete)
        bs.gameTimer(1000, bs.Call(self.raisePlayer, player))
        return spaz
    def spawnPlayer(self, player):

        position = self.getMap().getFFAStartPosition(self.players)
        angle = 20
        name = player.getName()

        lightColor = bsUtils.getNormalizedColor(player.color)
        displayColor = bs.getSafeColor(player.color, targetIntensity=0.75)

        spaz = BrickMan(color=player.color,
                        highlight=player.highlight,
                        character=player.character,
                        player=player)
        player.setActor(spaz)

        spaz.node.name = '建筑师\n'.decode('utf8') + name
        spaz.node.nameColor = displayColor
        spaz.connectControlsToPlayer()
        self.scoreSet.playerGotNewSpaz(player, spaz)

        # move to the stand position and add a flash of light
        spaz.handleMessage(bs.StandMessage(position, angle if angle is not None else random.uniform(0, 360)))
        t = bs.getGameTime()
        bs.playSound(self._spawnSound, 1, position=spaz.node.position)
        light = bs.newNode('light', attrs={'color': lightColor})
        spaz.node.connectAttr('position', light, 'position')
        bsUtils.animate(light, 'intensity', {0: 0, 250: 1, 500: 0})
        bs.gameTimer(500, light.delete)

        spaz.connectControlsToPlayer(enablePunch=True,
                                     enableBomb=True,
                                     enablePickUp=False)
        spaz.playBigDeathSound = True
        spaz.initArchitect()
        return spaz
    def spawnPlayer(self, player):

        if isinstance(self.getSession(), bs.TeamsSession):
            position = self.getMap().getStartPosition(player.getTeam().getID())
        else:
            # otherwise do free-for-all spawn locations
            position = self.getMap().getFFAStartPosition(self.players)

        angle = None

        # spaz = self.spawnPlayerSpaz(player)

        # lets reconnect this player's controls to this
        # spaz but *without* the ability to attack or pick stuff up
        # spaz.connectControlsToPlayer(enablePunch=False,
        # 							 enableBomb=False,
        # 							 enablePickUp=False)

        # also lets have them make some noise when they die..
        # spaz.playBigDeathSound = True

        name = player.getName()

        lightColor = bsUtils.getNormalizedColor(player.color)
        displayColor = bs.getSafeColor(player.color, targetIntensity=0.75)

        spaz = Player(color=player.color, highlight=player.highlight, character=player.character, player=player)
        player.setActor(spaz)

        # we want a bigger area-of-interest in co-op mode
        # if isinstance(self.getSession(),bs.CoopSession): spaz.node.areaOfInterestRadius = 5.0
        # else: spaz.node.areaOfInterestRadius = 5.0

        # if this is co-op and we're on Courtyard or Runaround, add the material that allows us to
        # collide with the player-walls
        # FIXME; need to generalize this
        if isinstance(self.getSession(), bs.CoopSession) and self.getMap().getName() in ["Courtyard", "Tower D"]:
            mat = self.getMap().preloadData["collideWithWallMaterial"]
            spaz.node.materials += (mat,)
            spaz.node.rollerMaterials += (mat,)

        spaz.node.name = name
        spaz.node.nameColor = displayColor
        spaz.connectControlsToPlayer(
            enableJump=True, enablePunch=True, enablePickUp=False, enableBomb=True, enableRun=True, enableFly=False
        )
        self.scoreSet.playerGotNewSpaz(player, spaz)

        # move to the stand position and add a flash of light
        spaz.handleMessage(bs.StandMessage(position, angle if angle is not None else random.uniform(0, 360)))
        t = bs.getGameTime()
        bs.playSound(self._spawnSound, 1, position=spaz.node.position)
        light = bs.newNode("light", attrs={"color": lightColor})
        spaz.node.connectAttr("position", light, "position")
        bsUtils.animate(light, "intensity", {0: 0, 250: 1, 500: 0})
        bs.gameTimer(500, light.delete)
Exemple #6
0
    def spawnPlayer(self, player):

        position = self.getMap().getFFAStartPosition(self.players)
        angle = 20
        name = player.getName()

        lightColor = bsUtils.getNormalizedColor(player.color)
        displayColor = bs.getSafeColor(player.color, targetIntensity=0.75)

        spaz = grimPlayer(color=player.color,
                          highlight=player.highlight,
                          character=player.character,
                          player=player,
                          gameProtectionTime=self.settings['Protection Time After Catching'],
                          hitPoints=self.settings['Player HP'])
        player.setActor(spaz)
        # For some reason, I can't figure out how to get a list of all spaz.
        # Therefore, I am making the list here so I can get which spaz belongs
        # to the player supplied by HitMessage.
        # self.playerList.append(spaz)

        spaz.node.name = name
        spaz.node.nameColor = displayColor
        spaz.connectControlsToPlayer()
        self.scoreSet.playerGotNewSpaz(player, spaz)

        # add landmine
        spaz.bombTypeDefault = 'landMine'  # random.choice(['ice', 'impact', 'landMine', 'normal', 'sticky', 'tnt'])
        spaz.bombType = spaz.bombTypeDefault

        # move to the stand position and add a flash of light
        spaz.handleMessage(bs.StandMessage(position, angle if angle is not None else random.uniform(0, 360)))
        t = bs.getGameTime()
        bs.playSound(self._spawnSound, 1, position=spaz.node.position)
        light = bs.newNode('light', attrs={'color': lightColor})
        spaz.node.connectAttr('position', light, 'position')
        bsUtils.animate(light, 'intensity', {0: 0, 250: 1, 500: 0})
        bs.gameTimer(500, light.delete)

        # lets reconnect this player's controls to this
        # spaz but *without* the ability to attack or pick stuff up
        spaz.connectControlsToPlayer(enablePunch=False,
                                     enableBomb=self.settings['Allow Landmine'],
                                     enablePickUp=False)
        # player.assignInputCall('pickUpPress', lambda: None)
        # player.assignInputCall('pickUpRelease', lambda: None)
        # also lets have them make some noise when they die..
        spaz.playBigDeathSound = True

        return spaz
Exemple #7
0
    def spawnPlayerSpaz(self, player, position=(0, 0, 0), angle=None):
        """
        Create and wire up a bs.PlayerSpaz for the provide bs.Player.
        """
        position = self.getMap().getFFAStartPosition(self.players)
        name = player.getName()
        color = player.color
        highlight = player.highlight

        lightColor = bsUtils.getNormalizedColor(color)
        displayColor = bs.getSafeColor(color, targetIntensity=0.75)
        spaz = PlayerSpaz_Infection(color=color,
                                    highlight=highlight,
                                    character=player.character,
                                    player=player)
        player.setActor(spaz)

        # we want a bigger area-of-interest in co-op mode
        # if isinstance(self.getSession(),bs.CoopSession): spaz.node.areaOfInterestRadius = 5.0
        # else: spaz.node.areaOfInterestRadius = 5.0

        # if this is co-op and we're on Courtyard or Runaround, add the material that allows us to
        # collide with the player-walls
        # FIXME; need to generalize this
        if isinstance(self.getSession(),
                      bs.CoopSession) and self.getMap().getName() in [
                          'Courtyard', 'Tower D'
                      ]:
            mat = self.getMap().preloadData['collideWithWallMaterial']
            spaz.node.materials += (mat, )
            spaz.node.rollerMaterials += (mat, )

        spaz.node.name = name
        spaz.node.nameColor = displayColor
        spaz.connectControlsToPlayer()
        self.scoreSet.playerGotNewSpaz(player, spaz)

        # move to the stand position and add a flash of light
        spaz.handleMessage(
            bs.StandMessage(
                position,
                angle if angle is not None else random.uniform(0, 360)))
        t = bs.getGameTime()
        bs.playSound(self._spawnSound, 1, position=spaz.node.position)
        light = bs.newNode('light', attrs={'color': lightColor})
        spaz.node.connectAttr('position', light, 'position')
        bsUtils.animate(light, 'intensity', {0: 0, 250: 1, 500: 0})
        bs.gameTimer(500, light.delete)
        return spaz
Exemple #8
0
    def playerScored(self,
                     player,
                     basePoints=1,
                     target=None,
                     kill=False,
                     victimPlayer=None,
                     scale=1.0,
                     color=None,
                     title=None,
                     screenMessage=True,
                     display=True,
                     importance=1,
                     showPoints=True,
                     bigMessage=False):
        """ register a score for the player; return value is actual score with multipliers and such factored in """

        name = player.getName()
        p = self._players[name]

        # if title is None: title = ''

        if kill:
            p.submitKill(showPoints=showPoints)

        displayColor = (1, 1, 1, 1)

        if color is not None:
            displayColor = color
        elif importance != 1:
            displayColor = (1.0, 1.0, 0.4, 1)
        points = basePoints
        exc = ''

        # if they want a big announcement, throw a zoom-text up there
        if display and bigMessage:
            try:
                activity = self._activity()
                if activity:
                    nameFull = player.getName(full=True, icon=False)
                    activity.showZoomMessage(bs.Lstr(resource='nameScoresText',
                                                     subs=[('${NAME}',
                                                            nameFull)]),
                                             color=bsUtils.getNormalizedColor(
                                                 player.getTeam().color))
            except Exception, e:
                print 'Exception showing bigMessage', e
Exemple #9
0
    def spawnPlayerSpaz(self, player, position=(0, 0, 0), angle=None):
        name = player.getName()
        color = player.color
        highlight = player.highlight

        lightColor = bsUtils.getNormalizedColor(color)
        displayColor = bs.getSafeColor(color, targetIntensity=0.75)
        position = self.getMap().getFFAStartPosition(self.players)
        spaz = JumpSpaz(color=color,
                        highlight=highlight,
                        character=player.character,
                        player=player)
        player.setActor(spaz)
        spaz.handleMessage(
            bs.StandMessage(
                position,
                angle if angle is not None else random.uniform(0, 360)))
Exemple #10
0
    def spawnPlayerSpaz(self, player, position=(0, 0, 0), angle=None):
        posList = ((0, 5, 0), (9, 11, 0), (0, 12, 0), (-11, 11, 0))
        try:
            pos = posList[player.gameData['lastPoint']]
        except:
            pos = (0, 5, 0)
        position = (pos[0] + random.random() * 2 - 1, pos[1], pos[2])
        name = player.getName()
        color = player.color
        highlight = player.highlight

        lightColor = bsUtils.getNormalizedColor(color)
        displayColor = bs.getSafeColor(color, targetIntensity=0.75)
        spaz = bs.PlayerSpaz(color=color,
                             highlight=highlight,
                             character=player.character,
                             player=player)
        player.setActor(spaz)
        if isinstance(self.getSession(),
                      bs.CoopSession) and self.getMap().getName() in [
                          'Courtyard', 'Tower D'
                      ]:
            mat = self.getMap().preloadData['collideWithWallMaterial']
            spaz.node.materials += (mat, )
            spaz.node.rollerMaterials += (mat, )
        spaz.node.name = name
        spaz.node.nameColor = displayColor
        if self._raceStarted: spaz.connectControlsToPlayer()
        spaz.handleMessage(
            bs.StandMessage(
                position,
                angle if angle is not None else random.uniform(0, 360)))
        t = bs.getGameTime()
        bs.playSound(self._spawnSound, 1, position=spaz.node.position)
        light = bs.newNode('light', attrs={'color': lightColor})
        spaz.node.connectAttr('position', light, 'position')
        bsUtils.animate(light, 'intensity', {0: 0, 250: 1, 500: 0})
        bs.gameTimer(500, light.delete)
        if not self._raceStarted: player.gameData['lastPoint'] = 0
        bs.gameTimer(250, bs.Call(self.checkPt, player))
        return spaz
Exemple #11
0
    def spawnPlayer(self, player):
        position = self.getMap().getFFAStartPosition(self.players)
        angle = 20
        name = player.getName()

        lightColor = bsUtils.getNormalizedColor(player.color)
        displayColor = bs.getSafeColor(player.color, targetIntensity=0.75)

        spaz = HunterSpaz(color=player.color,
                          highlight=player.highlight,
                          character=player.character,
                          player=player,
                          force_fly=False,
                          allowAim=self.settings[JungleHunterLanguage.aimHelp])
        player.setActor(spaz)

        spaz.node.name = name
        spaz.node.nameColor = displayColor
        spaz.connectControlsToPlayer()
        self.scoreSet.playerGotNewSpaz(player, spaz)

        # move to the stand position and add a flash of light
        spaz.handleMessage(bs.StandMessage(position, angle if angle is not None else random.uniform(0, 360)))
        t = bs.getGameTime()
        bs.playSound(self._spawnSound, 1, position=spaz.node.position)
        light = bs.newNode('light', attrs={'color': lightColor})
        spaz.node.connectAttr('position', light, 'position')
        bsUtils.animate(light, 'intensity', {0: 0, 250: 1, 500: 0})
        bs.gameTimer(500, light.delete)

        # lets reconnect this player's controls to this
        # spaz but *without* the ability to attack or pick stuff up
        spaz.connectControlsToPlayer(enablePunch=False,
                                     enableBomb=True,
                                     enablePickUp=False)
        spaz.initArcher()
        spaz.playBigDeathSound = True

        return spaz
Exemple #12
0
    def spawnPlayerSpaz(self, player):
        position = self.init_position
        if self.teamsOrFFA() == 'teams':
            position = self.team_init_positions[player.getTeam().getID() % 2]

        angle = None

        name = player.getName()
        color = player.color
        highlight = player.highlight

        lightColor = bsUtils.getNormalizedColor(color)
        displayColor = bs.getSafeColor(color, targetIntensity=0.75)
        spaz = AbyssPlayerSpaz(color=color,
                               highlight=highlight,
                               character=player.character,
                               player=player)
        player.setActor(spaz)

        spaz.node.name = name
        spaz.node.nameColor = displayColor
        spaz.connectControlsToPlayer(enablePunch=False,
                                     enableBomb=True,
                                     enablePickUp=False)
        self.scoreSet.playerGotNewSpaz(player, spaz)

        # move to the stand position and add a flash of light
        spaz.handleMessage(
            bs.StandMessage(
                position,
                angle if angle is not None else random.uniform(0, 360)))
        t = bs.getGameTime()
        bs.playSound(self._spawnSound, 1, position=spaz.node.position)
        light = bs.newNode('light', attrs={'color': lightColor})
        spaz.node.connectAttr('position', light, 'position')
        bsUtils.animate(light, 'intensity', {0: 0, 250: 1, 500: 0})
        bs.gameTimer(500, light.delete)
        spaz.playBigDeathSound = True
        return spaz
Exemple #13
0
    def spawnPlayerSpaz(self, player, position=(0, 0, 0), angle=None):
        """
        Create and wire up a bs.PlayerSpaz for the provide bs.Player.
        """
        position = self.getMap().getFFAStartPosition(self.players)
        name = player.getName()
        color = player.color
        highlight = player.highlight

        lightColor = bsUtils.getNormalizedColor(color)
        displayColor = bs.getSafeColor(color, targetIntensity=0.75)

        bt = random.choice([
            'Jumper', 'Hopper', 'Bomber', 'Stronger', 'Flash', 'Frozenman',
            'Shieldman'
        ])
        if bt == 'Jumper':
            bt = PlayerSpazTeleporter
            name += '\nJUMPER'
        elif bt == 'Hopper':
            bt = PlayerSpazJumper
            name += '\nHOPPER'
        elif bt == 'Bomber':
            bt = PlayerSpazBomber
            name += '\nBOMBER'
        elif bt == 'Stronger':
            extra = 'strong'
            bt = PlayerSpazNormal
            name += '\nHULK'
        elif bt == 'Flash':
            extra = 'speed'
            bt = PlayerSpazNormal
            name += '\nFLASH'
        elif bt == 'Frozenman':
            bt = PlayerSpazFrozenman
            name += '\nICEMAN'
        elif bt == 'Shieldman':
            extra = 'shield'
            bt = PlayerSpazNormal
            name += '\nSHIELDMAN'

        s = spaz = bt(color=color,
                      highlight=highlight,
                      character=player.character,
                      player=player)
        if bt == PlayerSpazFrozenman: spaz.bombType = 'ice'
        if bt == PlayerSpazNormal and extra == 'speed': spaz.equipSpeed()
        if bt == PlayerSpazNormal and extra == 'shield': spaz.equipShields()
        if bt == PlayerSpazNormal and extra == 'strong': s._punchPowerScale = 5
        player.setActor(spaz)

        spaz.node.name = name
        spaz.node.nameColor = displayColor
        spaz.connectControlsToPlayer()

        self.scoreSet.playerGotNewSpaz(player, spaz)

        # move to the stand position and add a flash of light
        spaz.handleMessage(
            bs.StandMessage(
                position,
                angle if angle is not None else random.uniform(0, 360)))
        t = bs.getGameTime()
        bs.playSound(self._spawnSound, 1, position=spaz.node.position)
        light = bs.newNode('light', attrs={'color': lightColor})
        spaz.node.connectAttr('position', light, 'position')
        bsUtils.animate(light, 'intensity', {0: 0, 250: 1, 500: 0})
        bs.gameTimer(500, light.delete)
        return spaz
Exemple #14
0
    def spawnPlayer(self, player):
        """This next line is the default spawn line. But we need to spawn our special guy"""
        #self.spawnPlayerSpaz(player,self._getSpawnPoint(player))
        #position = self._getSpawnPoint(player)
        #if isinstance(self.getSession(), bs.TeamsSession):
        #    position = self.getMap().getStartPosition(player.getTeam().getID())
        #else:
        #	# otherwise do free-for-all spawn locations
        position = self.getMap().getFFAStartPosition(self.players)

        angle = 20

        #spaz = self.spawnPlayerSpaz(player)

        # lets reconnect this player's controls to this
        # spaz but *without* the ability to attack or pick stuff up
        #spaz.connectControlsToPlayer(enablePunch=False,
        #							 enableBomb=False,
        #							 enablePickUp=False)

        # also lets have them make some noise when they die..
        #spaz.playBigDeathSound = True

        name = player.getName()

        lightColor = bsUtils.getNormalizedColor(player.color)
        displayColor = bs.getSafeColor(player.color, targetIntensity=0.75)

        spaz = PlayerSpaz_Zom(color=player.color,
                              highlight=player.highlight,
                              character=player.character,
                              player=player)
        player.setActor(spaz)
        #For some reason, I can't figure out how to get a list of all spaz.
        #Therefore, I am making the list here so I can get which spaz belongs
        #to the player supplied by HitMessage.
        self.spazList.append(spaz)
        # we want a bigger area-of-interest in co-op mode
        # if isinstance(self.getSession(),bs.CoopSession): spaz.node.areaOfInterestRadius = 5.0
        # else: spaz.node.areaOfInterestRadius = 5.0

        # if this is co-op and we're on Courtyard or Runaround, add the material that allows us to
        # collide with the player-walls
        # FIXME; need to generalize this
        if isinstance(self.getSession(),
                      bs.CoopSession) and self.getMap().getName() in [
                          'Courtyard', 'Tower D'
                      ]:
            mat = self.getMap().preloadData['collideWithWallMaterial']
            spaz.node.materials += (mat, )
            spaz.node.rollerMaterials += (mat, )

        spaz.node.name = name
        spaz.node.nameColor = displayColor
        spaz.connectControlsToPlayer(
            enablePickUp=False
        )  #Unfortunately, I can't figure out how to prevent picking up other player but allow other pickup.
        self.scoreSet.playerGotNewSpaz(player, spaz)

        # move to the stand position and add a flash of light
        spaz.handleMessage(
            bs.StandMessage(
                position,
                angle if angle is not None else random.uniform(0, 360)))
        t = bs.getGameTime()
        bs.playSound(self._spawnSound, 1, position=spaz.node.position)
        light = bs.newNode('light', attrs={'color': lightColor})
        spaz.node.connectAttr('position', light, 'position')
        bsUtils.animate(light, 'intensity', {0: 0, 250: 1, 500: 0})
        bs.gameTimer(500, light.delete)
        #Start code to spawn special guy:
        #End of code to spawn special guy
        if not self._soloMode:
            bs.gameTimer(300, bs.Call(self._printLives, player))

        # if we have any icons, update their state
        for icon in player.gameData['icons']:
            icon.handlePlayerSpawned()
Exemple #15
0
    def spawnPlayerZombie(self, player):
        position = self.getMap().getFFAStartPosition(self.players)
        angle = 20
        name = player.getName()
        lightColor = bsUtils.getNormalizedColor(player.color)
        displayColor = bs.getSafeColor(player.color, targetIntensity=0.75)
        spaz = PlayerZombie(color=player.color,
                            highlight=player.highlight,
                            character='Kronk2',
                            player=player)
        player.setActor(spaz)
        #For some reason, I can't figure out how to get a list of all spaz.
        #Therefore, I am making the list here so I can get which spaz belongs
        #to the player supplied by HitMessage.
        self.spazList.append(spaz)
        # we want a bigger area-of-interest in co-op mode
        # if isinstance(self.getSession(),bs.CoopSession): spaz.node.areaOfInterestRadius = 5.0
        # else: spaz.node.areaOfInterestRadius = 5.0

        # if this is co-op and we're on Courtyard or Runaround, add the material that allows us to
        # collide with the player-walls
        # FIXME; need to generalize this
        if isinstance(self.getSession(),
                      bs.CoopSession) and self.getMap().getName() in [
                          'Courtyard', 'Tower D'
                      ]:
            mat = self.getMap().preloadData['collideWithWallMaterial']
            spaz.node.materials += (mat, )
            spaz.node.rollerMaterials += (mat, )
        #Need to prevent picking up powerups:
        pam = bs.Powerup.getFactory().powerupAcceptMaterial
        for attr in ['materials', 'rollerMaterials', 'extrasMaterials']:
            materials = getattr(spaz.node, attr)
            if pam in materials:
                setattr(spaz.node, attr,
                        tuple(m for m in materials if m != pam))
        #spaz.node.materials.remove(pam)
        #spaz.node.rollerMaterials.remove(pam)
        #spaz.node.extrasMaterials.remove(pam)

        spaz.node.name = name
        spaz.node.nameColor = displayColor
        spaz.connectControlsToPlayer(
            enablePunch=True, enableBomb=False, enablePickUp=False
        )  #Unfortunately, I can't figure out how to prevent picking up other player but allow other pickup.
        self.scoreSet.playerGotNewSpaz(player, spaz)

        # move to the stand position and add a flash of light
        spaz.handleMessage(
            bs.StandMessage(
                position,
                angle if angle is not None else random.uniform(0, 360)))
        t = bs.getGameTime()
        bs.playSound(self._spawnSound, 1, position=spaz.node.position)
        light = bs.newNode('light', attrs={'color': lightColor})
        spaz.node.connectAttr('position', light, 'position')
        bsUtils.animate(light, 'intensity', {0: 0, 250: 1, 500: 0})
        bs.gameTimer(500, light.delete)
        #Start code to spawn special guy:
        #End of code to spawn special guy
        if not self._soloMode:
            bs.gameTimer(300, bs.Call(self._printLives, player))

        # if we have any icons, update their state
        for icon in player.gameData['icons']:
            icon.handlePlayerSpawned()