Ejemplo n.º 1
0
 public void LockToSprite(TileMap map, AnimatedSprite sprite, Rectangle viewPort)
 {
     position.X = (sprite.Position.X + sprite.Width / 2) - (viewPort.Width / 2);
     position.Y = (sprite.Position.Y + sprite.Height / 2) - (viewPort.Height / 2);
     LockCamera(map, viewPort);
 }
Ejemplo n.º 2
0
 public void LockCamera(TileMap map, Rectangle viewport)
 {
     position.X = MathHelper.Clamp(position.X, 0, map.WidthInPixels - viewport.Width);
     position.Y = MathHelper.Clamp(position.Y, 0, map.HeightInPixels - viewport.Height);
 }