Exemplo n.º 1
0
    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()
Exemplo n.º 2
0
	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()
Exemplo n.º 3
0
	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()
Exemplo n.º 4
0
	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))
Exemplo n.º 5
0
Arquivo: pawn.py Projeto: Zevgon/aa_2
 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__
Exemplo n.º 6
0
	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()
Exemplo n.º 7
0
    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()
Exemplo n.º 8
0
    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)
Exemplo n.º 9
0
 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)
Exemplo n.º 10
0
    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()
Exemplo n.º 11
0
	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()
Exemplo n.º 12
0
    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()
Exemplo n.º 13
0
	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()
Exemplo n.º 14
0
    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
Exemplo n.º 15
0
    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()
Exemplo n.º 16
0
	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))
Exemplo n.º 17
0
	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))
Exemplo n.º 18
0
	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))
Exemplo n.º 19
0
    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))
Exemplo n.º 20
0
    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))
Exemplo n.º 21
0
    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))
Exemplo n.º 22
0
 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
Exemplo n.º 23
0
 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)
Exemplo n.º 24
0
 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"
Exemplo n.º 25
0
 def __init__(self, board, color, pos):
     Piece.__init__(self, board, color, pos)
Exemplo n.º 26
0
 def __init__(self, x: int, is_white: bool):
     Piece.__init__(self, x=x, y=2, piece_type="p", is_white=is_white)
Exemplo n.º 27
0
 def __init__(self, position, player):
     Piece.__init__(self, position, player)
Exemplo n.º 28
0
 def __init__(self, pos, color):
     Piece.__init__(self, pos, color)
     self.piece_type = 'queen'
     self.color = color
Exemplo n.º 29
0
 def __init__(self, board, pos, color, direction):
     Piece.__init__(self, board, pos, color)
     self.direction = direction
     self.original_position = pos
Exemplo n.º 30
0
Arquivo: pawn.py Projeto: kyuf/Chess
 def __init__(self, color, space, note):
     Piece.__init__(self, color, space, note)
     self.vulnerable = False
Exemplo n.º 31
0
 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
Exemplo n.º 33
0
 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"
Exemplo n.º 34
0
 def __init__(self, row, column, player):
     Piece.__init__(self, row, column, player)
Exemplo n.º 35
0
 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