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()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            soundCenter = new SoundCenter(this);
            font        = Content.Load <SpriteFont>("MyFont");

            Services.AddService(typeof(SpriteBatch), spriteBatch);
            Services.AddService(typeof(SoundCenter), soundCenter);
            Services.AddService(typeof(SpriteFont), font);

            score = new Score(this);
            Components.Add(score);

            gameOverScene = new GameOverScene(this, score);
            gameOverScene.Hide();

            level2 = new Level2(this, score, gameOverScene, null);
            level1 = new Level1(this, score, gameOverScene, level2);

            Components.Add(level1);
            Components.Add(level2);
            Components.Add(gameOverScene);

            level1.Show();
            level2.Hide();

            curScene = level2;
        }
Example #2
0
        private void Form1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Escape:
                ExitGame();
                break;

            case Keys.F1:
                GameReset();
                break;

            case Keys.Enter:
                var l2 = new Level2();
                l2.Visible = true;
                Close();
                break;
            }
        }
Example #3
0
        private void Form1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                ExitGame();
            }

            if (e.KeyCode == Keys.F1)
            {
                GameReset();
            }

            if (e.KeyCode == Keys.Enter) // && win_Menu.Visible == true)
            {
                Level2 l2 = new Level2();
                l2.Visible = true;
                this.Close();
            }
        }
Example #4
0
 private void Level2_Click(object sender, EventArgs e)
 {
     _form2 = new Level2();
     ShowForm(_form2);
     Close();
 }