Beispiel #1
0
        public LevelUpScreen(Game game, SpriteBatch spriteBatch, SpriteFont spriteFont, Texture2D image, playerComponent PlayerData)
            : base(game, spriteBatch)
        {
            Player          = PlayerData;
            this.spriteFont = spriteFont;
            this.image      = image;
            imageRectangle  = new Rectangle(
                00,
                00,
                Game.Window.ClientBounds.Width,
                Game.Window.ClientBounds.Height);
            LevelsGained = Player.LevelGain;
            Points       = Player.LevelGain * 2;
            if (Class == "Warrior")
            {
                Player.Strength += LevelsGained;
            }
            else if (Class == "Knight")
            {
                Player.Defence += LevelsGained;
            }
            else
            {
                Player.Wisdom += LevelsGained;
            }

            if (Race == "Orc")
            {
                Player.Strength += LevelsGained;
            }
            else if (Race == "Human")
            {
                Player.Defence += LevelsGained;
            }
            else
            {
                Player.Wisdom += LevelsGained;
            }

            Player.Mana[0]   = Player.Mana[1];
            Player.Health[0] = Player.Health[1];
        }
Beispiel #2
0
 public characterCreateScreen(Game game, SpriteBatch spriteBatch, SpriteFont spriteFont, Texture2D image, Texture2D human, Texture2D elf, Texture2D orc, Texture2D sword, Texture2D shield, Texture2D staff)
     : base(game, spriteBatch)
 {
     selectedRaceSprite = human;
     Player             = new playerComponent(game);
     Components.Add(Player);
     this.human      = human;
     this.orc        = orc;
     this.elf        = elf;
     warrior         = sword;
     tank            = shield;
     mage            = staff;
     this.spriteFont = spriteFont;
     this.image      = image;
     imageRectangle  = new Rectangle(
         00,
         00,
         Game.Window.ClientBounds.Width,
         Game.Window.ClientBounds.Height);
     selectedRace     = "None";
     selectedClass    = "None";
     raceDescription  = "";
     classDescription = "";
 }
Beispiel #3
0
        //Skill Code

        public campaignScreen(Game game, SpriteBatch spriteBatch, Texture2D tiles, Texture2D sprite, GraphicsDeviceManager graphics, SpriteFont spriteFont,
                              Texture2D bg, Texture2D heads, Texture2D floathud, Texture2D txtmob, Texture2D allymob, playerComponent Player,
                              Texture2D health, Texture2D mana, Texture2D hudbg,
                              Texture2D closedChestSprite, Texture2D openChestSprite, Texture2D slot1Sprite, Texture2D slot2Sprite, Texture2D slot3Sprite, Texture2D slot4Sprite, Texture2D testItemSprtie, Texture2D redTile, Texture2D tentSprite, Texture2D elfAllySprite, Texture2D orcAllySprite, Texture2D humanAllySprite, Texture2D orcBossSprite, Texture2D humanBossSprite, Texture2D hud2, Texture2D buffIcon, Texture2D spellIcon, Texture2D healIcon, Texture2D aoeIcon, Texture2D swordIcon,
                              List <item> items, mapHolder maps)
            : base(game, spriteBatch)
        {
            //Anni Sprites
            this.elfAllySprite   = elfAllySprite;
            this.orcAllySprite   = orcAllySprite;
            this.humanAllySprite = humanAllySprite;
            this.human           = humanBossSprite;
            this.orc             = orcBossSprite;

            healthbar        = health;
            manabar          = mana;
            expbar           = health;
            this.hudbg       = hudbg;
            this.Player      = Player;
            this.hud2        = hud2;
            allySprite       = allymob;
            mobsprite        = txtmob;
            position[0]      = 10;
            position[1]      = 10;
            otherposition[0] = 14;
            otherposition[1] = 12;
            tophud           = floathud;
            hudbar           = heads;
            menubg           = bg;
            this.graphics    = graphics;
            this.spriteFont  = spriteFont;
            this.sprite      = sprite;
            // this.manaPot = manaPot;

            this.swordIcon = swordIcon;
            this.healIcon  = healIcon;
            this.buffIcon  = buffIcon;
            this.spellIcon = spellIcon;
            this.aoeIcon   = aoeIcon;

            //Item Code
            this.closedChestSprite = closedChestSprite;
            this.openChestSprite   = openChestSprite;
            itemControl            = new dropController(game, openChestSprite, closedChestSprite, spriteBatch, items);
            this.slot1Sprite       = slot1Sprite;
            this.slot2Sprite       = slot2Sprite;
            this.slot3Sprite       = slot3Sprite;
            this.slot4Sprite       = slot4Sprite;
            this.redTile           = redTile;
            this.testItemSprtie    = testItemSprtie;
            //Item Code
            map        = new MapComponent(game, tiles, graphics, spriteBatch, spriteFont, sprite, maps, RandomNumber(0, maps.total()));//Modified for map files
            collisions = new CollisionComponent(game, map.iMap, map.position);
            Components.Add(map);
            tileControl = new resourceControl(map.iMap); //Updated for tile based resources!
            Components.Add(itemControl);                 //Item Code
            Components.Add(Player);
            Components.Add(collisions);
            Texture2D allyToUse;

            if (Player.Race == "Orc")
            {
                allyToUse = orcAllySprite;
            }
            else if (Player.Race == "Elf")
            {
                allyToUse = elfAllySprite;
            }
            else
            {
                allyToUse = humanAllySprite;
            }
            allies       = new Allies(game, spriteBatch, allyToUse, Player.Level, map.iMap);
            allies.iMapX = map.iMapX;
            allies.iMapY = map.iMapY;
            Components.Add(allies);
            Texture2D mobToUse;
            Texture2D bossToUse;

            if (Player.Race == "Human")
            {
                mobToUse  = orcAllySprite;
                bossToUse = orc;
            }
            else
            {
                mobToUse  = humanAllySprite;
                bossToUse = human;
            }
            mobControl       = new EnemyControl(game, mobToUse, bossToUse, spriteBatch, Player.Level, map.iMap);
            mobControl.iMapX = map.iMapX;
            mobControl.iMapY = map.iMapY;

            Components.Add(mobControl);
            imageRectangle = new Rectangle(
                0,
                0,
                Game.Window.ClientBounds.Width,
                Game.Window.ClientBounds.Height);

            //Building Code
            this.tentSprite = tentSprite;
            buildings       = new buildingControl(game, tentSprite, spriteBatch, map.iMap);
            Components.Add(buildings);
            //Building Code
        }
