Example #1
0
        public override void Update(GameTime gameTime)
        {
            // Allows the game to exit

            gamepadstate = GamePad.GetState(PlayerIndex.One);
            leapMotionButtons.Update(gameTime);
            #region read controller or keyboard to find out what is hit todo: leap motion support
            if (gamepadstate.IsButtonDown(Buttons.A) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.A))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.a;
                herocolor      = Color.White;
            }

            else if (gamepadstate.IsButtonDown(Buttons.B) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.B))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.b;
                herocolor      = Color.White;
            }

            else if (gamepadstate.IsButtonDown(Buttons.X) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.X))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.x;
                herocolor      = Color.White;
            }

            else if (gamepadstate.IsButtonDown(Buttons.Y) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Y))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.y;
                herocolor      = Color.White;
            }



            else if (gamepadstate.IsButtonDown(Buttons.DPadUp) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Up))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.up;
                herocolor      = Color.White;
            }

            else if (gamepadstate.IsButtonDown(Buttons.DPadDown) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Down))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.down;
                herocolor      = Color.White;
            }

            else if (gamepadstate.IsButtonDown(Buttons.DPadLeft) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Left))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.left;
                herocolor      = Color.White;
            }
            else if (gamepadstate.IsButtonDown(Buttons.DPadRight) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Right))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.right;
                herocolor      = Color.White;
            }

            #endregion
            // TODO: Add your update logic here
            #region code fight

            if (((scorenumber == 3) || (scorenumber > 3))) //&& (state == 0))
            {
                ScreenManager.Instance.AddScreen(ScreenManager.versuscharacter);
            }

            /*     else if (((scorenumber == 3) || (scorenumber > 3)) && (state == 1))
             *   {
             *       ScreenManager.Instance.AddScreen(ScreenManager.versuscharacter);
             *
             *   }
             *   else if (((scorenumber == 3) || (scorenumber > 3)) && (state == 2))
             *   {
             *       ScreenManager.Instance.AddScreen(ScreenManager.versuscharacter);
             *
             *   }*/

            if (villiansrect.Intersects(heroprojectilerect))
            {
                playSound               = true;
                scorenumber            += 1;
                villiancolor            = Color.Blue;
                villianprojecticerect.X = 630;
                heroprojectilerect.X    = 50;

                if (speedup == true)
                {
                    speedup       = false;
                    villianspeed += 1;
                }

                if (playSound == true)
                {
                    playSound = false;
                    boom.Play();
                }
            }

            else if (!(villiansrect.Intersects(heroprojectilerect) && (villianprojecticerect.X < 500)))
            {
                villiancolor = Color.White;
            }

            if (JimmyEllisRectangle.Intersects(villianprojecticerect))
            {
                herocolor = Color.Blue;
                villianprojecticerect.X = 630;
                scorenumber            -= 1;
            }


            villianprojecticerect.X -= villianspeed;

            /*
             *          else if ()
             *          {
             *
             *          }
             *
             *          else ()
             *          {
             *
             *          }*/

            #endregion
            #region random algorithim



            if ((isHit == true) && (thebuttonhit == whichbuttonhit))
            {
                #region code fight
                if ((isHit == true) && (whichbuttonhit == thebuttonhit))
                {
                    isHit = false;
                    heroprojectilerect.X += heroprojectilespeed;
                }
                #endregion code fight
                isHit = false;

                // change to 5 so that abxy only appears change to 8 or 9 so that all appear
                chosenrandom = random.Next(0, 5);

                if (chosenrandom == 1)
                {
                    thebuttonhit = WhichButtonHit.a;
                }

                else if (chosenrandom == 2)
                {
                    thebuttonhit = WhichButtonHit.b;
                }

                else if (chosenrandom == 3)
                {
                    thebuttonhit = WhichButtonHit.x;
                }
                else if (chosenrandom == 4)
                {
                    thebuttonhit = WhichButtonHit.y;
                }

                /*
                 * else if (chosenrandom == 5)
                 * {
                 * thebuttonhit = WhichButtonHit.up;
                 * }
                 * else if (chosenrandom == 6)
                 * {
                 * thebuttonhit = WhichButtonHit.down;
                 * }
                 * else if (chosenrandom == 7)
                 * {
                 * thebuttonhit = WhichButtonHit.left;
                 * }
                 * else if (chosenrandom == 8)
                 * {
                 * thebuttonhit = WhichButtonHit.right;
                 * }
                 */
            }

            #endregion


            #region Code Fight Update



            #endregion
        }
