def action_rotate(self): ''' action to rotate ''' if self.tile: self.direction = DIRECTION.rotate(self.direction) self.board_drawer.set_marker(self.tile, self.row, self.col, self.direction) return False, None
def rotate(self, count=1): ''' Implemented PieceUpdateHelper rotate rotate selected tile by 90 * count degrees ''' if count < 0: return False # ignore count more then 4 (which is equal to 360 rotation) count %= 4 direction = self.direction for _ in range(count): direction = DIRECTION.rotate(self.direction) return self.__change_tile_position(self.row, self.col, direction)