From 7b45a41dc1e1f376cc8c5b7a2c2214f5858cae26 Mon Sep 17 00:00:00 2001 From: Kaktus200020 Date: Fri, 18 Aug 2023 04:22:29 +0300 Subject: [PATCH] ParticlesReady --- .../Content/animations/GibsMoveLeftBottom | 1 + DangerousD/Content/animations/GibsMoveLeftTop | 1 + .../Content/animations/GibsMoveRightBottom | 1 + .../Content/animations/GibsMoveRightTop | 1 + DangerousD/Content/animations/GibsNotMove | 1 + DangerousD/Content/map.tmx | 75 +++++++++++++++++++ .../LivingEntities/Monsters/Zombie.cs | 7 ++ .../GameObjects/LivingEntities/Particle.cs | 46 ++++++++++++ 8 files changed, 133 insertions(+) create mode 100644 DangerousD/Content/animations/GibsMoveLeftBottom create mode 100644 DangerousD/Content/animations/GibsMoveLeftTop create mode 100644 DangerousD/Content/animations/GibsMoveRightBottom create mode 100644 DangerousD/Content/animations/GibsMoveRightTop create mode 100644 DangerousD/Content/animations/GibsNotMove create mode 100644 DangerousD/Content/map.tmx create mode 100644 DangerousD/GameCore/GameObjects/LivingEntities/Particle.cs diff --git a/DangerousD/Content/animations/GibsMoveLeftBottom b/DangerousD/Content/animations/GibsMoveLeftBottom new file mode 100644 index 0000000..b0f96f0 --- /dev/null +++ b/DangerousD/Content/animations/GibsMoveLeftBottom @@ -0,0 +1 @@ +{"id":"GibsMoveLeftBottom","textureName":"MonstersAnimations","startSpriteRectangle":{"X":70,"Y":724,"Width":14,"Height":11},"frameSecond":[{"Item1":0,"Item2":6}],"textureFrameInterval":1,"framesCount":2,"isCycle":true,"offset":"0, 0"} diff --git a/DangerousD/Content/animations/GibsMoveLeftTop b/DangerousD/Content/animations/GibsMoveLeftTop new file mode 100644 index 0000000..e80c714 --- /dev/null +++ b/DangerousD/Content/animations/GibsMoveLeftTop @@ -0,0 +1 @@ +{"id":"GibsMoveLeftTop","textureName":"MonstersAnimations","startSpriteRectangle":{"X":2,"Y":721,"Width":14,"Height":12},"frameSecond":[{"Item1":0,"Item2":8}],"textureFrameInterval":1,"framesCount":2,"isCycle":true,"offset":"0, 0"} diff --git a/DangerousD/Content/animations/GibsMoveRightBottom b/DangerousD/Content/animations/GibsMoveRightBottom new file mode 100644 index 0000000..246ab34 --- /dev/null +++ b/DangerousD/Content/animations/GibsMoveRightBottom @@ -0,0 +1 @@ +{"id":"GibsMoveRightBottom","textureName":"MonstersAnimations","startSpriteRectangle":{"X":106,"Y":722,"Width":13,"Height":12},"frameSecond":[{"Item1":0,"Item2":6}],"textureFrameInterval":1,"framesCount":2,"isCycle":true,"offset":"0, 0"} diff --git a/DangerousD/Content/animations/GibsMoveRightTop b/DangerousD/Content/animations/GibsMoveRightTop new file mode 100644 index 0000000..4b193fd --- /dev/null +++ b/DangerousD/Content/animations/GibsMoveRightTop @@ -0,0 +1 @@ +{"id":"GibsMoveRightTop","textureName":"MonstersAnimations","startSpriteRectangle":{"X":37,"Y":721,"Width":14,"Height":13},"frameSecond":[{"Item1":0,"Item2":6}],"textureFrameInterval":1,"framesCount":2,"isCycle":true,"offset":"0, 0"} diff --git a/DangerousD/Content/animations/GibsNotMove b/DangerousD/Content/animations/GibsNotMove new file mode 100644 index 0000000..e5333b8 --- /dev/null +++ b/DangerousD/Content/animations/GibsNotMove @@ -0,0 +1 @@ +{"id":"GibsNotMove","textureName":"MonstersAnimations","startSpriteRectangle":{"X":137,"Y":731,"Width":16,"Height":5},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"} diff --git a/DangerousD/Content/map.tmx b/DangerousD/Content/map.tmx new file mode 100644 index 0000000..813425e --- /dev/null +++ b/DangerousD/Content/map.tmx @@ -0,0 +1,75 @@ + + + + + + +294,294,294,294,294,294,294,294,294,294,294,294,294,294,294,294, +294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +294,294,294,294,294,294,294,294,294,294,294,294,294,294,294,294 + + +294,294,294,294,294,321,321,321,321,321,321,321,321,321,321,321, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321, +0,321,321,321,321,321,321,321,321,321,0,0,0,0,0,321, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321, +294,294,294,294,321,321,321,321,321,321,321,321,321,321,321,321 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs index 188dfb9..82dcc2a 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs @@ -78,7 +78,13 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters public override void Death() { + for (int i = 0; i < 3; i++) + { + Particle particle = new Particle(Pos); + } + AppManager.Instance.GameManager.Remove(this); + } public override void Move(GameTime gameTime) @@ -160,6 +166,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters { monster_health--; GraphicsComponent.StartAnimation("ZombieRightAttack"); + Particle particle = new Particle(Pos); if (monster_health <= 0) { Death(); diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Particle.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Particle.cs new file mode 100644 index 0000000..cf08319 --- /dev/null +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Particle.cs @@ -0,0 +1,46 @@ +using DangerousD.GameCore.Graphics; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DangerousD.GameCore.GameObjects.LivingEntities +{ + public class Particle : LivingEntity + { + int delay; + public Particle(Vector2 position) : base(position) + { + Width = 14; + Height = 14; + Random random = new Random(); + velocity = new Vector2(random.Next(3, 15), random.Next(3,30)); + acceleration.Y = 10; + delay = 100; + + } + + protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "GibsMoveLeftBottom", "GibsMoveLeftTop", "GibsMoveRightBottom", "GibsMoveRightTop" }, "GibsMoveRightTop"); + public override void Update(GameTime gameTime) + { + delay--; + if (velocity.X > 0) + { + velocity.X--; + } + if(velocity.Y<=0) + { + GraphicsComponent.StartAnimation("GipsNoMove"); +; } + if(delay<=0) + { + AppManager.Instance.GameManager.Remove(this); + } + base.Update(gameTime); + } + + } +}