public void Move(Point p, Level level, long time) { if (time % Cooldown != 0) { return; } Point newPos = new Point(Pos.X + MovingPoint.X, Pos.Y + MovingPoint.Y); if (GameRule.CanDraw(newPos, level)) { OldPos = Pos; Pos = newPos; Paint(); } else { if (Facing == FacingHorizontal) { MovingPoint.X = MovingPoint.X == 1 ? -1 : 1; } else { MovingPoint.Y = MovingPoint.Y == 1 ? -1 : 1; } if (GameRule.CanDraw(newPos, level)) { OldPos = Pos; Pos = newPos; Paint(); } } }
public void MoveToPosition(Point p, Level level) { if (GameRule.CanDraw(p, level)) { Pos = p; Paint(); } }
public void Move(Point p, Level level, long time) { Point newPos = new Point(p.X + Pos.X, p.Y + Pos.Y); if (GameRule.CanDraw(newPos, level)) { Pos = newPos; Paint(); } }