예제 #1
0
파일: piece.py 프로젝트: namdre/ORTC
 def move_to(self, gridpos): 
     # promotion
     if self.piece == PAWN and (gridpos.y == 0 or gridpos.y == GRIDDIM.y - 1):
         self.piece = self.promotion
         self.image, self.rect = load_image(piece_image(self.piece, self.color), -1)
     # update 
     self.delay = DELAY
     self.gridpos = gridpos
     self.rect.center = gridpos * FIELDSIZE + 0.5 * FIELDSIZE
     self.attackpos = None
예제 #2
0
파일: piece.py 프로젝트: namdre/ORTC
 def __init__(self, surf, piece, color, gridpos):
     pygame.sprite.Sprite.__init__(self) #call Sprite initializer
     self.surf = surf
     self.piece = piece
     self.color = color
     self.image, self.rect = load_image(piece_image(piece, color), -1)
     self.move_to(gridpos)
     self.delay = 0
     self.hitpoints = MAXHP[piece]
     self.maxhp = MAXHP[piece]
     self.promotion = None # promotion goal if eligible
     self.attackpos = None
     # cyclical attack frame counter for drawing
     self.attack_time = 0