Example #1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            keyboardState = Keyboard.GetState ();

            if (activeScreen == startScreen) {
                if (CheckKey (Keys.Enter)) {
                    activeScreen.Hide ();
                    actionScreen.NumPlayers = startScreen.SelectedIndex + 1;
                    actionScreen.NewGame ();
                    activeScreen = actionScreen;
                    activeScreen.Show ();
                }
            }

            if (activeScreen == actionScreen) {
                if (CheckKey (Keys.Escape) || (CheckKey (Keys.Space) && actionScreen.GameOver)) {
                    activeScreen.Hide ();
                    activeScreen = startScreen;
                    activeScreen.Show ();
                }
            }

            base.Update (gameTime);

            oldKeyboardState = keyboardState;
        }
Example #2
0
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be use to draw textures.
            spriteBatch = new SpriteBatch (graphics.GraphicsDevice);

            font = Content.Load<SpriteFont> ("SpriteFont1");
            rectangle = Content.Load<Texture2D> ("WhiteSquare");

            startScreen = new StartScreen (this, spriteBatch, font);
            startScreen.Hide ();
            Components.Add (startScreen);

            actionScreen = new ActionScreen (this, spriteBatch, Content, font, rectangle);
            actionScreen.Hide ();
            Components.Add (actionScreen);

            activeScreen = startScreen;
            activeScreen.Show ();

            base.LoadContent ();
        }
Example #3
0
        static void Main(string[] args)
        {
            GameScreen game = new GameScreen();

            game.Run();
        }