public override void Update(GameTime gameTime)
        {
            backButton.Update(gameTime);
            LeftButton.Update(gameTime);
            RightButton.Update(gameTime);
            StartButton.Update(gameTime);

            KeyboardState ks = Keyboard.GetState();

            Keys[] pressedKeys = ks.GetPressedKeys();
            if (pressedKeys.Length > 0)
            {
                if (clickedKey == LeftButton)
                {
                    Main.moveLeft   = pressedKeys[0];
                    LeftButton.Text = Main.moveLeft.ToString();
                }
                else if (clickedKey == RightButton)
                {
                    Main.moveRight   = pressedKeys[0];
                    RightButton.Text = Main.moveRight.ToString();
                }
                else if (clickedKey == StartButton)
                {
                    Main.startBall   = pressedKeys[0];
                    StartButton.Text = Main.startBall.ToString();
                }
                assigning = false;
            }
            if (!assigning)
            {
                clickedKey = null;
            }
        }
Beispiel #2
0
 public override void Update(GameTime gameTime)
 {
     backButton.Update(gameTime);
     Level1Button.Update(gameTime);
     Level2Button.Update(gameTime);
     Level3Button.Update(gameTime);
     Level4Button.Update(gameTime);
     Level5Button.Update(gameTime);
     Level6Button.Update(gameTime);
     RandomLevelButton.Update(gameTime);
 }
Beispiel #3
0
 public override void Update(GameTime gameTime)
 {
     actionMenu.Update(gameTime);
     base.Update(gameTime);
 }
 public override void Update(GameTime gameTime)
 {
     backButton.Update(gameTime);
 }
Beispiel #5
0
        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            MouseState mouseStateCurrent = Mouse.GetState();

            if (mouseStateCurrent.LeftButton == ButtonState.Pressed && mouseStatePrevious.LeftButton == ButtonState.Released)
            {
                Point mousePoint = new Point(mouseStateCurrent.X, mouseStateCurrent.Y);

                // Determine if the user clicked on a number box button (+ or -)
                NumberBox numberBox = findNumberBoxByMousePoint(mousePoint);
                if (numberBox != null)
                {
                    int increaseBy = numberBox.determineMouseClick(mousePoint);
                    switch (numberBox.MyAttributeName)
                    {
                    case "STR":
                        stats.strength += increaseBy;
                        break;

                    case "UTI":
                        stats.utilization += increaseBy;
                        break;

                    case "RES":
                        stats.resourcefulness += increaseBy;
                        break;

                    case "VIT":
                        stats.vitality += increaseBy;
                        break;

                    case "INT":
                        stats.intelligence += increaseBy;
                        break;

                    case "VIS":
                        stats.vision += increaseBy;
                        break;

                    case "AGI":
                        stats.agility += increaseBy;
                        break;

                    case "LCK":
                        stats.luck += increaseBy;
                        break;
                    }
                }
            }

            mouseStatePrevious = mouseStateCurrent;

            foreach (NumberBox numberBox in numberBoxes)
            {
                numberBox.Update(gameTime);
            }

            buttonMenu.Update(gameTime);

            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }