Ejemplo n.º 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)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            switch (gamestate)
            {
            case GameState.Main:
                gamestate = MainMenu.Update(gameTime);
                break;

            case GameState.Upgrade:
                //upgrade_menu
                gamestate = UpgradeMenu.Update(gameTime);
                break;

            case GameState.Lair:
                gamestate = LairManager.Update(gameTime);
                break;

            case GameState.Battle:
                gamestate = BattleManager.Update(gameTime);
                break;

            case GameState.Quit:
                Exit();
                break;

            case GameState.Credits:
                break;
            }
            base.Update(gameTime);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
            //RenderTarget2D target = new RenderTarget2D(GraphicsDevice, 800, 480);
            //GraphicsDevice.SetRenderTarget(target);

            switch (gamestate)
            {
            case GameState.Main:
                MainMenu.Draw(spriteBatch);
                break;

            case GameState.Upgrade:
                //upgrade_menu
                UpgradeMenu.Draw(spriteBatch);
                break;

            case GameState.Lair:
                LairManager.Draw(spriteBatch);
                break;

            case GameState.Battle:
                BattleManager.Draw(spriteBatch);
                break;

            case GameState.Credits:
                spriteBatch.Draw(BattleManager.bkgd, new Rectangle(-450, -100, 2000, 1086), Color.White);
                BattleManager.boss.Draw(spriteBatch, Color.White);
                if (CreditTimer > 0 || slide >= 4)
                {
                    EndGameText.Draw(spriteBatch);
                    CreditTimer--;
                }
                else
                {
                    EndGameText.changeMessage(Credits[slide]);
                    CreditTimer = 400;
                    slide++;
                }
                break;
            }
            //spriteBatch.End();
            //GraphicsDevice.SetRenderTarget(null);
            //spriteBatch.Begin();
            //spriteBatch.Draw(target, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), Color.White);
            spriteBatch.End();
            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            //RenderTarget2D target = new RenderTarget2D(GraphicsDevice, 1024, 576);
            //GraphicsDevice.SetRenderTarget(target);
            Text.loadContent(Content);
            Button.LoadContent(Content);
            MainMenu.loadContent(Content);
            MenuBoss.LoadContent(Content);
            //UpgradeMenu.loadContent(Content);

            PartyManager.Init();
            Resources.Init();
            SkillTree.LoadContent(Content);
            //SkillTree.Init();


            Character.load_content(Content);
            AnimatedEffect.LoadContent(Content);
            Status.LoadContent(Content);
            BattleManager.LoadContent(Content);
            SkillTree.LoadContent(Content);
            UpgradeMenu.loadContent(Content);
            LairManager.loadContent(Content);

            Menu_Song                   = Content.Load <SoundEffect>("Sounds/Epic_Loop");
            Menu_Song_Instance          = Menu_Song.CreateInstance();
            Menu_Song_Instance.IsLooped = true;
            Menu_Song_Instance.Volume   = .1f;

            Battle_Song                   = Content.Load <SoundEffect>("Sounds/VGameTune");
            Battle_Song_Instance          = Battle_Song.CreateInstance();
            Battle_Song_Instance.IsLooped = true;
            Battle_Song_Instance.Volume   = .1f;

            Main_Song                   = Content.Load <SoundEffect>("Sounds/LingeringChip");
            Main_Song_Instance          = Main_Song.CreateInstance();
            Main_Song_Instance.IsLooped = true;
            Main_Song_Instance.Volume   = .3f;
            //both songs have no duration

            EndGameText = new Text("And So,\n\nThrough much perserverence\nand a low interest mortgage\nour boss was finally\n\nLeft Alone.",
                                   new Vector2(300, 200), Text.fonts["6809Chargen-24"], Color.Cyan);
        }
