private void UpdateCameraBounds(Rectangle screenRect, IAnimatedEntity player)
 {
     if (player.Position.X > -1)
     {
         var newPosition = Camera.Position;
         newPosition.X = (int)Math.Min(
             Math.Max(
                 player.Position.X + (player.SpriteSize.X ),
                 0 + (screenRect.Width / 2) //half the viewport
                 // TODO: correct this to account for scaling vs resolution change
             ),
             (Map.Metadata.Width * Constants.TileSize) - ((Map.Metadata.Width * Constants.TileSize) / 2)
         );
         Camera.Position = newPosition;
     }
 }
Пример #2
0
 public void AddEntity(IAnimatedEntity entity)
 {
     _Entities.Add(entity);
 }