Exemple #1
0
    def initialize_bomb(self, dirImage, list_bombs, rows, columns):
        i = 1
        for b in list_bombs:
            bomb = gb.Bomb(dirImage, 'bomb' + str(i), b[0], b[1])
            self.board.add(bomb, b[0], b[1])
            if b[0] >= rows - 1:
                new_b = 0
            else:
                new_b = b[0] + 1
            bomb_s = gb.BombSound(dirImage, 'bomb_sound_s' + str(i), new_b,
                                  b[1])
            self.board.add(bomb_s, new_b, b[1])
            if b[1] >= columns - 1:
                new_b = 0
            else:
                new_b = b[1] + 1
            bomb_s = gb.BombSound(dirImage, 'bomb_sound_e' + str(i), b[0],
                                  new_b)
            self.board.add(bomb_s, b[0], new_b)
            if b[0] <= 0:
                new_b = columns - 1
            else:
                new_b = b[0] - 1
            bomb_s = gb.BombSound(dirImage, 'bomb_sound_n' + str(i), new_b,
                                  b[1])
            self.board.add(bomb_s, new_b, b[1])
            if b[1] <= 0:
                new_b = rows - 1
            else:
                new_b = b[1] - 1

            bomb_s = gb.BombSound(dirImage, 'bomb_sound_w' + str(i), b[0],
                                  new_b)
            self.board.add(bomb_s, b[0], new_b)
            i = i + 1
Exemple #2
0
    def initialize_bombs(self):
        columns, rows = self.config["board_dimensions"][0], self.config["board_dimensions"][1]
        i = 1
        for b in self.config["bomb_coordinates"]:
            bomb = gb.Bomb('bomb' + str(i), b[0], b[1], self.config)
            self.board.add(bomb, b[0], b[1])

            bomb_s = gb.BombSound('bomb_sound_s' + str(i), b[0], (b[1]+1) % rows, self.config)
            self.board.add(bomb_s, b[0], (b[1]+1) % rows)

            bomb_s = gb.BombSound('bomb_sound_e' + str(i), (b[0] + 1) % columns, b[1], self.config)
            self.board.add(bomb_s, (b[0] + 1) % columns, b[1])

            bomb_s = gb.BombSound('bomb_sound_n' + str(i), b[0], (b[1] - 1) % rows, self.config)
            self.board.add(bomb_s, b[0], (b[1] - 1) % rows)

            bomb_s = gb.BombSound('bomb_sound_w' + str(i), (b[0] - 1) % columns, b[1], self.config)
            self.board.add(bomb_s, (b[0] - 1) % columns, b[1])
            i += 1