particlesAlreadyReady

This commit is contained in:
Kaktus200020 2023-08-18 11:01:47 +03:00
parent 5f032d527b
commit 34d0a9b64b
2 changed files with 37 additions and 7 deletions

View file

@ -123,6 +123,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
if (AppManager.Instance.GameManager.players[0].IsAlive)
{
Attack();
}
}
base.OnCollision(gameObject);

View file

@ -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<string> { "GibsMoveLeftBottom", "GibsMoveLeftTop", "GibsMoveRightBottom", "GibsMoveRightTop" }, "GibsMoveRightTop");
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "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);