diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs index 5a5711e..ab0a681 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs @@ -123,6 +123,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters if (AppManager.Instance.GameManager.players[0].IsAlive) { Attack(); + } } base.OnCollision(gameObject); diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Particle.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Particle.cs index cf08319..d716fe3 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Particle.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Particle.cs @@ -12,29 +12,58 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities public class Particle : LivingEntity { int delay; + bool isFall; 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)); + velocity = new Vector2(random.Next(-6, 6), random.Next(-8,4)); acceleration.Y = 10; delay = 100; - + isFall = false; + isOnGround = false; } - protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "GibsMoveLeftBottom", "GibsMoveLeftTop", "GibsMoveRightBottom", "GibsMoveRightTop" }, "GibsMoveRightTop"); + protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "GibsMoveLeftBottom", "GibsMoveLeftTop", "GibsMoveRightBottom", "GibsMoveRightTop", "GibsNotMove" }, "GibsMoveRightTop"); public override void Update(GameTime gameTime) { + delay--; - if (velocity.X > 0) + if (delay<=80) { - velocity.X--; + velocity.X=0; } - if(velocity.Y<=0) + if(isOnGround) { - GraphicsComponent.StartAnimation("GipsNoMove"); + GraphicsComponent.StartAnimation("GibsNotMove"); + Width = 16; + Height = 5; + isFall=true; + ; } + + else if(!isFall) + { + Width = 14; + Height= 14; + if (velocity.Y<0 && velocity.X>0) + { + GraphicsComponent.StartAnimation("GibsMoveRightTop"); + } + else if (velocity.Y < 0 && velocity.X < 0) + { + GraphicsComponent.StartAnimation("GibsMoveLeftTop"); + } + else if (velocity.Y > 0 && velocity.X > 0) + { + GraphicsComponent.StartAnimation("GibsMoveRightBottom"); + } + else if (velocity.Y > 0 && velocity.X < 0) + { + GraphicsComponent.StartAnimation("GibsMoveLeftBottom"); + } + } if(delay<=0) { AppManager.Instance.GameManager.Remove(this);