当前位置: 首页>>代码示例>>Python>>正文


Python Piece.__init__方法代码示例

本文整理汇总了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()
开发者ID:Greymerk,项目名称:PyChess,代码行数:9,代码来源:pawn.py

示例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()
开发者ID:Greymerk,项目名称:PyChess,代码行数:10,代码来源:queen.py

示例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))
开发者ID:claytondicks,项目名称:PyChess,代码行数:11,代码来源:pawn.py

示例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()
开发者ID:Greymerk,项目名称:PyChess,代码行数:11,代码来源:knight.py

示例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()
开发者ID:Greymerk,项目名称:PyChess,代码行数:11,代码来源:bishop.py

示例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)
开发者ID:jneem,项目名称:clashadash,代码行数:11,代码来源:ghost_piece.py

示例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()
开发者ID:Greymerk,项目名称:PyChess,代码行数:12,代码来源:rook.py

示例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
开发者ID:jneem,项目名称:clashadash,代码行数:12,代码来源:unit.py

示例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))
开发者ID:claytondicks,项目名称:PyChess,代码行数:13,代码来源:knight.py

示例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))
开发者ID:claytondicks,项目名称:PyChess,代码行数:13,代码来源:queen.py

示例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))
开发者ID:claytondicks,项目名称:PyChess,代码行数:13,代码来源:bishop.py

示例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
开发者ID:jneem,项目名称:clashadash,代码行数:23,代码来源:charging_unit.py

示例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)
开发者ID:AlexanderRichey,项目名称:PythonChess,代码行数:4,代码来源:stepping.py

示例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"
开发者ID:cddude229,项目名称:Gaveldor,代码行数:5,代码来源:cavalry.py

示例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"
开发者ID:cddude229,项目名称:Gaveldor,代码行数:5,代码来源:infantry.py


注:本文中的piece.Piece.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。