Ejemplo n.º 4
0
        public static LeaveMeAlone.GameState Update(GameTime gametime)
        {
            int selectLocX = Mouse.GetState().X;
            int selectLocY = Mouse.GetState().Y;

            //Keyboard.GetState();
            //If the mouse is released we can continue taking new input
            if (Mouse.GetState().LeftButton == ButtonState.Released)
            {
                left_click = false;
            }
            if (Mouse.GetState().RightButton == ButtonState.Released)
            {
                right_click = false;
            }
            switch (state)
            {
            case State.Basic:
                if (basic_buttons[1].Intersects(selectLocX, selectLocY))
                {
                    //Go toSkill menu
                    hovertext.changeMessage("Skills:\nShow them your moves!");
                    if (leftClicked())
                    {
                        NewMenu(1);
                    }
                }
                else if (basic_buttons[3].Intersects(selectLocX, selectLocY))
                {
                    hovertext.changeMessage("Bribe:\nCan't take the heat? Buy off your enemies! Everyone has a price! Don't worry, he'll replace himself with a corpse and nobody will know any better");
                    //Go to Bribe menu
                    if (leftClicked())
                    {
                        NewMenu(2);
                    }
                }
                else if (basic_buttons[0].Intersects(selectLocX, selectLocY))
                {
                    hovertext.changeMessage("Attack:\nPut up your dukes, and show them what you are made of! Use your Attack power");
                    //TODO: need a way to select basic attack
                    if (leftClicked())
                    {
                        selected_skill = boss.basic_attack;

                        state = State.Target;
                    }
                }
                else if (basic_buttons[2].Intersects(selectLocX, selectLocY))
                {
                    hovertext.changeMessage("Defend:\nHeal some health and regain energy");
                    //TODO: need a way to select taunt
                    if (leftClicked())
                    {
                        selected_skill = boss.defend;
                        targeted_enemy = -1;     //Don't need this
                        state          = State.Attack;
                    }
                }
                else
                {
                    hovertext.changeMessage("");
                }

                break;

            case State.Skills:
                //Skill Selection
                //if (Mouse.GetState().LeftButton == ButtonState.Pressed && !left_click)
                //{

                message.changeMessage(selectLocX + ", " + selectLocY);
                for (int i = 0; i < 6; i++)
                {
                    if (skill_buttons[i].Intersects(selectLocX, selectLocY))
                    {
                        if (i < boss.selected_skills.Count)
                        {
                            hovertext.changeMessage(skill_buttons[i].text.message + ":\nMana Cost: "
                                                    + boss.selected_skills[i].energy + "\nCooldown: " + boss.selected_skills[i].cooldown + "\n" +
                                                    boss.selected_skills[i].description);
                        }
                        if (leftClicked())
                        {
                            try
                            {
                                selected_skill = boss.selected_skills[i];
                                //check cooldown
                                if (check_cooldown[i] > 0)
                                {
                                    info_text.changeMessage("Can't use skill,\nwait for cooldown:" + check_cooldown[i]);
                                    continue;
                                }
                                //check mana_cost
                                if (selected_skill.energy > boss.energy)
                                {
                                    info_text.changeMessage("Not Enough Energy!");
                                    continue;
                                }

                                if (selected_skill.target == Skill.Target.Single)
                                {
                                    state = State.Target;
                                }
                                else
                                {
                                    state = State.Attack;
                                }
                            }

                            catch
                            {
                            }
                        }
                    }
                }
                if (back_button.Intersects(selectLocX, selectLocY) && leftClicked())
                {
                    NewMenu(0);
                    state = 0;
                }

                //}
                break;

            case State.Bribe:
                //Bribe Stuff

                if (rightClicked())
                {
                    for (int i = 0; i < 4; i++)
                    {
                        if (bribe_amounts[i].Intersects(selectLocX, selectLocY))
                        {
                            bribe_gold -= (int)Math.Pow(10, i + 1);
                            total_amount.UpdateText("How Much?: " + bribe_gold.ToString());
                            right_click = true;
                        }
                    }
                }
                if (leftClicked())
                {
                    for (int i = 0; i < 4; i++)
                    {
                        if (bribe_amounts[i].Intersects(selectLocX, selectLocY))
                        {
                            bribe_gold += (int)Math.Pow(10, i + 1);
                            total_amount.UpdateText("How Much?: " + bribe_gold.ToString());
                            left_click = true;
                        }
                    }
                    if (back_button.Intersects(selectLocX, selectLocY))
                    {
                        NewMenu(0);
                        state      = 0;
                        bribe_gold = 0;
                        total_amount.UpdateText("How Much?: 0");
                    }
                }
                //Send bribe target at enemy
                targeted_enemy = Target();
                if (targeted_enemy >= 0)
                {
                    if (heroes[targeted_enemy].gold <= bribe_gold && Resources.gold >= bribe_gold)
                    {
                        //remove hero
                        heroes[targeted_enemy] = null;
                        Resources.gold        -= bribe_gold;
                        my_amount.UpdateText("My Total: " + Resources.gold);
                        CheckVictoryDefeat();
                    }
                    else
                    {
                        NewMenu(0);
                        state         = 0;
                        hovered_enemy = -1;
                    }
                    bribe_gold = 0;
                    total_amount.UpdateText("How Much?: 0");
                }
                break;

            case State.Target:
                //Targetting

                //highlighted needs to be separate from targeted enemy because target ensure that we have clicked on something
                targeted_enemy = Target();
                if (targeted_enemy != -1)
                {
                    state         = State.Attack;
                    hovered_enemy = -1;
                }
                if (Mouse.GetState().LeftButton == ButtonState.Pressed)
                {
                    if (back_button.Intersects(selectLocX, selectLocY))
                    {
                        NewMenu(0);
                    }
                }

                break;

            case State.Attack:
                //Attacking
                hovertext.message = "";
                Attack(boss);
                updateHealth();

                break;

            case State.Endgame:
                //if (Mouse.GetState().LeftButton == ButtonState.Pressed && !left_click)
                if (UpgradeMenu.leftClicked())
                {
                    if (next_button.Intersects(selectLocX, selectLocY))
                    {
                        //Clear the boss's stats
                        foreach (Status status in boss.statuses)
                        {
                            if (status.effect_time == Status.Effect_Time.Once && status.reverse_affect != null)
                            {
                                Console.WriteLine(status.name);
                                status.reverse_affect(boss);
                            }
                        }
                        boss.statuses.Clear();
                        if (victory)
                        {
                            if (LairManager.EndOfGame && LairManager.BossBattle)
                            {
                                return(LeaveMeAlone.GameState.Credits);
                            }
                            //Do next battle
                            //Go to next (Upgrade) menu
                            PartyManager.PartyNum++;
                            //MainMenu.init();
                            //heroLoc.Clear();
                            victory = false;
                            UpgradeMenu.rerollRooms();
                            UpgradeMenu.left_click = false;
                            LairManager.Init();
                            return(LeaveMeAlone.GameState.Upgrade);
                        }
                        else if (defeat)
                        {
                            //Restart battle
                            //heroLoc.Clear();
                            MainMenu.init(false);
                            return(LeaveMeAlone.GameState.Main);
                        }
                    }
                }
                break;

            case State.EnemyTurn:
                //Enemy Turn
                //Wait to allow the user to see what's happening
                if (enemy_turn > 0 && heroes[enemy_turn - 1] != null)
                {
                    if (heroes[enemy_turn - 1].is_attacking)
                    {
                        break;
                    }
                }
                else
                {
                    if (boss.is_attacking)
                    {
                        break;
                    }
                }

                /*
                 * if (enemy_attack_delay > 0)
                 * {
                 *  enemy_attack_delay--;
                 *  break;
                 * }
                 */
                if (enemy_turn >= heroes.Count())
                {
                    //pass the turn
                    state = State.Basic;
                    NewMenu(0);
                    enemy_turn     = -1;
                    targeted_enemy = -1;
                    CheckVictoryDefeat();
                    break;
                }

                Character enemy = heroes[enemy_turn];
                if (enemy == null)
                {
                    enemy_turn++;
                    break;
                }
                //enemy_attack_delay = 60;

                //AI occurs
                var pair = enemy.Think();
                selected_skill = pair.Key;
                targeted_enemy = pair.Value;
                Attack(enemy);

                //Check if this enemy has haste, and check if a hasted enemy has already attacked
                if (enemy.statuses.Contains(Status.check_haste) && !haste_check)
                {
                    haste_check = true;
                    CheckVictoryDefeat();
                    break;
                }
                else     //pass the turn to the next character
                {
                    haste_check = false;
                    enemy_turn++;
                }
                //Check if end of enemy turn;
                if (enemy_turn >= heroes.Count())
                {
                    state = State.Basic;
                    NewMenu(0);
                    enemy_turn     = -1;
                    targeted_enemy = -1;
                }
                //Check after each Enemy
                CheckVictoryDefeat();
                break;
            }

            for (int i = 0; i < heroes.Count(); i++)
            {
                if (heroes[i] == null)
                {
                    continue;
                }
                heroes[i].Update(gametime);
            }
            boss.Update(gametime);

            updateHealth();

            return(LeaveMeAlone.GameState.Battle);
        }