Example #2
0
        public override void Update(GameTime gameTime)
        {
            // Allows the game to exit

            gamepadstate = GamePad.GetState(PlayerIndex.One);


            if (gamepadstate.IsButtonDown(Buttons.A) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.A))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.a;
                herocolor      = Color.White;
            }

            else if (gamepadstate.IsButtonDown(Buttons.B) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.B))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.b;
                herocolor      = Color.White;
            }

            else if (gamepadstate.IsButtonDown(Buttons.X) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.X))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.x;
                herocolor      = Color.White;
            }

            else if (gamepadstate.IsButtonDown(Buttons.Y) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Y))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.y;
                herocolor      = Color.White;
            }



            else if (gamepadstate.IsButtonDown(Buttons.DPadUp) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Up))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.up;
                herocolor      = Color.White;
            }

            else if (gamepadstate.IsButtonDown(Buttons.DPadDown) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Down))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.down;
                herocolor      = Color.White;
            }

            else if (gamepadstate.IsButtonDown(Buttons.DPadLeft) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Left))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.left;
                herocolor      = Color.White;
            }
            else if (gamepadstate.IsButtonDown(Buttons.DPadRight) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Right))
            {
                isHit          = true;
                whichbuttonhit = WhichButtonHit.right;
                herocolor      = Color.White;
            }
            // TODO: Add your update logic here
            #region code fight

            if (((scorenumber == 3) || (scorenumber > 3)) && (state == 0))
            {
                ScreenManager.Instance.AddScreen(new PlayVideoState());
            }
            else if (((scorenumber == 3) || (scorenumber > 3)) && (state == 1))
            {
                ScreenManager.Instance.AddScreen(new PlayVideoState(1));
            }
            else if (((scorenumber == 3) || (scorenumber > 3)) && (state == 2))
            {
                ScreenManager.Instance.AddScreen(new JobSkills());
            }

            if (villiansrect.Intersects(heroprojectilerect))
            {
                playSound               = true;
                scorenumber            += 1;
                villiancolor            = Color.Blue;
                villianprojecticerect.X = 630;
                heroprojectilerect.X    = 50;

                if (speedup == true)
                {
                    speedup       = false;
                    villianspeed += 1;
                }

                if (playSound == true)
                {
                    playSound = false;
                    boom.Play();
                }
            }

            else if (!(villiansrect.Intersects(heroprojectilerect) && (villianprojecticerect.X < 500)))
            {
                villiancolor = Color.White;
            }

            if (JimmyEllisRectangle.Intersects(villianprojecticerect))
            {
                herocolor = Color.Blue;
                villianprojecticerect.X = 630;
                scorenumber            -= 1;
            }


            villianprojecticerect.X -= villianspeed;

            /*
             *          else if ()
             *          {
             *
             *          }
             *
             *          else ()
             *          {
             *
             *          }*/

            #endregion
            #region random algorithim



            if (isHit == true && (thebuttonhit == whichbuttonhit))
            {
                isHit        = false;
                chosenrandom = random.Next(0, 8);
                #region code fight
                heroprojectilerect.X += heroprojectilespeed;
                #endregion code fight
                if (chosenrandom == 1)
                {
                    thebuttonhit = WhichButtonHit.a;
                }

                else if (chosenrandom == 2)
                {
                    thebuttonhit = WhichButtonHit.b;
                }

                else if (chosenrandom == 3)
                {
                    thebuttonhit = WhichButtonHit.x;
                }
                else if (chosenrandom == 4)
                {
                    thebuttonhit = WhichButtonHit.y;
                }
                else if (chosenrandom == 5)
                {
                    thebuttonhit = WhichButtonHit.up;
                }
                else if (chosenrandom == 6)
                {
                    thebuttonhit = WhichButtonHit.down;
                }
                else if (chosenrandom == 7)
                {
                    thebuttonhit = WhichButtonHit.left;
                }
                else if (chosenrandom == 8)
                {
                    thebuttonhit = WhichButtonHit.right;
                }
            }

            #endregion


            #region Code Fight Update



            #endregion


            //text disappear based on time algorithim


            #region after Several seconds disappear logic
            if (isMarkGotten == false)
            {
                stateChangeTimeMarkString = Game1.heldTimeCatcher.ToString();
                stateChangeTimeMarkNumber = System.Convert.ToInt32(stateChangeTimeMarkString);
                isMarkGotten = true;
            }



            if ((stateChangeTimeMarkNumber + 10) == System.Convert.ToInt32(Game1.heldTimeCatcher))
            {
                isMarkTimeEqualToGameTime = true;
                textSeen = true;
            }
            #endregion
        }
