From ba49674c3b963d1dff9caf1d8ec3f9246fd44f98 Mon Sep 17 00:00:00 2001 From: Mootfrost777 Date: Fri, 18 Aug 2023 02:13:01 +0300 Subject: [PATCH 1/2] Boss level --- DangerousD/Content/boss.tmx | 162 ++++++++++++++++++ .../GameObjects/Entities/SilasBall.cs | 2 +- .../LivingEntities/Monsters/SilasMaster.cs | 1 + .../LivingEntities/Player/Player.cs | 9 +- DangerousD/GameCore/Managers/AppManager.cs | 2 +- 5 files changed, 173 insertions(+), 3 deletions(-) create mode 100644 DangerousD/Content/boss.tmx diff --git a/DangerousD/Content/boss.tmx b/DangerousD/Content/boss.tmx new file mode 100644 index 0000000..97ea7e8 --- /dev/null +++ b/DangerousD/Content/boss.tmx @@ -0,0 +1,162 @@ + + + + + + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,799,799,799,799,799,799,799, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0 + + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +799,799,799,799,799,799,799,799,799,799,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0 + + +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,799,799,799,799,799,799,799,799 + + +0,0,0,0,0,0,0,0,0,0,0,0,0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799,799,799,799 + + +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0, +799,799,799,799,799,799,799,799,799,799,799,0,0,0,0,0 + + + + + + + + + + + + + + diff --git a/DangerousD/GameCore/GameObjects/Entities/SilasBall.cs b/DangerousD/GameCore/GameObjects/Entities/SilasBall.cs index 1c11e0e..48dd53b 100644 --- a/DangerousD/GameCore/GameObjects/Entities/SilasBall.cs +++ b/DangerousD/GameCore/GameObjects/Entities/SilasBall.cs @@ -12,7 +12,7 @@ namespace DangerousD.GameCore.GameObjects.Entities { public class SilasBall : LivingEntity { - private bool IsVisibility=true; + public bool IsVisibility=true; public SilasBall(Vector2 position) : base(position) { Height = 60; diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs index 66f9527..4b3b5cb 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs @@ -67,6 +67,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters for (int i = 0; i < balls.Count; i++) { balls[i].SetPosition(new Vector2(Pos.X + i * 40, Pos.Y + 120)); + balls[i].IsVisibility=true; } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs index 066b1d4..41a7aad 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs @@ -9,6 +9,7 @@ using DangerousD.GameCore.GameObjects.PlayerDeath; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Graphics; using DangerousD.GameCore.GameObjects.LivingEntities.Monsters; +using DangerousD.GameCore.Network; namespace DangerousD.GameCore.GameObjects.LivingEntities { @@ -27,6 +28,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities private bool isAttacked = false; private bool isShooting = false; public GameObject objectAttack; + public bool isInvincible; private int bullets; public Player(Vector2 position) : base(position) @@ -58,6 +60,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities }; } + public Player(Vector2 position, bool isInvincible) : this(position) + { + this.isInvincible = isInvincible; + } + public bool IsAlive { get { return isAlive; } } protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "playerMoveLeft", "playerMoveRight", "DeathFromZombie", "playerRightStay", "playerStayLeft", @@ -152,7 +159,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities public override void Update(GameTime gameTime) { GraphicsComponent.SetCameraPosition(Pos); - if (!isAttacked) + if (!isAttacked || isInvincible) { Move(gameTime); } diff --git a/DangerousD/GameCore/Managers/AppManager.cs b/DangerousD/GameCore/Managers/AppManager.cs index 84d6b07..661932c 100644 --- a/DangerousD/GameCore/Managers/AppManager.cs +++ b/DangerousD/GameCore/Managers/AppManager.cs @@ -202,7 +202,7 @@ namespace DangerousD.GameCore case GameState.Lobby: break; case GameState.Game: - GameManager.mapManager.LoadLevel("lvl"); + GameManager.mapManager.LoadLevel("boss"); break; case GameState.Death: break; From c9523578e4c02bbc3ea83b5873faa79a4a3a5f8d Mon Sep 17 00:00:00 2001 From: Timofey06 Date: Fri, 18 Aug 2023 02:59:53 +0300 Subject: [PATCH 2/2] SilasCommit --- .../GameObjects/Entities/SilasBall.cs | 24 ++++++++-------- .../LivingEntities/Monsters/SilasHands.cs | 4 +-- .../LivingEntities/Monsters/SilasMaster.cs | 28 +++++++++---------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/DangerousD/GameCore/GameObjects/Entities/SilasBall.cs b/DangerousD/GameCore/GameObjects/Entities/SilasBall.cs index 48dd53b..94e7ca6 100644 --- a/DangerousD/GameCore/GameObjects/Entities/SilasBall.cs +++ b/DangerousD/GameCore/GameObjects/Entities/SilasBall.cs @@ -12,20 +12,22 @@ namespace DangerousD.GameCore.GameObjects.Entities { public class SilasBall : LivingEntity { - public bool IsVisibility=true; + + private Vector2 v; public SilasBall(Vector2 position) : base(position) { - Height = 60; - Width = 60; + Height = 24; + Width = 24; acceleration = Vector2.Zero; } public SilasBall(Vector2 position, Vector2 velosity) : base(position) { - Height = 60; - Width = 60; + Height = 24; + Width = 24; acceleration = Vector2.Zero; velocity = velosity; + v = velosity; } @@ -33,17 +35,17 @@ namespace DangerousD.GameCore.GameObjects.Entities public override void Update(GameTime gameTime) { base.Update(gameTime); - if (AppManager.Instance.GameManager.physicsManager.CheckRectangle(Rectangle).Count>0) + if (AppManager.Instance.GameManager.physicsManager.CheckRectangle( new Rectangle(Rectangle.X-2,Rectangle.Y-2,Rectangle.Width+8,Rectangle.Height+8)).Count>0) { - IsVisibility = false; + AppManager.Instance.GameManager.Remove(this); } + velocity = v; } public override void Draw(SpriteBatch spriteBatch) { - if (IsVisibility) - { - base.Draw(spriteBatch); - } + + base.Draw(spriteBatch); + } } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs index e16f168..a54a59b 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs @@ -15,8 +15,8 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters public SilasHands(Vector2 position) : base(position) { name = "SilasHand"; - Width = 48; - Height = 48; + Width = 16; + Height = 16; monster_health = 2; monster_speed = 2; acceleration = Vector2.Zero; diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs index 4b3b5cb..34069af 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs @@ -24,21 +24,17 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters public SilasMaster(Vector2 position) : base(position) { name = "SilasMaster"; - Width = 144; - Height = 160; + Width = 48; + Height = 53; monster_health = 15; - monster_speed = 4; + monster_speed = 2; acceleration = Vector2.Zero; leftBorder = (int)position.X - 60; rightBorder = (int)position.X + 120; acceleration = Vector2.Zero; - hands.Add(new SilasHands(new Vector2(Pos.X+60,Pos.Y+120))); - hands.Add(new SilasHands(new Vector2(Pos.X + 90, Pos.Y + 120))); - for (int i = 0; i < 4; i++) - { - SilasBall silasball = new SilasBall(new Vector2(Pos.X + i * 40, Pos.Y + 120), new Vector2((i - 2) * 4, 6)); - balls.Add(silasball); - } + hands.Add(new SilasHands(new Vector2(Pos.X+0,Pos.Y+53))); + hands.Add(new SilasHands(new Vector2(Pos.X + 24, Pos.Y + 53))); + } protected override GraphicsComponent GraphicsComponent { get; } = new GraphicsComponent(new List() { "SilasMove", "SilasAttack" }, "SilasMove"); public override void Attack() @@ -64,13 +60,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters private void SpawnAttackBall() { - for (int i = 0; i < balls.Count; i++) + balls.Clear(); + for (int i = 0; i < 4; i++) { - balls[i].SetPosition(new Vector2(Pos.X + i * 40, Pos.Y + 120)); - balls[i].IsVisibility=true; + SilasBall silasball = new SilasBall(new Vector2(Pos.X + i * 12, Pos.Y + 53), new Vector2((i - 2) * 2, 2)); + + balls.Add(silasball); } - - + + } public void Attack(GameTime gameTime)