Ejemplo n.º 5
0
        public static LeaveMeAlone.GameState Update(GameTime gameTime)
        {
            lastMouseState    = currentMouseState;
            currentMouseState = Mouse.GetState();
            if (menu_state == MenuState.main)
            {
                if (lastMouseState.LeftButton == ButtonState.Pressed && currentMouseState.LeftButton == ButtonState.Released)
                {
                    if (newGame.Intersects(currentMouseState.X, currentMouseState.Y))
                    {
                        menu_state = MenuState.opening;
                    }
                    else if (loadGame.Intersects(currentMouseState.X, currentMouseState.Y) && !isNewGame)
                    {
                        LeaveMeAlone.Main_Song_Instance.Stop();
                        LeaveMeAlone.Menu_Song_Instance.Play();
                        return(LeaveMeAlone.GameState.Upgrade);
                    }
                    else if (quit.Intersects(currentMouseState.X, currentMouseState.Y))
                    {
                        return(LeaveMeAlone.GameState.Quit);
                    }
                }
            }
            else if (menu_state == MenuState.opening)
            {
                if (lastMouseState.LeftButton == ButtonState.Pressed && currentMouseState.LeftButton == ButtonState.Released)
                {
                    if (next_intro.Intersects(currentMouseState.X, currentMouseState.Y))
                    {
                        line_number++;
                        opening_timer = 0;
                    }
                    if (skip_intro.Intersects(currentMouseState.X, currentMouseState.Y))
                    {
                        line_number = 1 + opening_monologue.Count();
                    }
                }
                if (line_number == 1 + opening_monologue.Count())
                {
                    menu_state = MenuState.boss;
                }
                else if (opening_timer > 300)
                {
                    if (line_number != opening_monologue.Count())
                    {
                        opening_timer = 0;
                    }
                    line_number++;
                }
                else
                {
                    opening_timer++;
                }
            }
            else
            {
                if (brute.Contains(new Vector2(currentMouseState.X, currentMouseState.Y)))
                {
                    bruteHover      = true;
                    mastermindHover = false;
                    operativeHover  = false;
                    brute.walk();
                    mastermind.idle();
                    operative.idle();
                    current = brute;
                }
                else if (mastermind.Contains(new Vector2(currentMouseState.X, currentMouseState.Y)))
                {
                    bruteHover      = false;
                    mastermindHover = true;
                    operativeHover  = false;
                    brute.idle();
                    mastermind.walk();
                    operative.idle();
                    current = mastermind;
                }
                else if (operative.Contains(new Vector2(currentMouseState.X, currentMouseState.Y)))
                {
                    bruteHover      = false;
                    mastermindHover = false;
                    operativeHover  = true;
                    brute.idle();
                    mastermind.idle();
                    operative.walk();
                    current = operative;
                }
                else
                {
                    current         = null;
                    bruteHover      = false;
                    mastermindHover = false;
                    operativeHover  = false;
                    brute.idle();
                    mastermind.idle();
                    operative.idle();
                }
                brute.Update(gameTime);
                mastermind.Update(gameTime);
                operative.Update(gameTime);
                if (lastMouseState.LeftButton == ButtonState.Pressed && currentMouseState.LeftButton == ButtonState.Released && canFinish)
                {
                    Vector2 mousePos = new Vector2(currentMouseState.X, currentMouseState.Y);
                    if (operative.Contains(mousePos) || brute.Contains(mousePos) || mastermind.Contains(mousePos))
                    {
                        BattleManager.boss = new Character(current.bossType, 1, new Vector2(BattleManager.bossLoc.X, BattleManager.bossLoc.Y));


                        BattleManager.heroes = PartyManager.CreateParty();

                        LeaveMeAlone.Main_Song_Instance.Stop();

                        UpgradeMenu.boughtRooms.Clear();
                        Resources.gold = 1000;
                        Resources.exp  = 0;
                        UpgradeMenu.Init(current);
                        LairManager.Init();
                        PartyManager.Init();
                        LairManager.EndOfGame   = false;
                        LairManager.TowerLevel  = 0;
                        LairManager.MaxLevel    = 3;
                        LairManager.LairRooms   = new List <Room>();
                        LairManager.boughtRooms = new List <UpgradeMenu.ButtonRoom>();

                        //return LeaveMeAlone.GameState.Upgrade;
                        return(LeaveMeAlone.GameState.Upgrade);
                    }
                }
                canFinish = true;
            }
            return(LeaveMeAlone.GameState.Main);
        }
