Exemplo n.º 1
0
        // Load graphics and sounds
        protected override void LoadContent()
        {
            _spriteBatch     = new SpriteBatch(GraphicsDevice);
            backgroundTxr    = Content.Load <Texture2D>("JumpThing_background");
            playerSheetTxr   = Content.Load <Texture2D>("JumpThing_spriteSheet1");
            platformSheetTxr = Content.Load <Texture2D>("JumpThing_spriteSheet2");
            UITextFont       = Content.Load <SpriteFont>("UIText");
            HeartFont        = Content.Load <SpriteFont>("HeartFont");
            jumpSound        = Content.Load <SoundEffect>("jump");
            bumpSound        = Content.Load <SoundEffect>("bump");
            fanfareSound     = Content.Load <SoundEffect>("fanfare");

            whiteBox = new Texture2D(GraphicsDevice, 1, 1);
            whiteBox.SetData(new[] { Color.White });

            PlayerSprite = new PlayerSprite(playerSheetTxr, whiteBox, new Vector2(100, 50), jumpSound, bumpSound);
            coinSprite   = new CoinSprite(playerSheetTxr, whiteBox, new Vector2(200, 200));

            BuildLevels();
        }
Exemplo n.º 2
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            backTex    = Content.Load <Texture2D>("background");                        //Load background texture
            sheet1     = Content.Load <Texture2D>("Sheet1");                            //Load sprite sheet 1 (Player and coins)
            sheet2     = Content.Load <Texture2D>("Sheet2");                            //Load sprite sheet 2 (platforms)
            font       = Content.Load <SpriteFont>("Font1");                            //Load font file for UI
            bigFont    = Content.Load <SpriteFont>("BigFont");                          //Load big font file for game over
            jumpSound  = Content.Load <SoundEffect>("JumpSound");                       //Load jump sound
            deathSound = Content.Load <SoundEffect>("DeathSound");                      //Load death sound
            coinSound  = Content.Load <SoundEffect>("CoinSound");                       //Load coin collction sound

            whiteBox = new Texture2D(GraphicsDevice, 1, 1);                             //Create empty sprite for drawing collision (1 by 1 pixel only)
            whiteBox.SetData(new[] { Color.White });                                    //Fill collision sprite with a white pixel

            BuildLevels();                                                              //Run BuildLevels (places all platforms for current level)

            player = new PlayerSprite(sheet1, whiteBox, startPos);                      //Create player
            coin   = new CoinSprite(sheet1, whiteBox, coinPos[currentLevel]);           //Create coin sprite
        }