def setup_combat(s, ship):
    worldid = 10000000

    p0 = Player(s, worldid, "p1", Color.get(1))
    p1 = Player(s, worldid + 1, "p2", Color.get(2))

    for p in (p0, p1):
        p.initialize(None)
        s.world.players.append(p)

    s0 = CreateUnit(p0.worldid, ship, 0, 0)(issuer=p0)
    s1 = CreateUnit(p1.worldid, ship, 3, 3)(issuer=p1)

    return ((p0, s0), (p1, s1))
Exemple #2
0
    def setup_player(self, id, name, color, local):
        """Sets up a new Player instance and adds him to the active world.
		@param local: bool, whether the player is the one sitting on front of this machine."""
        inv = self.session.db.get_player_start_res()
        player = None
        if local:
            player = HumanPlayer(self.session, id, name, color, inventory=inv)
            self.player = player
            self.session.ingame_gui.resbar.update_gold()
            self.player.inventory.add_change_listener(
                self.session.ingame_gui.resbar.update_gold)
        else:
            player = Player(self.session, id, name, color, inventory=inv)
        self.players.append(player)
Exemple #3
0
    def setup_player(self, id, name, color, local):
        """Sets up a new Player instance and adds him to the active world.
		Only used for new games. Loading old players is done in _init().
		@param local: bool, whether the player is the one sitting on front of this machine."""
        inv = self.session.db.get_player_start_res()
        player = None
        if local:
            player = HumanPlayer(self.session, id, name, color, inventory=inv)
            self.player = player
            self.player.inventory.add_change_listener(self.session.ingame_gui.update_gold, \
                                                      call_listener_now=True)
        else:
            player = Player(self.session, id, name, color, inventory=inv)
        self.players.append(player)