Exemplo n.º 1
0
        public override void LoadContent()
        {
            ContentManager content = ScreenManager.Game.Content;

            map = content.Load <Map>("map");

            camera = new Camera(ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight, map);

            particleController.LoadContent(content);

            base.LoadContent();
        }
Exemplo n.º 2
0
        public override void LoadContent()
        {
            ContentManager content = ScreenManager.Game.Content;

            map = content.Load <Map>("map");
            MapGeneration.Generate(map);

            camera = new Camera(ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight, map);

            //camera.Zoom = 0.5f;

            text = content.Load <Texture2D>("titles");

            hud = new HUD(content.Load <Texture2D>("hud"));

            waterLevel           = ScreenManager.Game.RenderHeight;
            waterParallax        = new Parallax(content.Load <Texture2D>("abovewater-parallax"), 12, 0.5f, waterLevel, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), false, true);
            underwaterBGParallax = new Parallax(content.Load <Texture2D>("underwater-bg"), 4, 1f, waterLevel + 20, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), true, false);
            skyBGParallax        = new Parallax(content.Load <Texture2D>("sky-bg"), 72, 1f, 70, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), false, false);
            rocksParallax        = new Parallax(content.Load <Texture2D>("seabed-rocks"), 16, 0.35f, (map.TileHeight * map.Height) - 15, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), false, false);
            cloudsParallax       = new Parallax(content.Load <Texture2D>("clouds"), 16, 0.35f, 25, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), false, false, true);

            playerShip          = new Ship(content.Load <Texture2D>("playership"), new Rectangle(0, 0, 10, 10), null, Vector2.Zero);
            playerShip.Position = new Vector2(64, 190);

            particleController.LoadContent(content);

            projectileController = new ProjectileController(1000, sheet => new Projectile(sheet, new Rectangle(0, 0, 4, 4), null, new Vector2(0, 0)), content.Load <Texture2D>("projectiles"));
            enemyController      = new EnemyController(content.Load <Texture2D>("enemies"), content.Load <Texture2D>("boss"));
            powerupController    = new PowerupController(1000, sheet => new Powerup(sheet, new Rectangle(0, 0, 6, 6), null, Vector2.Zero), content.Load <Texture2D>("powerup"));

            powerupController.BoxCollidesWith.Add(playerShip);
            projectileController.BoxCollidesWith.Add(playerShip);
            projectileController.BoxCollidesWith.Add(enemyController);
            projectileController.BoxCollidesWith.Add(projectileController);
            enemyController.BoxCollidesWith.Add(playerShip);
            enemyController.BoxCollidesWith.Add(projectileController);

            GameController.Reset();

            //enemyController.SpawnInitial(GameController.Wave, map);

            base.LoadContent();
        }
Exemplo n.º 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            playerTexture           = Content.Load <Texture2D>("players");
            tileTexture             = Content.Load <Texture2D>("tiles");
            fireballTexture         = Content.Load <Texture2D>("fireballs");
            chestTexture            = Content.Load <Texture2D>("chest");
            stuffTexture            = Content.Load <Texture2D>("stuff");
            slotTexture             = Content.Load <Texture2D>("slot");
            swordTexture            = Content.Load <Texture2D>("sword");
            smoothLightEffect       = Content.Load <Effect>("light");
            smoothLightMapperEffect = Content.Load <Effect>("lightMapper");
            font14     = Content.Load <SpriteFont>("font14");
            font11     = Content.Load <SpriteFont>("font11");
            whitePixel = new Texture2D(GraphicsDevice, 1, 1);
            whitePixel.SetData(new Color[] { Color.White });
            particleController.LoadContent(Content);

            gameRegistry.SetTexture("tiles", tileTexture);
            gameRegistry.SetTexture("chest", chestTexture);
            gameRegistry.SetTexture("whitePixel", whitePixel);
        }
Exemplo n.º 4
0
        public override void LoadContent()
        {
            ContentManager content = ScreenManager.Game.Content;

            map = content.Load <Map>("map");
            MapObject spawn = ((MapObjectLayer)map.GetLayer("spawn")).Objects[0];

            camera        = new Camera(ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight, map);
            camera.Target = new Vector2(ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight) / 2f;

            heroPool = new EntityPool(100,
                                      sheet => new Hero(sheet, new Rectangle(0, 0, 10, 10), new Vector2(0, -5)),
                                      content.Load <Texture2D>("testhero"));
            heroPool.BoxCollidesWith.Add(heroPool);

            rotBoxPool = new EntityPool(100,
                                        sheet => new RotBox(sheet, new Rectangle(0, 0, 32, 32), null, Vector2.Zero),
                                        ScreenManager.blankTexture);
            rotBoxPool.PolyCollidesWith.Add(rotBoxPool);

            rotBoxPool.Spawn(entity =>
            {
                entity.Position = new Vector2(100, 100);
            });
            rotBoxPool.Spawn(entity =>
            {
                entity.Position = new Vector2(140, 100);
            });

            particleController.LoadContent(content);

            // TimerController.Instance.Create("shake", () => camera.Shake(500, 2f), 3000, true);

            TweenController.Instance.Create("spintext", TweenFuncs.SineEaseInOut, (tween) =>
            {
                textScale = 0.8f + (tween.Value * 0.4f);
            }, 3000, true, true);

            //// More crazy tween examples
            //TweenController.Instance.Create("spincam", TweenFuncs.Linear, (tween) =>
            //{
            //    camera.Rotation = MathHelper.TwoPi * tween.Value;
            //}, 10000, false, true, TweenDirection.Reverse);

            //TweenController.Instance.Create("zoomcam", TweenFuncs.Bounce, (tween) =>
            //{
            //    camera.Zoom = 1f + tween.Value;
            //}, 3000, true, true);

            particleController.Add(new Vector2(195, 150),
                                   Vector2.Zero,
                                   0, 1000, 0,
                                   false, false,
                                   new Rectangle(18, 0, 100, 100),
                                   Color.White,
                                   ParticleFunctions.PermaLight,
                                   1f, 0f,
                                   1, ParticleBlend.Multiplicative);

            base.LoadContent();
        }