Beispiel #4
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)
        {
            string test;

            test = Environment.CurrentDirectory;
            //Reader
            reader read;

            read          = new reader();
            keyboardState = Keyboard.GetState();

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }
            if (activeScreen == startScreen)
            {
                if (CheckKey(Keys.Enter))
                {
                    if (startScreen.SelectedIndex == 0)
                    {
                        activeScreen.Hide();
                        activeScreen = createcharScreen;
                        activeScreen.Show();
                    }
                    if (startScreen.SelectedIndex == 1)
                    {
                        this.Exit();
                    }
                }
            }
            else if (activeScreen == levelScreen)
            {
                if (CheckKey(Keys.Enter))
                {
                    activeScreen.Hide();
                    actionScreen = new campaignScreen(this, spriteBatch, tileset, actionScreen.sprite,
                                                      graphics, normal, generalBG, HUD, floatHUD, mob, ally, levelScreen.Player, health, mana, HUDBG, openChestSprite, closedChestSprite, slot1Sprite, slot2Sprite, slot3Sprite, slot4Sprite, testItemSprtie, redTile, tentSprite, elfAllySprite, orcAllySprite, humanAllySprite, orc, human, hud2, buffIcon, spellIcon, healIcon, aoeIcon, swordIcon,
                                                      read.itemFile(false), read.mapFile(true));
                    Components.Add(actionScreen);
                    actionScreen.Player = levelScreen.Player;
                    activeScreen        = actionScreen;
                    activeScreen.Show();
                }
            }
            else if (activeScreen == winScreen)
            {
                if (CheckKey(Keys.Enter))
                {
                    if (winScreen.SelectedIndex == 0)
                    {
                        activeScreen.Hide();
                        actionScreen = new campaignScreen(this, spriteBatch, tileset, actionScreen.sprite, graphics, normal, generalBG,
                                                          HUD, floatHUD, mob, ally, actionScreen.Player, health, mana, HUDBG,
                                                          openChestSprite, closedChestSprite, slot1Sprite, slot2Sprite, slot3Sprite, slot4Sprite, testItemSprtie, redTile, tentSprite, elfAllySprite, orcAllySprite, humanAllySprite, orc, human, hud2, buffIcon, spellIcon, healIcon, aoeIcon, swordIcon,
                                                          read.itemFile(false), read.mapFile(true));
                        Components.Add(actionScreen);
                        actionScreen.Player.Health[0] = actionScreen.Player.Health[1];
                        activeScreen = actionScreen;
                    }
                    if (winScreen.SelectedIndex == 2)
                    {
                        activeScreen.Hide();
                        levelScreen = new LevelUpScreen(this, spriteBatch, normal, generalBG, actionScreen.Player);
                        Components.Add(levelScreen);
                        activeScreen = levelScreen;
                        activeScreen.Show();
                    }

                    if (winScreen.SelectedIndex == 3)
                    {
                        activeScreen.Hide();
                        activeScreen = startScreen;
                        activeScreen.Show();
                    }
                }
            }
            else if (activeScreen == deathScreen)
            {
                if (CheckKey(Keys.Enter))
                {
                    if (deathScreen.SelectedIndex == 0)
                    {
                        activeScreen.Hide();
                        actionScreen = new campaignScreen(this, spriteBatch, tileset, actionScreen.sprite, graphics, normal, generalBG,
                                                          HUD, floatHUD, mob, ally, actionScreen.Player, health, mana, HUDBG,
                                                          openChestSprite, closedChestSprite, slot1Sprite, slot2Sprite, slot3Sprite, slot4Sprite, testItemSprtie, redTile, tentSprite, elfAllySprite, orcAllySprite, humanAllySprite, orc, human, hud2, buffIcon, spellIcon, healIcon, aoeIcon, swordIcon,
                                                          read.itemFile(false), read.mapFile(true));
                        Components.Add(actionScreen);
                        actionScreen.Player.Level     -= actionScreen.Player.LevelGain;
                        actionScreen.Player.LevelGain  = 0;
                        actionScreen.Player.Experience = 0;
                        actionScreen.Player.Health[0]  = actionScreen.Player.Health[1];

                        activeScreen = actionScreen;
                        activeScreen.Show();
                    }
                    if (deathScreen.SelectedIndex == 1)
                    {
                        activeScreen.Hide();
                        activeScreen = startScreen;
                        activeScreen.Show();
                    }
                }
            }
            else if (activeScreen == actionScreen)
            {
                int count = 0;
                if (actionScreen.Player.Health[0] <= 0)
                {
                    activeScreen.Hide();
                    activeScreen = deathScreen;
                    activeScreen.Show();
                }
                if (CheckKey(Keys.Escape))
                {
                    activeScreen.Hide();
                    activeScreen         = statScreen;
                    activeScreen.Visible = true;
                    activeScreen.Show();
                }
                foreach (MobComponent thisMob in actionScreen.mobControl.mobs)
                {
                    if (thisMob.alive)
                    {
                        count += 1;
                    }
                }
                if (count == 0)
                {
                    Player        = actionScreen.Player;
                    currentSprite = actionScreen.sprite;
                    activeScreen.Hide();
                    activeScreen = winScreen;
                    activeScreen.Show();
                }
            }

            else if (activeScreen == statScreen)
            {
                if (CheckKey(Keys.Enter))
                {
                    if (statScreen.SelectedIndex == 0)
                    {
                        activeScreen.Hide();
                        activeScreen = actionScreen;
                        activeScreen.Show();
                    }
                    else
                    {
                        activeScreen.Hide();
                        activeScreen = startScreen;
                        activeScreen.Show();
                    }
                }
            }

            else if (activeScreen == createcharScreen)
            {
                if (CheckKey(Keys.Enter))
                {
                    if ((createcharScreen.selectedClass != "None") & (createcharScreen.selectedRace != "None"))
                    {
                        activeScreen.Hide();
                        actionScreen = new campaignScreen(this, spriteBatch, tileset, createcharScreen.selectedRaceSprite, graphics, normal, generalBG,
                                                          HUD, floatHUD, mob, ally, createcharScreen.Player, health, mana, HUDBG,
                                                          openChestSprite, closedChestSprite, slot1Sprite, slot2Sprite, slot3Sprite, slot4Sprite, testItemSprtie, redTile, tentSprite, elfAllySprite, orcAllySprite, humanAllySprite, orc, human, hud2, buffIcon, spellIcon, healIcon, aoeIcon, swordIcon,
                                                          read.itemFile(false), read.mapFile(true)); Components.Add(actionScreen);
                        activeScreen = actionScreen;
                        activeScreen.Show();
                    }
                }
            }

            base.Update(gameTime);

            oldKeyboardState = keyboardState;
        }