Exemplo n.º 1
0
        public override void Activate(bool instancePreserved)
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            cam2D = new Cam2d(ScreenManager.GraphicsDevice);
            Vector2 Center = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width / 2, ScreenManager.GraphicsDevice.Viewport.Height / 2);

            gameFont = content.Load<SpriteFont>("gamefont");

            MC = new Player(content.Load<Texture2D>("PlayerAnimation/CycleStrip"), content.Load<Texture2D>("PlayerAnimation/_mcIdleV2"), new Vector2(0, 0), world, content);

            //level two
            {

                Grounds.Add(new Ground(content.Load<Texture2D>("Art/_Ground"), Center + new Vector2(0, ScreenManager.GraphicsDevice.Viewport.Height / 2 - 32), world));
                Grounds.Add(new Ground(content.Load<Texture2D>("Art/_Ground"), Center + new Vector2(512, ScreenManager.GraphicsDevice.Viewport.Height / 2 - 32), world));
                Grounds.Add(new Ground(content.Load<Texture2D>("Art/_Ground"), Center + new Vector2(-512, ScreenManager.GraphicsDevice.Viewport.Height / 2 - 32), world));
                Grounds.Add(new Ground(content.Load<Texture2D>("Art/_Ground"), Center + new Vector2(1024, ScreenManager.GraphicsDevice.Viewport.Height / 2 - 32), world));

                Enemies.Add(new Robot(content.Load<Texture2D>("Enemies/robot1"), Center + new Vector2(-210, ScreenManager.GraphicsDevice.Viewport.Height / 2 - 32), world));
                Enemies.Add(new Robot(content.Load<Texture2D>("Enemies/robot1"), Center + new Vector2(302, ScreenManager.GraphicsDevice.Viewport.Height / 2 - 32), world));

                Stars.Add(new Star(content.Load<Texture2D>("Art/_star"), Center + new Vector2(512, ScreenManager.GraphicsDevice.Viewport.Height / 2 - 32), world));
            }

            cam2D.TrackingBody = MC.playerBody;
            cam2D.EnablePositionTracking = true;
            ScreenManager.Game.ResetElapsedTime();
        }
Exemplo n.º 2
0
        public override void Activate(bool instancePreserved)
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            cam2D = new Cam2d(ScreenManager.GraphicsDevice);
            Vector2 Center = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width / 2, ScreenManager.GraphicsDevice.Viewport.Height / 2);

            gameFont = content.Load <SpriteFont>("gamefont");

            MC = new Player(content.Load <Texture2D>("PlayerAnimation/CycleStrip"), content.Load <Texture2D>("PlayerAnimation/_mcIdleV2"), new Vector2(0, 0), world, content);

            //level two
            {
                Grounds.Add(new Ground(content.Load <Texture2D>("Art/_Ground"), Center + new Vector2(0, ScreenManager.GraphicsDevice.Viewport.Height / 2 - 32), world));
                Grounds.Add(new Ground(content.Load <Texture2D>("Art/_Ground"), Center + new Vector2(512, ScreenManager.GraphicsDevice.Viewport.Height / 2 - 32), world));
                Grounds.Add(new Ground(content.Load <Texture2D>("Art/_Ground"), Center + new Vector2(-512, ScreenManager.GraphicsDevice.Viewport.Height / 2 - 32), world));
                Grounds.Add(new Ground(content.Load <Texture2D>("Art/_Ground"), Center + new Vector2(1024, ScreenManager.GraphicsDevice.Viewport.Height / 2 - 32), world));

                Enemies.Add(new Robot(content.Load <Texture2D>("Enemies/robot1"), Center + new Vector2(-210, ScreenManager.GraphicsDevice.Viewport.Height / 2 - 32), world));
                Enemies.Add(new Robot(content.Load <Texture2D>("Enemies/robot1"), Center + new Vector2(302, ScreenManager.GraphicsDevice.Viewport.Height / 2 - 32), world));

                Stars.Add(new Star(content.Load <Texture2D>("Art/_star"), Center + new Vector2(512, ScreenManager.GraphicsDevice.Viewport.Height / 2 - 32), world));
            }


            cam2D.TrackingBody           = MC.playerBody;
            cam2D.EnablePositionTracking = true;
            ScreenManager.Game.ResetElapsedTime();
        }