Ejemplo n.º 6
0
        public static LeaveMeAlone.GameState Update(GameTime g)
        {
            lastMouseState    = currentMouseState;
            currentMouseState = Mouse.GetState();
            int xpos = currentMouseState.X;
            int ypos = currentMouseState.Y;

            texts["gold"].changeMessage("Gold: " + Resources.gold);
            texts["level"].changeMessage("Level: " + BattleManager.boss.level);

            if (Mouse.GetState().LeftButton == ButtonState.Released)
            {
                left_click = false;
            }
            if (Mouse.GetState().RightButton == ButtonState.Released)
            {
                right_click = false;
            }

            if (BattleManager.boss.level < 2)
            {
                HandleTutorial();
            }

            foreach (Skill s in BattleManager.boss.skills)
            {
                skilltree.SkillButtons[s].text.color = Color.Black;
            }
            //gets things that haven't been bought and colors them
            foreach (Skill s in skilltree.SkillButtons.Keys.Except(BattleManager.boss.skills))
            {
                if (s.cost > Resources.gold || BattleManager.boss.level < s.level)
                {
                    skilltree.SkillButtons[s].text.color = Color.Red;
                }
                else
                {
                    skilltree.SkillButtons[s].text.color = Color.Blue;
                }
            }

            bool hovered = false;

            foreach (Skill s in skilltree.SkillButtons.Keys)
            {
                if (skilltree.SkillButtons[s].Intersects(currentMouseState.X, currentMouseState.Y))
                {
                    hovertext.changeMessage(s.name + ":\n" + s.description);
                    hovered = true;
                }
            }
            //Hover over Stats button
            if (statsTitleRect.Contains(currentMouseState.X, currentMouseState.Y))
            {
                statsText.changeMessage(BattleManager.boss.StatsToString());
                Vector2 statmeasurements = statsText.getMeasurements(300);
                statsText.position = new Vector2(statsTitle.position.X, statsTitleRect.Y + statsTitleRect.Height + 10);
                Console.WriteLine("statspos" + statsText.position.ToString());
                statsTextRect = new Rectangle((int)statsText.position.X - 10, (int)statsText.position.Y - 10, 300, (int)statmeasurements.Y + 10);
            }
            else
            {
                statsText.changeMessage("");
            }

            //perfect place for polymophism Chris
            hovered = false;
            foreach (Skill s in skilltree.SkillButtons.Keys)
            {
                if (skilltree.SkillButtons[s].Intersects(currentMouseState.X, currentMouseState.Y))
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append(s.name + ":");
                    if (BattleManager.boss.skills.Contains(s))
                    {
                        sb.Append(" (bought)");
                    }
                    else
                    {
                        sb.Append(" (Cost: " + s.cost + ")");
                    }
                    sb.Append("\nMana Cost: " + s.energy + "\nCooldown: " + s.cooldown + "\n");
                    sb.Append("\n" + s.description);
                    hovertext.changeMessage(sb.ToString());
                    hovered = true;
                }
            }
            foreach (ButtonRoom r in AvailableRooms)
            {
                if (r.b.Intersects(currentMouseState.X, currentMouseState.Y))
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append(r.r.name + ":");
                    if (boughtRooms.Contains(r.r))
                    {
                        sb.Append(" (bought)");
                    }
                    else
                    {
                        sb.Append(" (Cost: " + r.r.cost + ")");
                    }
                    sb.Append("\n" + r.r.description);
                    hovertext.changeMessage(sb.ToString());
                    hovered = true;
                }
            }
            if (hovered == false)
            {
                hovertext.changeMessage("");
            }
            selectedBoss.Update(g);
            //if (lastMouseState.LeftButton == ButtonState.Pressed && currentMouseState.LeftButton == ButtonState.Released)
            if (leftClicked())
            {
                //check if a room was clicked on
                for (int x = 0; x < AvailableRooms.Length; x++)
                {
                    if (BattleManager.boss.selected_rooms.Contains(AvailableRooms[x].r) == false && AvailableRooms[x].b.Intersects(currentMouseState.X, currentMouseState.Y) && AvailableRooms[x].r.level != -1)
                    {
                        if (AvailableRooms[x].r.cost < Resources.gold)
                        {
                            BattleManager.boss.selected_rooms.Add(AvailableRooms[x].r);
                            LairManager.addRoom(AvailableRooms[x]);
                            boughtRooms.Add(AvailableRooms[x].r);
                            Resources.gold -= AvailableRooms[x].r.cost;
                            tutorial_state  = TutorialState.Back;
                            buyingSound.Play();
                        }
                    }
                }
                //check the next button
                if (next.Intersects(currentMouseState.X, currentMouseState.Y))
                {
                    BattleManager.bossDefaultPosition();
                    LairManager.tutorial_state = LairManager.TutorialState.Build1;
                    return(LeaveMeAlone.GameState.Lair);
                }
                //check if we clicked on a skill
                foreach (Skill s in skilltree.SkillButtons.Keys)
                {
                    if (skilltree.SkillButtons[s].Intersects(currentMouseState.X, currentMouseState.Y))
                    {
                        Console.WriteLine("Got one!");
                        if (BattleManager.boss.skills.Contains(s) == false && BattleManager.boss.level >= s.level)
                        {
                            //if you have enough money, buy it
                            if (s.cost < Resources.gold)
                            {
                                BattleManager.boss.addSkill(s);
                                buyingSound.Play();
                                tutorial_state  = TutorialState.BuyRoom;
                                Resources.gold -= s.cost;
                                if (s == SkillTree.final_skill[BattleManager.boss.charType])
                                {
                                    LairManager.EndOfGame = true;
                                    LairManager.nextwaveBtn.rectangle.X = LeaveMeAlone.BackgroundRect.X;
                                    LairManager.nextwaveBtn.rectangle.Y = LeaveMeAlone.BackgroundRect.Height - 200;
                                }
                                //Console.WriteLine(BattleManager.boss.skills.Count);
                            }
                        }
                        else
                        {
                            //When a skill isn't selected to swap, it should be set to default(Skill)
                            if (selectedSkillSwapButton.s != default(Skill) && BattleManager.boss.skills.Contains(s) == true && BattleManager.boss.selected_skills.Contains(s) == false)
                            {
                                int index = BattleManager.boss.selected_skills.IndexOf(selectedSkillSwapButton.s);
                                BattleManager.boss.selected_skills[index] = s;
                                swappingSound.Play();
                                Console.WriteLine("swapped");
                            }
                        }
                        //Console.WriteLine(s+" pressed");
                    }
                }
                updateSelectedSkills();
                bool flag = false;
                for (int x = 0; x < SelectedSkills.Length; x++)
                {
                    var buttonStuff = SelectedSkills[x];

                    if (buttonStuff.b.Intersects(currentMouseState.X, currentMouseState.Y) && buttonStuff.s != null)
                    {
                        //already have a selected thing;
                        if (selectedSkillSwapButton.b != null)
                        {
                            selectedSkillSwapButton.b.selected = false;
                        }
                        flag = true;
                        selectedSkillSwapButton            = buttonStuff;
                        selectedSkillSwapButton.b.selected = true;
                        //Console.WriteLine("selected " + buttonStuff.s.name);
                    }
                }
                if (flag == false)
                {
                    if (selectedSkillSwapButton.b != null)
                    {
                        selectedSkillSwapButton.b.selected = false;
                    }
                    selectedSkillSwapButton = new ButtonSkill();;
                }
            }

            measurements = hovertext.getMeasurements(hovertextRect.Width - 15);
            if (xpos + hovertextRect.Width > LeaveMeAlone.WindowX - 20)
            {
                hovertextRect.X = LeaveMeAlone.WindowX - hovertextRect.Width - 20;
            }
            else
            {
                hovertextRect.X = currentMouseState.X + 10;
            }
            if (ypos + measurements.Y > LeaveMeAlone.WindowY - 20)
            {
                hovertextRect.Y = LeaveMeAlone.WindowY - (int)measurements.Y - 20;
            }
            else
            {
                hovertextRect.Y = currentMouseState.Y + 10;
            }
            return(LeaveMeAlone.GameState.Upgrade);
        }