def __init__(self, pos, board, player): Piece.__init__(self, pos, board, player) if self.player.colour == 0: self.img = pygame.image.load("images/wpawn.png").convert_alpha() else: self.img = pygame.image.load("images/bpawn.png").convert_alpha()
def __init__(self, pos, board, player): Piece.__init__(self, pos, board, player) if self.player.colour == 0: self.img = pygame.image.load("images/wpawn.png").convert_alpha() else: self.img = pygame.image.load("images/bpawn.png").convert_alpha()
def __init__(self, pos, grid, player): Piece.__init__(self, pos, grid, player) self.directions = dict(Directions.diagonals.items() + Directions.straight.items()) if self.player.colour == 0: self.img = pygame.image.load("images/wqueen.png").convert_alpha() else: self.img = pygame.image.load("images/bqueen.png").convert_alpha()
def __init__(self, pos, board, player): Piece.__init__(self, pos, board, player) if self.player.colour == 0: self.img = pygame.image.load("images/wpawn.png").convert_alpha() else: self.img = pygame.image.load("images/bpawn.png").convert_alpha() self.img = pygame.transform.scale(self.img, (self.board.grid.cellsize, self.board.grid.cellsize))
def __init__(self, board, color, pos): Piece.__init__(self, board, color, pos) self.has_moved = False if self.color == self.board.player1: self.operator1 = int.__add__ self.operator2 = int.__sub__ else: self.operator1 = int.__sub__ self.operator2 = int.__add__
def __init__(self, pos, grid, player): Piece.__init__(self, pos, grid, player) self.directions = Directions.knight if self.player.colour == 0: self.img = pygame.image.load("images/wknight.png").convert_alpha() else: self.img = pygame.image.load("images/bknight.png").convert_alpha()
def __init__(self, pos, grid, player): Piece.__init__(self, pos, grid, player) self.validMoves = [] self.directions = Directions.diagonals if self.player.colour == 0: self.img = pygame.image.load("images/wbishop.png").convert_alpha() else: self.img = pygame.image.load("images/bbishop.png").convert_alpha()
def __init__(self, piece): """Create a ghost of piece. The ghost's initial position is that of piece, but you can update the ghost's position without affecting the piece's position. """ Piece.__init__(self, piece.description) self.piece = piece self.position = None if piece.position is None else list(piece.position)
def __init__(self, pos, color, img, size, rotate=False): Piece.__init__(self, pos, color, rotate) self.size = chessgame.Rule.transform_size_table2piece(size) self.click = False self.image = pg.image.load(r'resources/icon/{}'.format(img)) self.image = pg.transform.scale(self.image, self.size) if rotate: self.image = pg.transform.rotate(self.image, 180) self.rect = chessgame.Rule.transform_pos2rect(self.size, pos)
def __init__(self, pos, grid, player): Piece.__init__(self, pos, grid, player) self.directions = dict(Directions.diagonals.items() + Directions.straight.items()) if self.player.colour == 0: self.img = pygame.image.load("images/wqueen.png").convert_alpha() else: self.img = pygame.image.load("images/bqueen.png").convert_alpha()
def __init__(self, pos, grid, player): Piece.__init__(self, pos, grid, player) self.validMoves = [] self.directions = Directions.diagonals if self.player.colour == 0: self.img = pygame.image.load("images/wbishop.png").convert_alpha() else: self.img = pygame.image.load("images/bbishop.png").convert_alpha()
def __init__(self, pos, grid, player): Piece.__init__(self, pos, grid, player) self.directions = Directions.knight if self.player.colour == 0: self.img = pygame.image.load("images/wknight.png").convert_alpha() else: self.img = pygame.image.load("images/bknight.png").convert_alpha()
def __init__(self, pos, board, player): Piece.__init__(self, pos, board, player) self.validMoves = [] self.directions = Directions.straight if self.player.colour == 0: self.img = pygame.image.load("images/wrook.png").convert_alpha() else: self.img = pygame.image.load("images/brook.png").convert_alpha()
def __init__(self, description, color, player): """ Initializes a Unit. """ Piece.__init__(self, description) self.color = color self.chargeDescription = dict(description['charge']) self.imageBase = description['imageBase'] self.player = player
def __init__(self, pos, board, player): Piece.__init__(self, pos, board, player) self.validMoves = [] self.directions = Directions.straight if self.player.colour == 0: self.img = pygame.image.load("images/wrook.png").convert_alpha() else: self.img = pygame.image.load("images/brook.png").convert_alpha()
def __init__(self, pos, board, player): Piece.__init__(self, pos, board, player) self.directions = dict(Directions.diagonals.items() + Directions.straight.items()) if self.player.colour == 0: self.img = pygame.image.load("images/wqueen.png").convert_alpha() else: self.img = pygame.image.load("images/bqueen.png").convert_alpha() self.img = pygame.transform.scale(self.img, (self.board.grid.cellsize, self.board.grid.cellsize))
def __init__(self, pos, board, player): Piece.__init__(self, pos, board, player) self.directions = Directions.knight if self.player.colour == 0: self.img = pygame.image.load("images/wknight.png").convert_alpha() else: self.img = pygame.image.load("images/bknight.png").convert_alpha() self.img = pygame.transform.scale(self.img, (self.board.grid.cellsize, self.board.grid.cellsize))
def __init__(self, pos, board, player): Piece.__init__(self, pos, board, player) self.validMoves = [] self.directions = Directions.diagonals if self.player.colour == 0: self.img = pygame.image.load("images/wbishop.png").convert_alpha() else: self.img = pygame.image.load("images/bbishop.png").convert_alpha() self.img = pygame.transform.scale(self.img, (self.board.grid.cellsize, self.board.grid.cellsize))
def __init__(self, pos, board, player): Piece.__init__(self, pos, board, player) self.directions = dict(Directions.diagonals.items() + Directions.straight.items()) if self.player.colour == 0: self.img = pygame.image.load("images/wqueen.png").convert_alpha() else: self.img = pygame.image.load("images/bqueen.png").convert_alpha() self.img = pygame.transform.scale( self.img, (self.board.grid.cellsize, self.board.grid.cellsize))
def __init__(self, pos, board, player): Piece.__init__(self, pos, board, player) self.validMoves = [] self.directions = Directions.diagonals if self.player.colour == 0: self.img = pygame.image.load("images/wbishop.png").convert_alpha() else: self.img = pygame.image.load("images/bbishop.png").convert_alpha() self.img = pygame.transform.scale( self.img, (self.board.grid.cellsize, self.board.grid.cellsize))
def __init__(self, pos, board, player): Piece.__init__(self, pos, board, player) self.directions = Directions.knight if self.player.colour == 0: self.img = pygame.image.load("images/wknight.png").convert_alpha() else: self.img = pygame.image.load("images/bknight.png").convert_alpha() self.img = pygame.transform.scale( self.img, (self.board.grid.cellsize, self.board.grid.cellsize))
def __init__(self, description, base_size, position, color): """Constructs a charging unit. Params: base_size is the size of the constituents that charged to make this unit. For example, charging a base 1x1 unit will result in size (3, 1) and base_size (1, 1). """ Piece.__init__(self, description) self.position = position self.color = color self.base_size = base_size self.initialPower = int(description['initialPower']) self.maxPower = int(description['maxPower']) self.maxTurns = int(description['turns']) self.turn = self.maxTurns self.imageBase = description['imageBase'] self.toughness = self.initialPower
def __init__(self, black, row, col): self.id = 'K' self.text = str(5*self.id) self.color_text = make_color_text(black) Piece.__init__(self, black=black, row=row, col=col)
def __init__(self, player, x, y, dir): Piece.__init__(self, player, x, y, dir, 1, 2, "a") self.imageFile = "../res/tiles/archer_p" + str(self.player) + "_h"
def __init__(self, board, color, pos): Piece.__init__(self, board, color, pos)
def __init__(self, x: int, is_white: bool): Piece.__init__(self, x=x, y=2, piece_type="p", is_white=is_white)
def __init__(self, position, player): Piece.__init__(self, position, player)
def __init__(self, pos, color): Piece.__init__(self, pos, color) self.piece_type = 'queen' self.color = color
def __init__(self, board, pos, color, direction): Piece.__init__(self, board, pos, color) self.direction = direction self.original_position = pos
def __init__(self, color, space, note): Piece.__init__(self, color, space, note) self.vulnerable = False
def __init__(self, board, pos, color): Piece.__init__(self, board, pos, color)
def __init__(self, pos, color): Piece.__init__(self, pos, color) self.piece_type = 'bishop' self.color = color
def __init__(self, player, x, y, dir): Piece.__init__(self, player, x, y, dir, 1, 4, "c") self.imageFile = "../res/tiles/cavalry_p" + str(self.player) + "_h"
def __init__(self, row, column, player): Piece.__init__(self, row, column, player)
def __init__(self, player, x, y, dir): Piece.__init__(self, player, x, y, dir, 1, 3, "i") self.imageFile = "../res/tiles/infantry_p" + str(self.player) + "_h"
def __init__(self, pos, color): Piece.__init__(self, pos, color) self.piece_type = 'knight' self.color = color