Example #3
0
        public ResumeVideoGame()
        {
            leapMotionButtons = new LeapMotionButtonsMarketing();
            // TODO: Add your initialization logic here
            random      = new Random();
            buttoncolor = new Color();
            buttoncolor = Color.White;

            scorenumber = 0;

            state     = 0;
            playSound = false;
            // setting of button to hit variables
            xaxis      = 0;
            yaxis      = 150;
            widthsize  = 128;
            heightsize = 128;


            #region Code Fight Initialize
            herocolor           = Color.White;
            villiancolor        = Color.White;
            villianspeed        = 1;
            JimmyEllisRectangle = new Rectangle(0, 300, 128, 128);
            villiansrect        = new Rectangle(670, 300, 128, 128);

            heroprojectilerect    = new Rectangle(50, 320, 256, 64);
            heroprojectilespeed   = 100;
            villianprojecticerect = new Rectangle(670, 300, 128, 128);

            #endregion
            hitbuttoncolor = Color.Magenta;

            // setting of hit button variables
            hitxaxis          = 650;
            hityaxis          = 150;
            hitwidthsize      = 128;
            hitheightsize     = 128;
            hitbuttonlocation = new Rectangle(hitxaxis, hityaxis, hitwidthsize, hitheightsize);

            thebuttonhit = WhichButtonHit.a;

            #region Code Fight Code
            villians = new Texture2D[4];

            speedup = false;

            #endregion
            Arect = new Rectangle(xaxis, yaxis, widthsize, heightsize);
            Brect = new Rectangle(xaxis, yaxis, widthsize, heightsize);
            Xrect = new Rectangle(xaxis, yaxis, widthsize, heightsize);
            Yrect = new Rectangle(xaxis, yaxis, widthsize, heightsize);



            isHit     = false;
            uprect    = new Rectangle(xaxis, yaxis, widthsize, heightsize);
            downrect  = new Rectangle(xaxis, yaxis, widthsize, heightsize);
            leftrect  = new Rectangle(xaxis, yaxis, widthsize, heightsize);
            rightrect = new Rectangle(xaxis, yaxis, widthsize, heightsize);

            chosenrandom = 0;
            gamepadstate = new GamePadState();
        }
Example #4
0
        public ResumeVideoGame(int newstate)
        {
            #region after several seconds disappear constructor code
            isMarkTimeEqualToGameTime = false;
            textSeen     = false;
            isMarkGotten = false;
            #endregion
            // TODO: Add your initialization logic here
            random      = new Random();
            buttoncolor = new Color();
            buttoncolor = Color.White;

            scorenumber = 0;

            this.state = newstate;
            playSound  = false;
            // setting of button to hit variables
            xaxis      = 0;
            yaxis      = 150;
            widthsize  = 128;
            heightsize = 128;


            #region Code Fight Initialize
            herocolor           = Color.White;
            villiancolor        = Color.White;
            villianspeed        = 1;
            JimmyEllisRectangle = new Rectangle(0, 300, 128, 128);
            villiansrect        = new Rectangle(670, 300, 128, 128);

            heroprojectilerect    = new Rectangle(50, 320, 128, 128);
            heroprojectilespeed   = 100;
            villianprojecticerect = new Rectangle(670, 300, 128, 128);

            #endregion
            hitbuttoncolor = Color.Magenta;

            // setting of hit button variables
            hitxaxis          = 650;
            hityaxis          = 150;
            hitwidthsize      = 128;
            hitheightsize     = 128;
            hitbuttonlocation = new Rectangle(hitxaxis, hityaxis, hitwidthsize, hitheightsize);

            thebuttonhit = WhichButtonHit.a;

            #region Code Fight Code
            villians = new Texture2D[4];

            speedup = false;

            #endregion
            Arect = new Rectangle(xaxis, yaxis, widthsize, heightsize);
            Brect = new Rectangle(xaxis, yaxis, widthsize, heightsize);
            Xrect = new Rectangle(xaxis, yaxis, widthsize, heightsize);
            Yrect = new Rectangle(xaxis, yaxis, widthsize, heightsize);



            isHit     = false;
            uprect    = new Rectangle(xaxis, yaxis, widthsize, heightsize);
            downrect  = new Rectangle(xaxis, yaxis, widthsize, heightsize);
            leftrect  = new Rectangle(xaxis, yaxis, widthsize, heightsize);
            rightrect = new Rectangle(xaxis, yaxis, widthsize, heightsize);

            chosenrandom = 0;
            gamepadstate = new GamePadState();
        }