本文整理汇总了Python中piece.Piece.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Piece.__init__方法的具体用法?Python Piece.__init__怎么用?Python Piece.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类piece.Piece
的用法示例。
在下文中一共展示了Piece.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
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()
示例2: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
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()
示例3: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
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))
示例4: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
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()
示例5: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
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()
示例6: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
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)
示例7: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
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()
示例8: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
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
示例9: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
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))
示例10: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
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))
示例11: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
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))
示例12: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
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
示例13: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
def __init__(self, board, pos, color):
Piece.__init__(self, board, pos, color)
示例14: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
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"
示例15: __init__
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import __init__ [as 别名]
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"