Esempio n. 1
0
        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();
        }
Esempio n. 2
0
		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);
		}
Esempio n. 3
0
		public void CenterOn(Vector2 position, Map map)
		{
			this.position = ClampedPosition(position, map);
		}