particlesAlreadyReady
This commit is contained in:
parent
5f032d527b
commit
34d0a9b64b
2 changed files with 37 additions and 7 deletions
|
@ -123,6 +123,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
if (AppManager.Instance.GameManager.players[0].IsAlive)
|
if (AppManager.Instance.GameManager.players[0].IsAlive)
|
||||||
{
|
{
|
||||||
Attack();
|
Attack();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
base.OnCollision(gameObject);
|
base.OnCollision(gameObject);
|
||||||
|
|
|
@ -12,29 +12,58 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
public class Particle : LivingEntity
|
public class Particle : LivingEntity
|
||||||
{
|
{
|
||||||
int delay;
|
int delay;
|
||||||
|
bool isFall;
|
||||||
public Particle(Vector2 position) : base(position)
|
public Particle(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
Width = 14;
|
Width = 14;
|
||||||
Height = 14;
|
Height = 14;
|
||||||
Random random = new Random();
|
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;
|
acceleration.Y = 10;
|
||||||
delay = 100;
|
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)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
delay--;
|
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)
|
if(delay<=0)
|
||||||
{
|
{
|
||||||
AppManager.Instance.GameManager.Remove(this);
|
AppManager.Instance.GameManager.Remove(this);
|
||||||
|
|
Loading…
Add table
Reference in a new issue