예제 #1
0
 public void Update()
 {
     if (VerticalScrollMode && IsOnScreen(new Rectangle {
         X = (int)Peach.BoundingBox().Left, Y = (int)Peach.BoundingBox().Top, Width = (int)Peach.BoundingBox().Width, Height = (int)Peach.BoundingBox().Height
     }))
     {
         float oldPosition = Position.Y;
         if (Peach.Sprite.Position().Y - Origin.Y < oldPosition)
         {
             Position = Peach.Sprite.Position() - Origin;
         }
     }
     else
     {
         Position = Peach.Sprite.Position() - Origin;
     }
     // Screen bounds of level
     Position = new Vector2(MathHelper.Clamp(Position.X, Constants.ZERO, LevelBounds.Right - Viewport.Width), MathHelper.Clamp(Position.Y, LevelBounds.Top, LevelBounds.Bottom - Viewport.Height));
 }