Example #1
0
        public void CheckInteractables()
        {
            var interRect = new Rectangle((int)this.mPlayerSprite.Position.X - 20,
                (int)this.mPlayerSprite.Position.Y - 20,
                68, 84);
            foreach (var sprite in this.Interactables)
            {
                if (interRect.Intersects(sprite.collisionRectangle) && !sprite.BeenInteractedWith)
                {
                    lootList.Clear();
                    sprite.BeenInteractedWith = true;
                    this.IsGuideVisible = true;
                    currentInteractionType = sprite.InteractionType;
                    currentInteractionSprite = sprite;

                    if (sprite.InteractionType != InteractionType.Entrance)
                    {
                        if (sprite.InteractionType == InteractionType.Chest)
                        {
                            openChestSoundEffect.Play(0.4f, 0.0f, 0.0f);
                            this.currentTreasure =
                                this.MGame.Engine.Loot.TreasureChests.FirstOrDefault(
                                    x =>
                                        x.Location.X == sprite.collisionRectangle.X &&
                                        x.Location.Y == sprite.collisionRectangle.Y);
                        }
                        else if (sprite.InteractionType == InteractionType.Loot)
                        {
                            this.currentTreasure = this.MGame.Engine.Loot.Treasure;
                        }

                        if (this.currentTreasure != null)
                        {
                            sprite.Treasure = this.currentTreasure;
                            messageText = "You found loot! Choose what to take.";
                            lootButton1.SetPosition(new Vector2((int)Camera.Position.X + 550,
                                (int)Camera.Position.Y + 130));
                            lootButton2.SetPosition(new Vector2((int)Camera.Position.X + 550,
                                (int)Camera.Position.Y + 165));
                            lootButton3.SetPosition(new Vector2((int)Camera.Position.X + 550,
                                (int)Camera.Position.Y + 200));
                            lootButton4.SetPosition(new Vector2((int)Camera.Position.X + 550,
                                (int)Camera.Position.Y + 235));
                            lootButton5.SetPosition(new Vector2((int)Camera.Position.X + 550,
                                (int)Camera.Position.Y + 270));
                            throwButton.SetPosition(new Vector2((int)Camera.Position.X + 370,
                                (int)Camera.Position.Y + 340));
                            cancelButton.SetPosition(new Vector2((int)Camera.Position.X + 470,
                                (int)Camera.Position.Y + 340));
                            DrawLootList(sprite);
                        }
                    }
                    else
                    {
                        if (isBossDead)
                        {
                            messageText = string.Format("Do you want to leave this place \nand enter {0}?",
                                sprite.Name);
                        }
                        else
                        {
                            messageText = "You cannot leave this place \nuntil the youkai is alive!";
                        }
                        enterButton.SetPosition(new Vector2((int)Camera.Position.X + 370,
                            (int)Camera.Position.Y + 340));
                        cancelButton.SetPosition(new Vector2((int)Camera.Position.X + 470,
                            (int)Camera.Position.Y + 340));
                    }
                }
            }
        }
