Example #1
0
        public void Update(GameTime gameTime)
        {
            int pointMod = maxPoints - minPoints + 1;

            KeyboardState kbs = Keyboard.GetState();

            if (oldKbs.IsKeyDown(Keys.Right) && kbs.IsKeyUp(Keys.Right))
            {
                cursor = (cursor + 1) % maps.Count;
            }
            if (oldKbs.IsKeyDown(Keys.Left) && kbs.IsKeyUp(Keys.Left))
            {
                cursor = (cursor + maps.Count - 1) % maps.Count;
            }
            if (oldKbs.IsKeyDown(Keys.Up) && kbs.IsKeyUp(Keys.Up))
            {
                pointsToWin = (pointsToWin - minPoints + 1) % pointMod + minPoints;
            }
            if (oldKbs.IsKeyDown(Keys.Down) && kbs.IsKeyUp(Keys.Down))
            {
                pointsToWin = (pointsToWin - minPoints + pointMod - 1) % pointMod + minPoints;
            }
            if (oldKbs.IsKeyDown(Keys.Enter) && kbs.IsKeyUp(Keys.Enter))
            {
                Globals.SetState(new MainGame(maps[cursor], pointsToWin));
            }
            oldKbs = kbs;
        }
Example #2
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     Globals.random = new Random();
     base.Initialize();
     //Globals.SetState(new MainGame());
     Globals.SetState(new Menu());
 }
Example #3
0
        public void Update(GameTime gameTime)
        {
            KeyboardState kbs = Keyboard.GetState();

            if (kbs.IsKeyDown(Keys.Space))
            {
                Globals.SetState(new Menu());
            }
        }
Example #4
0
 private void Restart()
 {
     Sprite.SpriteList.Clear();
     Explosion.ExplosionList.Clear();
     playerList.Clear();
     if (winner != null && score[winner.Id] == pointsToWin)
     {
         Globals.SetState(new WinnerState(winner));
         return;
     }
     Initialize();
 }