Esempio n. 1
0
 protected override void Initialize()
 {
     base.Initialize();  // Calls LoadContent(), among other things
     DrawText.Initialize(spriteBatch, graphics);
     manager = new ScreenManager(this, spriteBatch, graphics);
     manager.defaultFont = Content.Load<SpriteFont>("on the rocks");
     manager.graphics.PreferredBackBufferWidth= 1024;
     manager.graphics.PreferredBackBufferHeight = 768;
     manager.graphics.ApplyChanges();
     // Add game screens here.  The first one to be added will be the active screen.
     manager.Add(new MenuScreen(), "menu");
     manager.Add(new InGameScreen(), "ingame");
     manager.Add(new GameOverScreen(), "gameOver");
     manager.InitializeAllScreens();
 }
Esempio n. 2
0
 public virtual void Initialize(ScreenManager mgr)
 {
     if (mgr == null) throw new Exception("You must set up the screen manager before initializing screens!");
     manager = mgr;
 }
Esempio n. 3
0
 ////////////////////////////////////////////////////////////////////////////////
 // INITIALIZE THE SCREEN
 ////////////////////////////////////////////////////////////////////////////////
 public override void Initialize(ScreenManager mgr)
 {
     base.Initialize(mgr);
     selectSound = Content.Load<SoundEffect>("start");
 }
Esempio n. 4
0
 ////////////////////////////////////////////////////////////////////////////////
 // DECLARATIONS
 ////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////
 // INITIALIZE THE SCREEN
 ////////////////////////////////////////////////////////////////////////////////
 public override void Initialize(ScreenManager mgr)
 {
     base.Initialize(mgr);
 }
Esempio n. 5
0
        ///////////////////////////////////////////////////////////////////////
        // INITIALIZE THE SCREEN
        ///////////////////////////////////////////////////////////////////////
        public override void Initialize(ScreenManager mgr)
        {
            base.Initialize(mgr);
            batImage = Content.Load<Texture2D>("bat");
            ballImage = Content.Load<Texture2D>("ball");
            brickImage = Content.Load<Texture2D>("brick-bw");
            bricks[0] = new GameSprite(brickImage, new Vector2(0,0));
            bricks[0].image = brickImage;

            for(int brickNumber = 0; brickNumber < 10; brickNumber+=1)
            {
                bricks[brickNumber] = new GameSprite(brickImage, new Vector2(brickNumber * 100+60,100));
            }
            for (int brickNumber = 10; brickNumber < 20; brickNumber += 1)
            {
                bricks[brickNumber] = new GameSprite(brickImage, new Vector2(brickNumber * 100 - 940, 150));
            }
            for (int brickNumber = 20; brickNumber < 30; brickNumber += 1)
            {
                bricks[brickNumber] = new GameSprite(brickImage, new Vector2(brickNumber * 100 - 1940, 200));
            }
            for (int brickNumber = 30; brickNumber < 40; brickNumber += 1)
            {
                bricks[brickNumber] = new GameSprite(brickImage, new Vector2(brickNumber * 100 - 2940, 250));
            }

            bat = new GameSprite(batImage, Vector2.Zero);
            ball = new GameSprite(ballImage, Vector2.Zero);
            bounceSound = Content.Load<SoundEffect>("boinggg");
            bounceSoundInst = bounceSound.CreateInstance();
            pointScoredSound = Content.Load<SoundEffect>("break crate");
            loseSound = Content.Load<SoundEffect>("fail");
            ResetLevel();
        }