Example #2
0
        public override void Update(GameTime gameTime)
        {
            if (this.MGame.GameStateScreen == GameState.GameScreenState)
            {
                if (IsGuideVisible)
                {
                    currentKeyboardState = Keyboard.GetState();
                    mouse = Mouse.GetState();

                    if (currentInteractionType != InteractionType.Entrance)
                    {
                        if (CheckKey(Keys.Enter))
                        {
                            if (currentInteractionSprite.Treasure.Items.Count > 0)
                            {
                                currentInteractionSprite.BeenInteractedWith = false;
                            }
                            else
                            {
                                currentInteractionSprite.BeenInteractedWith = true;
                                if (currentInteractionSprite.InteractionType == InteractionType.Loot)
                                {
                                    this.Interactables.Remove(currentInteractionSprite);
                                }
                                currentInteractionSprite = null;
                            }
                            IsGuideVisible = false;
                        }
                        throwButton.Update(currentKeyboardState, mouse, (int)this.Camera.Position.X,
                            (int)this.Camera.Position.Y);
                        cancelButton.Update(currentKeyboardState, mouse, (int)this.Camera.Position.X,
                            (int)this.Camera.Position.Y);
                        if (throwButton.IsClicked)
                        {
                            if (CheckMouse())
                            {
                                if (currentInteractionSprite != null)
                                {
                                    currentInteractionSprite.Treasure.Items.Clear();
                                    DrawLootList(currentInteractionSprite);
                                }
                            }
                        }

                        if (cancelButton.IsClicked)
                        {
                            if (CheckMouse())
                            {
                                if (currentInteractionSprite != null &&
                                    currentInteractionSprite.Treasure.Items.Count > 0)
                                {
                                    currentInteractionSprite.BeenInteractedWith = false;
                                }
                                else
                                {
                                    if (currentInteractionSprite != null)
                                    {
                                        currentInteractionSprite.BeenInteractedWith = true;
                                        if (currentInteractionSprite.InteractionType == InteractionType.Loot)
                                        {
                                            this.Interactables.Remove(currentInteractionSprite);
                                        }
                                    }
                                    currentInteractionSprite = null;
                                }
                                IsGuideVisible = false;
                            }
                        }

                        if (lootList.Count >= 1)
                        {
                            lootButton1.Update(currentKeyboardState, mouse, (int)this.Camera.Position.X,
                                (int)this.Camera.Position.Y);
                            if (lootButton1.IsClicked)
                            {
                                if (CheckMouse())
                                    UpdateLootList(0);
                            }
                            if (lootList.Count >= 2)
                            {
                                lootButton2.Update(currentKeyboardState, mouse, (int)this.Camera.Position.X,
                                    (int)this.Camera.Position.Y);
                                if (lootButton2.IsClicked)
                                {
                                    if (CheckMouse())
                                        UpdateLootList(1);
                                }
                                if (lootList.Count >= 3)
                                {
                                    lootButton3.Update(currentKeyboardState, mouse, (int)this.Camera.Position.X,
                                        (int)this.Camera.Position.Y);
                                    if (lootButton3.IsClicked)
                                    {
                                        if (CheckMouse())
                                            UpdateLootList(2);
                                    }
                                    if (lootList.Count >= 4)
                                    {
                                        lootButton4.Update(currentKeyboardState, mouse, (int)this.Camera.Position.X,
                                            (int)this.Camera.Position.Y);
                                        if (lootButton4.IsClicked)
                                        {
                                            if (CheckMouse())
                                                UpdateLootList(3);
                                        }
                                        if (lootList.Count == 5)
                                        {
                                            lootButton5.Update(currentKeyboardState, mouse, (int)this.Camera.Position.X,
                                                (int)this.Camera.Position.Y);
                                            if (lootButton5.IsClicked)
                                            {
                                                if (CheckMouse())
                                                    UpdateLootList(4);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (isBossDead)
                        {
                            enterButton.Update(currentKeyboardState, mouse, (int)this.Camera.Position.X,
                                (int)this.Camera.Position.Y);
                            if (enterButton.IsClicked)
                            {
                                if (CheckMouse())
                                {
                                    StartNextLevel(LevelNumber + 1);
                                }
                                IsGuideVisible = false;
                            }
                        }
                        cancelButton.Update(currentKeyboardState, mouse, (int)this.Camera.Position.X,
                            (int)this.Camera.Position.Y);
                        if (cancelButton.IsClicked)
                        {
                            if (CheckMouse())
                            {

                                if (currentInteractionSprite != null)
                                    currentInteractionSprite.BeenInteractedWith = false;
                                IsGuideVisible = false;
                            }
                        }
                    }
                    this.lastKeyboardState = this.currentKeyboardState;
                    this.lastMouseState = this.mouse;
                }
                else
                {
                    if (!Paused)
                    {
                        currentKeyboardState = Keyboard.GetState();
                        if (Keyboard.GetState().IsKeyDown(Keys.Escape))
                        {
                            Paused = true;
                            MGame.GameStateScreen = GameState.PauseScreenState;
                        }

                        if (CheckKey(Keys.M))
                        {
                            if (playBGM)
                            {
                                playBGM = false;
                                bgmInstance.Pause();
                            }
                            else
                            {
                                playBGM = true;
                                bgmInstance.Resume();
                            }
                        }

                        //define current position of the player for the camera to follow
                        Camera.Update(gameTime, mPlayerSprite, this);

                        this.fireballSprite.Update(gameTime);
                        this.enemySpellSprite.Update(gameTime);
                        this.equalizerSprite.Update(gameTime);
                        this.protectingShadowSprite.Position = new Vector2(mPlayerSprite.Position.X,
                            mPlayerSprite.Position.Y);
                        this.protectingShadowSprite.Update(gameTime);

                        //if hero is alive
                        if (this.MGame.Engine.Hero.Health > 0)
                        {
                            mPlayerSprite.Update(mPlayerSprite.previousPosition, gameTime, this);
                            if (CheckKey(Keys.I))
                            {
                                Paused = true;
                                MGame.InventoryScreen.CalledWithFastButton = true;
                                MGame.GameStateScreen = GameState.InventoryScreenState;
                            }

                            if (CheckKey(Keys.R))
                            {
                                StartNextLevel(this.LevelNumber + 1);
                            }

                            #region Enemy Attacks Hero

                            foreach (var enemySprite in enemySprites)
                            {
                                if (enemySprite.Enemy.Health > 0)
                                {
                                    enemySprite.CheckOnTargets(mPlayerSprite);
                                    enemySprite.Update(gameTime, this);
                                    //hit player
                                    bool heroIsHit = false;
                                    int prevHeroHealth = this.MGame.Engine.Hero.Health;
                                    if (enemySprite.AttackingPlayer)
                                    {
                                        enemySprite.Enemy.Hit(this.MGame.Engine.Hero);
                                        if (enemySprite.Enemy.GetType().Name == "NpcMage")
                                        {
                                            this.enemySpellSprite.StartTimer(1000);
                                            this.enemySpellSprite.Position =
                                                new Vector2(mPlayerSprite.Position.X, mPlayerSprite.Position.Y + 10);
                                        }
                                        EnemySprite sprite = enemySprite;
                                        if (this.MGame.Engine.Hero.Health != prevHeroHealth)
                                        {
                                            heroIsHit = true;
                                        }
                                        if (this.MGame.Engine.Hero.Health > 0 && heroIsHit)
                                        {
                                            AddToGameLog(string.Format("{0} hit {1} for {2} damage!",
                                                sprite.Enemy.Name, this.MGame.Engine.Hero.Name,
                                                this.MGame.Engine.Hero.DamageGotten));
                                        }
                                    }
                                }
                            }

                            #endregion

                            if (CheckKey(Keys.E))
                            {
                                CheckInteractables();
                            }

                            #region Hero Attacks Enemy

                            if (this.CheckKey(Keys.D1))
                            {
                                weaponHitSoundEffect.Play(0.4f, 0.0f, 0.0f);
                                EnemySprite enemyInVicinity = this.FindEnemy(this.mPlayerSprite.Hero.HitRange);

                                if (enemyInVicinity != null)
                                {
                                    //hit player
                                    bool enemyIsHit = false;
                                    int prevEnemyHealth = enemyInVicinity.Enemy.Health;
                                    this.MGame.Engine.Hero.Hit(enemyInVicinity.Enemy);
                                    if (enemyInVicinity.Enemy.Health != prevEnemyHealth)
                                    {
                                        enemyIsHit = true;
                                    }
                                    if (enemyInVicinity.Enemy.Health > 0 && enemyIsHit)
                                    {
                                        this.AddToGameLog(string.Format("{0} hit {1} for {2} damage!",
                                            this.MGame.Engine.Hero.Name, enemyInVicinity.Enemy.Name,
                                            enemyInVicinity.Enemy.DamageGotten));
                                    }
                                    if (enemyInVicinity.Enemy.Health <= 0)
                                    {
                                        if (enemyInVicinity.IsBoss)
                                        {
                                            this.mPlayerSprite.Hero.CheckLevelUp(5);
                                            isBossDead = true;
                                        }
                                        else
                                        {
                                            this.mPlayerSprite.Hero.CheckLevelUp(1);
                                        }
                                        DropLoot(enemyInVicinity);
                                        this.AddToGameLog(string.Format("{0} is dead!", enemyInVicinity.Enemy.Name));
                                    }
                                }
                            }
                            if (this.CheckKey(Keys.D2))
                            {
                                if (this.mPlayerSprite.Hero is Monk)
                                {
                                    var monk = (Monk)this.mPlayerSprite.Hero;
                                    EnemySprite enemyInVicinity = this.FindEnemy(monk.FireballCastRange);

                                    if (enemyInVicinity != null && monk.FireballIsReady)
                                    {
                                        if (monk.FireballIsReady && monk.CastFireball(enemyInVicinity.Enemy))
                                        {
                                            fireballSoundEffect.Play(0.4f, 0.0f, 0.0f);
                                            this.fireballSprite.StartTimer(1000);
                                            this.fireballSprite.Position =
                                                new Vector2(enemyInVicinity.Position.X, enemyInVicinity.Position.Y + 10);
                                            this.AddToGameLog(
                                                string.Format("{0} cast FIREBALL and hit {1} for {2} damage!",
                                                    monk.Name, enemyInVicinity.Enemy.Name,
                                                    enemyInVicinity.Enemy.DamageGotten));
                                        }

                                        if (enemyInVicinity.Enemy.Health <= 0)
                                        {
                                            if (enemyInVicinity.IsBoss)
                                            {
                                                this.mPlayerSprite.Hero.CheckLevelUp(5);
                                                isBossDead = true;
                                            }
                                            else
                                            {
                                                this.mPlayerSprite.Hero.CheckLevelUp(1);
                                            }
                                            DropLoot(enemyInVicinity);
                                            this.AddToGameLog(string.Format("{0} is dead!", enemyInVicinity.Enemy.Name));
                                        }
                                    }

                                }
                                if (this.mPlayerSprite.Hero is Samurai)
                                {
                                    var samurai = (Samurai)this.mPlayerSprite.Hero;
                                    EnemySprite enemyInVicinity = this.FindEnemy(samurai.MagicHitCastRange);

                                    weaponHitSoundEffect.Play(0.4f, 0.0f, 0.0f);

                                    if (enemyInVicinity != null)
                                    {
                                        if (samurai.EqualizerIsReady && samurai.CastŠ•qualizer(enemyInVicinity.Enemy))
                                        {
                                            this.equalizerSprite.StartTimer(1000);
                                            this.equalizerSprite.Position =
                                                new Vector2(enemyInVicinity.Position.X, enemyInVicinity.Position.Y + 10);
                                            this.AddToGameLog(
                                                string.Format("{0} used EQUALIZER and hit {1} for {2} damage!",
                                                    samurai.Name, enemyInVicinity.Enemy.Name,
                                                    enemyInVicinity.Enemy.DamageGotten));
                                        }
                                        if (enemyInVicinity.Enemy.Health <= 0)
                                        {
                                            if (enemyInVicinity.IsBoss)
                                            {
                                                this.mPlayerSprite.Hero.CheckLevelUp(5);
                                                isBossDead = true;
                                            }
                                            else
                                            {
                                                this.mPlayerSprite.Hero.CheckLevelUp(1);
                                            }
                                            DropLoot(enemyInVicinity);
                                            this.AddToGameLog(string.Format("{0} is dead!", enemyInVicinity.Enemy.Name));
                                        }
                                    }
                                }

                                if (this.mPlayerSprite.Hero is Ninja)
                                {
                                    var ninja = (Ninja)this.mPlayerSprite.Hero;

                                    if (this.protectingShadowSprite.IsOver && ninja.ProtectedOfDamageIsReady &&
                                        ninja.CastProtectedOfDamage())
                                    {
                                        this.protectingShadowSprite.StartTimer(5000);
                                        // this.protectingShadowSprite.Position =
                                        //     new Vector2(enemyInVicinity.Position.X, enemyInVicinity.Position.Y + 10);
                                        this.AddToGameLog(string.Format("{0} used PROTECTING SHADOW!",
                                            ninja.Name));
                                    }

                                }
                            }

                            #endregion
                        }
                        else
                        {
                            if (heroDeathMessage)
                            {
                                currentLog3 = currentLog2;
                                currentLog2 = currentLog1;
                                currentLog1 = string.Format("{0} died!", this.MGame.Engine.Hero.Name);
                                heroDeathMessage = false;
                            }
                            this.deathTimer.Elapsed += new ElapsedEventHandler(DeathTimerElapsed);
                            this.deathTimer.Enabled = true; // Enable timer
                        }

                        this.lastKeyboardState = this.currentKeyboardState;
                        this.lastMouseState = this.mouse;
                    }
                }
            }
        }
Example #3
0
 private void DropLoot(EnemySprite deadEnemy)
 {
     var deadEnemyLocation = new Location(deadEnemy.Position.X, deadEnemy.Position.Y);
     this.MGame.Engine.Loot.GenerateTreasureBag(deadEnemyLocation);
     if (MGame.Engine.Loot.HasLoot)
     {
         var lootSprite = new InteractionSprite(lootTexture, InteractionType.Loot);
         lootSprite.Position = new Vector2(deadEnemy.Position.X, deadEnemy.Position.Y);
         lootSprite.Treasure = MGame.Engine.Loot.Treasure;//.TreasureBags.ToArray()[droppedLoot];
         Interactables.Add(lootSprite);
         lootSprite.collisionRectangle = new Rectangle((int)lootSprite.Position.X, (int)lootSprite.Position.Y,
             lootTexture.Width / 2, lootTexture.Height);
         environmentSprites.Add(lootSprite);
         //droppedLoot += 1;
     }
 }
Example #4
0
        private void DrawLootList(InteractionSprite sprite)
        {
            lootList.Clear();
            for (int i = 0; i < sprite.Treasure.Items.Count; i++)
            {
                var t = sprite.Treasure.Items[i];

                if (t is IWeapon)
                {
                    var temp = (Weapon)t;
                    lootList.Add(String.Format("{0} \"{1}\": damage {2}",
                        temp.GetType().Name, temp.Name, temp.AttackPoints));
                }
                if (t is IArmor)
                {
                    var temp = (Armor)t;
                    lootList.Add(String.Format("{0} \"{1}\": defence {2}",
                        temp.GetType().Name, temp.Name, temp.DefensePoints));
                }
                if (t is HealingPotion)
                {
                    var temp = (HealingPotion)t;
                    lootList.Add(String.Format("{0} \"{1}\": healing points {2}",
                        temp.GetType().Name, temp.Name, temp.HealingPoints));
                }

                if (t is ManaPotion)
                {
                    var temp = (ManaPotion)t;
                    lootList.Add(String.Format("{0} \"{1}\": mana points {2}",
                        temp.GetType().Name, temp.Name, temp.ManaPoints));
                }
            }
        }
Example #5
0
        public void LoadEnvironmentLevelOne(GamePlayScreen gamePlayScreen, MainGame mGame)
        {
            var castleTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/Castle");
            var forestTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/forest01");
            var bigForestTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/forest_02_big");
            var vertForestTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/forest_03_vert");
            var smallForestTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/forest04_small");
            var longForestTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/forest_05_long");

            var houseTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/old_house");
            var horWallTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/horisontal_wall");
            var verWallShortTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/vertical_wall_short");
            var verWallTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/vertical_wall");
            var treasureChestTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/TreasureChest");
            var hauntedHouseTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/dilapidated_house");

            var castle01 = new StillSprite(castleTexture);
            var forest01 = new StillSprite(forestTexture);
            var forest02 = new StillSprite(forestTexture);
            var forest03 = new StillSprite(forestTexture);
            var forest04 = new StillSprite(forestTexture);
            var forest05 = new StillSprite(forestTexture);
            var forest06 = new StillSprite(forestTexture);
            var bigForest01 = new StillSprite(bigForestTexture);
            var bigForest02 = new StillSprite(bigForestTexture);
            var bigForest03 = new StillSprite(bigForestTexture);
            var bigForest04 = new StillSprite(bigForestTexture);
            var vertForest01 = new StillSprite(vertForestTexture);
            var vertForest02 = new StillSprite(vertForestTexture);
            var vertForest03 = new StillSprite(vertForestTexture);
            var vertForest04 = new StillSprite(vertForestTexture);
            var vertForest05 = new StillSprite(vertForestTexture);
            var vertForest06 = new StillSprite(vertForestTexture);
            var vertForest07 = new StillSprite(vertForestTexture);
            var vertForest08 = new StillSprite(vertForestTexture);
            var smallForest01 = new StillSprite(smallForestTexture);
            var smallForest02 = new StillSprite(smallForestTexture);
            var smallForest03 = new StillSprite(smallForestTexture);
            var smallForest04 = new StillSprite(smallForestTexture);
            var longForest01 = new StillSprite(longForestTexture);
            var oldHouse01 = new StillSprite(houseTexture);
            var oldHouse02 = new StillSprite(houseTexture);
            var oldHouse03 = new StillSprite(houseTexture);
            var horisontalWall01 = new StillSprite(horWallTexture);
            var horisontalWall02 = new StillSprite(horWallTexture);
            var verticalWall01 = new StillSprite(verWallTexture);
            var verticalWallShort01 = new StillSprite(verWallShortTexture);
            var verticalWallShort02 = new StillSprite(verWallShortTexture);

            castle01.Position = new Vector2(50, 50);
            oldHouse01.Position = new Vector2(60, 320);
            oldHouse02.Position = new Vector2(60, 500);
            oldHouse03.Position = new Vector2(260, 50);
            horisontalWall01.Position = new Vector2(0, 0);
            horisontalWall02.Position = new Vector2(0, 850);
            verticalWall01.Position = new Vector2(0, 50);
            verticalWallShort01.Position = new Vector2(550, 50);
            verticalWallShort02.Position = new Vector2(550, 500);

            forest01.Position = new Vector2(600, 0);
            bigForest01.Position = new Vector2(600, 500);
            vertForest01.Position = new Vector2(1400, 0);
            forest02.Position = new Vector2(1600, 600);
            forest03.Position = new Vector2(1600, 1000);
            forest04.Position = new Vector2(600, 1600);
            smallForest01.Position = new Vector2(1800, 1200);
            smallForest03.Position = new Vector2(800, 1100);
            smallForest04.Position = new Vector2(800, 1300);
            vertForest02.Position = new Vector2(1400, 1000);
            vertForest03.Position = new Vector2(2600, 0);
            vertForest04.Position = new Vector2(2600, 800);
            forest05.Position = new Vector2(1600, 1600);
            forest06.Position = new Vector2(1400, 2000);
            bigForest02.Position = new Vector2(0, 1200);
            bigForest03.Position = new Vector2(1800, 200);
            longForest01.Position = new Vector2(0, 2000);
            bigForest04.Position = new Vector2(2600, 1800);
            vertForest05.Position = new Vector2(3000, 1000);
            vertForest06.Position = new Vector2(3000, 200);
            smallForest02.Position = new Vector2(3200, 200);
            vertForest07.Position = new Vector2(3400, 600);
            vertForest08.Position = new Vector2(3400, 1400);

            //treasure chest
            InteractionSprite treasureChest01 = new InteractionSprite(treasureChestTexture, InteractionType.Chest);
            treasureChest01.Position = new Vector2(1270, 30);
            treasureChest01.SetCollisionRectangle();
            InteractionSprite hauntedHouseSprite = new InteractionSprite(hauntedHouseTexture, InteractionType.Entrance, "Haunted house");
            hauntedHouseSprite.Position = new Vector2(0, 2200);
            hauntedHouseSprite.SetCollisionRectangle();
            gamePlayScreen.Interactables = new List<InteractionSprite>()
            {
                treasureChest01,
                hauntedHouseSprite
            };

            foreach (var sprite in gamePlayScreen.Interactables)
            {
                if (sprite.InteractionType == InteractionType.Chest)
                {
                    sprite.Treasure = mGame.Engine.Loot.Treasure;
                }
            }

            gamePlayScreen.environmentSprites = new List<Sprite>
            {
                castle01,
                forest01,
                oldHouse01,
                oldHouse02,
                oldHouse03,
                horisontalWall01,
                horisontalWall02,
                verticalWall01,
                verticalWallShort01,
                verticalWallShort02,
                bigForest01,
                vertForest01,
                forest02,
                vertForest02,
                bigForest02,
                bigForest03,
                vertForest03,
                forest03,
                vertForest04,
                forest04,
                longForest01,
                smallForest01,
                forest05,
                forest06,
                bigForest04,
                vertForest05,
                vertForest06,
                smallForest02,
                vertForest07,
                vertForest08,
                smallForest03,
                smallForest04,

                hauntedHouseSprite
               };
            gamePlayScreen.Interactables.Clear();
            LoadTreasureChests(gamePlayScreen, mGame, treasureChestTexture);
            gamePlayScreen.Interactables.Add(hauntedHouseSprite);
        }
Example #6
0
 private static void LoadTreasureChests(GamePlayScreen gamePlayScreen, MainGame mGame, Texture2D treasureChestTexture)
 {
     foreach (var chest in mGame.Engine.Loot.TreasureChests)
     {
         var treasure = new InteractionSprite(treasureChestTexture, InteractionType.Chest);
         treasure.Position = new Vector2((float)chest.Location.X, (float)chest.Location.Y);
         treasure.SetCollisionRectangle();
         gamePlayScreen.Interactables.Add(treasure);
         gamePlayScreen.environmentSprites.Add(treasure);
     }
 }
Example #7
0
        public void LoadEnvironmentLevelTwo(GamePlayScreen gamePlayScreen, MainGame mGame)
        {
            var shortWallTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/wooden_wall_400");
            var shortWallVertTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/wooden_wall_400_vert");
            var longWallTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/wooden_wall_1600");
            var avgWallTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/wooden_wall_800");
            var avgWallVertTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/wooden_wall_800_vert");
            var vertSurroundingTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/wooden_wall_2000_vert");
            var horSurroundingTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/wooden_wall_2000_hor");
            var vertWall150 = mGame.Content.Load<Texture2D>("Sprites/Environment/wooden_wall_150_vert");
            var horWall150 = mGame.Content.Load<Texture2D>("Sprites/Environment/wooden_wall_150_hor");
            var rubbleTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/rubble");
            var lampTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/wall_lamp");
            var smallForestTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/forest04_small");
            var oldWellTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/stone_well");
            var treasureChestTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/TreasureChest");
            var caveTexture = mGame.Content.Load<Texture2D>("Sprites/Environment/cave_entrance");
            //inner yard surrounding
            var longWall01 = new StillSprite(longWallTexture);
            var longWall02 = new StillSprite(longWallTexture);
            var avgWallVert01 = new StillSprite(avgWallVertTexture);
            var avgWallVert02 = new StillSprite(avgWallVertTexture);
            var shortWall01 = new StillSprite(shortWallTexture);
            var avgWall01 = new StillSprite(avgWallTexture);

            longWall01.Position = new Vector2(200, 1000);
            longWall02.Position = new Vector2(200, 1130);
            avgWallVert01.Position = new Vector2(200, 230);
            avgWallVert02.Position = new Vector2(1800, 230);
            shortWall01.Position = new Vector2(1430, 200);
            avgWall01.Position = new Vector2(200, 200);

            //surrounding walls
            var vertSurroundingSprite01 = new StillSprite(vertSurroundingTexture);
            var vertSurroundingSprite02 = new StillSprite(vertSurroundingTexture);
            var horSurroundingSprite01 = new StillSprite(horSurroundingTexture);
            var horSurroundingSprite02 = new StillSprite(horSurroundingTexture);

            //vertical wall 150p
            var vertWallSmallSprite01 = new StillSprite(vertWall150);
            var vertWallSmallSprite02 = new StillSprite(vertWall150);
            //horisonatal wall 150

            //vertical wall 400p
            var shortVertWallSprite01 = new StillSprite(shortWallVertTexture);
            var shortVertWallSprite02 = new StillSprite(shortWallVertTexture);
            var smallWallSprite01 = new StillSprite(horWall150);
            var smallWallSprite02 = new StillSprite(horWall150);
            var smallVertWallSprite03 = new StillSprite(vertWall150);
            var smallVertWallSprite04 = new StillSprite(vertWall150);
            var shortWallSprite02 = new StillSprite(shortWallTexture);
            var avgWallSprite02 = new StillSprite(avgWallTexture);
            var shortVertWallSprite03 = new StillSprite(shortWallVertTexture);
            var shortVertWallSprite04 = new StillSprite(shortWallVertTexture);
            var smallWallSprite03 = new StillSprite(horWall150);
            var smallWallSprite04 = new StillSprite(horWall150);
            var smallVertWallSprite05 = new StillSprite(vertWall150);
            var smallVertWallSprite06 = new StillSprite(vertWall150);
            var smallVertWallSprite07 = new StillSprite(vertWall150);
            var smallVertWallSprite08 = new StillSprite(vertWall150);
            var shortWallSprite03 = new StillSprite(shortWallTexture);
            var rubble01 = new StillSprite(rubbleTexture);
            var rubble02 = new StillSprite(rubbleTexture);
            var rubble03 = new StillSprite(rubbleTexture);
            var rubble04 = new StillSprite(rubbleTexture);
            var rubble05 = new StillSprite(rubbleTexture);
            var rubble06 = new StillSprite(rubbleTexture);
            var rubble07 = new StillSprite(rubbleTexture);
            var rubble08 = new StillSprite(rubbleTexture);
            var rubble09 = new StillSprite(rubbleTexture);
            var rubble10 = new StillSprite(rubbleTexture);
            var wallLamp01 = new StillSprite(lampTexture);
            var wallLamp02 = new StillSprite(lampTexture);
            var wallLamp03 = new StillSprite(lampTexture);
            var wallLamp04 = new StillSprite(lampTexture);
            var wallLamp05 = new StillSprite(lampTexture);
            var wallLamp06 = new StillSprite(lampTexture);
            var wallLamp07 = new StillSprite(lampTexture);
            var wallLamp08 = new StillSprite(lampTexture);
            var smallForest01 = new StillSprite(smallForestTexture);
            var smallForest02 = new StillSprite(smallForestTexture);
            var smallForest03 = new StillSprite(smallForestTexture);

            vertWallSmallSprite01.Position = new Vector2(200, 1130);
            vertWallSmallSprite02.Position = new Vector2(200, 1380);
            shortVertWallSprite01.Position = new Vector2(200, 1480);
            shortVertWallSprite02.Position = new Vector2(630, 1130);
            smallWallSprite01.Position = new Vector2(230, 1500);
            smallWallSprite02.Position = new Vector2(480, 1500);
            smallVertWallSprite03.Position = new Vector2(630, 1470);
            smallVertWallSprite04.Position = new Vector2(630, 1730);
            shortWallSprite02.Position = new Vector2(230, 1850);
            avgWallSprite02.Position = new Vector2(630, 1850);
            shortVertWallSprite03.Position = new Vector2(1800, 1130);
            shortVertWallSprite04.Position = new Vector2(1800, 1480);
            smallWallSprite03.Position = new Vector2(1400, 1850);
            smallWallSprite04.Position = new Vector2(1650, 1850);
            smallVertWallSprite05.Position = new Vector2(1400, 1130);
            smallVertWallSprite06.Position = new Vector2(1400, 1380);
            smallVertWallSprite07.Position = new Vector2(1400, 1480);
            smallVertWallSprite08.Position = new Vector2(1400, 1730);
            shortWallSprite03.Position = new Vector2(1430, 1500);

            vertSurroundingSprite01.Position = new Vector2(0, 0);
            vertSurroundingSprite02.Position = new Vector2(1970, 0);
            horSurroundingSprite01.Position = new Vector2(0, 0);
            horSurroundingSprite02.Position = new Vector2(0, 1970);

            rubble01.Position = new Vector2(400, 30);
            rubble02.Position = new Vector2(440, 110);
            rubble03.Position = new Vector2(200, 1040);
            rubble04.Position = new Vector2(100, 920);
            rubble05.Position = new Vector2(1400, 1890);
            rubble06.Position = new Vector2(230, 1160);
            rubble07.Position = new Vector2(530, 1530);
            rubble08.Position = new Vector2(660, 1160);
            rubble09.Position = new Vector2(660, 1240);
            rubble10.Position = new Vector2(1420, 230);
            wallLamp01.Position = new Vector2(30, 1800);
            wallLamp02.Position = new Vector2(30, 1600);
            wallLamp03.Position = new Vector2(30, 1400);
            wallLamp04.Position = new Vector2(30, 1200);
            wallLamp05.Position = new Vector2(1830, 1800);
            wallLamp06.Position = new Vector2(1830, 1600);
            wallLamp07.Position = new Vector2(1830, 1400);
            wallLamp08.Position = new Vector2(1830, 1200);
            smallForest01.Position = new Vector2(1420, 420);
            smallForest02.Position = new Vector2(1470, 620);
            smallForest03.Position = new Vector2(800, 230);

            InteractionSprite oldWellSprite01 = new InteractionSprite(oldWellTexture, InteractionType.Well);
            oldWellSprite01.Position = new Vector2(600, 600);
            InteractionSprite oldWellSprite02 = new InteractionSprite(oldWellTexture, InteractionType.Well);
            oldWellSprite02.Position = new Vector2(1600, 850);
            InteractionSprite caveSprite = new InteractionSprite(caveTexture, InteractionType.Entrance);
            caveSprite.Position = new Vector2(230, 850);
            gamePlayScreen.Interactables = new List<InteractionSprite>
            {
                caveSprite
            };

            gamePlayScreen.environmentSprites = new List<Sprite>
            {
                vertSurroundingSprite01,
                vertSurroundingSprite02,
                horSurroundingSprite01,
                horSurroundingSprite02,
                shortWall01,
                avgWall01,
                longWall01,
                longWall02,
                avgWallVert01,
                avgWallVert02,
                vertWallSmallSprite01,
                vertWallSmallSprite02,
                shortVertWallSprite01,
                shortVertWallSprite02,
                smallWallSprite01,
                smallWallSprite02,
                smallVertWallSprite03,
                smallVertWallSprite04,
                shortWallSprite02,
                avgWallSprite02,
                shortVertWallSprite03,
                shortVertWallSprite04,
                smallWallSprite03,
                smallWallSprite04,
                smallVertWallSprite05,
                smallVertWallSprite06,
                smallVertWallSprite07,
                smallVertWallSprite08,
                shortWallSprite03,
                rubble01,
                rubble02,
                rubble03,
                rubble04,
                rubble05,
                rubble06,
                rubble07,
                rubble08,
                rubble09,
                rubble10,
                oldWellSprite01,
                oldWellSprite02,
                wallLamp01,
                wallLamp02,
                wallLamp03,
                wallLamp04,
                wallLamp05,
                wallLamp06,
                wallLamp07,
                wallLamp08,
                smallForest01,
                smallForest02,
                smallForest03,
                caveSprite
               };

            LoadTreasureChests(gamePlayScreen, mGame, treasureChestTexture);
        }