Example #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            lightmask    = Content.Load <Texture2D>("lightmask");
            lightEffect  = Content.Load <Effect>("lighting");
            background   = Content.Load <Texture2D>("background");
            flameTexture = Content.Load <Texture2D>("torch");
            cursor       = Content.Load <Texture2D>("cursor");

            world.addPlatform(new Rectangle(100, 100, 150, 25), Content.Load <Texture2D>("Platform"));
            world.addPlatform(new Rectangle(300, 100, 150, 25), Content.Load <Texture2D>("Platform"));
            world.addPlatform(new Rectangle(550, 100, 150, 25), Content.Load <Texture2D>("Platform"));
            world.addPlatform(new Rectangle(800, 100, 150, 25), Content.Load <Texture2D>("Platform"));

            playerTexture = Content.Load <Texture2D>("dude");
            player        = new Player(playerTexture, graphics, world, flameTexture);
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            var param = graphics.GraphicsDevice.PresentationParameters;

            scene = new RenderTarget2D(graphics.GraphicsDevice, param.BackBufferWidth, param.BackBufferHeight);
            mask  = new RenderTarget2D(graphics.GraphicsDevice, param.BackBufferWidth, param.BackBufferHeight);

            menu = new MainMenu(Content, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));

            //Powerups
            torchTexture    = Content.Load <Texture2D>("torchTexture");
            torchPowerupPos = new Vector2(0, 0);
            torchPowerup    = new Powerup(torchTexture, torchPowerupPos, 3);
        }