Exemplo n.º 1
0
    def on_start_dealing(self, message):
        world = self.world
        for player in world.players:
            kxg.info("Dealing to player {player}).")

            new_hand = self.draw_cards(6)
            self >> messages.DealToPlayer(player, new_hand)
Exemplo n.º 2
0
    def on_execute(self, world):
        for card in self.cards:
            card.in_play = True
        self.player.hand = self.cards[:]

        codes = [card.code for card in self.cards]
        kxg.info("Dealing cards to {self.player}. Cards: {codes}")
Exemplo n.º 3
0
    def on_execute(self, world):
        for card in self.cards:
            card.in_play = True
        self.player.hand = self.cards[:]

        codes = [card.code for card in self.cards]
        kxg.info("Dealing cards to {self.player}. Cards: {codes}")
Exemplo n.º 4
0
    def on_deal_to_player(self, message):
        (card_x, card_y) = self.world.card_size
        if self.player == message.player:
            codes = [card.code for card in self.player.hand]
            kxg.info("Cards deltith to {self.player}. Cards: {codes}")

            for (i, card) in enumerate(self.player.hand):

                self.hand_buttons[i].assign_card(card)
Exemplo n.º 5
0
    def on_deal_to_player(self, message):
        (card_x, card_y) = self.world.card_size
        if self.player == message.player:
            codes = [card.code for card in self.player.hand]
            kxg.info("Cards deltith to {self.player}. Cards: {codes}")

            for (i, card) in enumerate(self.player.hand):

                self.hand_buttons[i].assign_card(card)
Exemplo n.º 6
0
    def on_mouse_press(self, x, y, button, modifiers):
        # Send a "ShootBullet" signal when the user left-clicks.
        if button == 1:
            target = self.focus_point
            cannon = self.player.cannons[0]

            direction = (target - cannon.position).unit
            velocity = cannon.muzzle_speed * direction
            position = cannon.position + 40 * direction

            bullet = tokens.Bullet(cannon, position, velocity)

            if self.player.can_shoot(bullet):
                self >> messages.ShootBullet(bullet)
            else:
                kxg.info("Not enough arsenal to shoot bullet!")
Exemplo n.º 7
0
    def on_create_player(self, message):
        num_players_joined = len(self.world.players)
        kxg.info("{num_players_joined} of {self.num_players_expected} players created.")

        if num_players_joined == self.num_players_expected:
            self >> messages.StartGame(self.world)
Exemplo n.º 8
0
def log_something():
    kxg.info("Hello World!")