def move(self, direction): moved = Level.move(self, direction) if moved and self.weapon: self.weapon.move(direction) if moved: State.use_turn() return moved
def rotate(self, direction): """ :param direction: -1 or 1, -1 -> ccw, 1 -> cw """ self.facing += direction if self.facing <= 0: self.facing = 8 elif self.facing > 8: self.facing = 1 self.rotation = (self.facing - 1) * 45 if self.weapon: self.weapon.on_rotate(direction) State.use_turn()