public PhysicsScene() { world = null; camera = new Camera(); player = new Player(); collectibleItems = new List<CollectibleItem>(); enemies = new List<Enemy>(); map = new Map(""); dynMap = new DynamicMap(""); mapBack = new MapBackground(""); projectiles = new List<Projectile>(); projectileFactory = new ProjectileFactory(); lifeBarFrame = new Image(); lifeBar = new Image(); projectileBarFrame = new Image(); projectileBar = new Image(); }
private Vector2 ClampedPosition(Vector2 position, Map map) { var cameraMax = new Vector2( ConvertUnits.ToDisplayUnits(map.GetRealWidth()) - (viewportWidth / zoom / 2), ConvertUnits.ToDisplayUnits(map.GetRealHeight()) - (viewportHeight / zoom / 2)); return Vector2.Clamp( position, new Vector2(viewportWidth / zoom / 2, viewportHeight / zoom / 2), cameraMax); }
public void CenterOn(Vector2 position, Map map) { this.position = ClampedPosition(position, map); }