updated death
This commit is contained in:
parent
607d047c6d
commit
801f0e97d8
2 changed files with 13 additions and 2 deletions
|
@ -23,6 +23,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
public int rightBorder;
|
public int rightBorder;
|
||||||
public int leftBorder;
|
public int leftBorder;
|
||||||
public bool isVisible = true;
|
public bool isVisible = true;
|
||||||
|
private bool isAttacked = false;
|
||||||
public GameObject objectAttack;
|
public GameObject objectAttack;
|
||||||
|
|
||||||
public Player(Vector2 position) : base(position)
|
public Player(Vector2 position) : base(position)
|
||||||
|
@ -70,6 +71,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
}
|
}
|
||||||
public void Death(string monsterName)
|
public void Death(string monsterName)
|
||||||
{
|
{
|
||||||
|
isAttacked = true;
|
||||||
if(monsterName == "Zombie")
|
if(monsterName == "Zombie")
|
||||||
{
|
{
|
||||||
DeathRectangle deathRectangle = new DeathRectangle(Pos, "DeathFrom" + monsterName);
|
DeathRectangle deathRectangle = new DeathRectangle(Pos, "DeathFrom" + monsterName);
|
||||||
|
@ -77,7 +79,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
{
|
{
|
||||||
if (a == "DeathFrom" + monsterName)
|
if (a == "DeathFrom" + monsterName)
|
||||||
{
|
{
|
||||||
AppManager.Instance.ChangeGameState(GameState.GameOver);
|
AppManager.Instance.ChangeGameState(GameState.Death);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -99,6 +101,14 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
GraphicsComponent.CameraPosition = (_pos-new Vector2(200, 350)).ToPoint();
|
GraphicsComponent.CameraPosition = (_pos-new Vector2(200, 350)).ToPoint();
|
||||||
|
if (!isAttacked)
|
||||||
|
{
|
||||||
|
Move(gameTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
velocity.X = 0;
|
||||||
|
}
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace DangerousD.GameCore
|
||||||
public List<Player> players;
|
public List<Player> players;
|
||||||
public List<GameObject> otherObjects = new();
|
public List<GameObject> otherObjects = new();
|
||||||
|
|
||||||
public Player GetPlayer1 => players[0];
|
public Player GetPlayer1;
|
||||||
public GameManager()
|
public GameManager()
|
||||||
{
|
{
|
||||||
others = new List<GameObject>();
|
others = new List<GameObject>();
|
||||||
|
@ -49,6 +49,7 @@ namespace DangerousD.GameCore
|
||||||
{
|
{
|
||||||
livingEntities.Add(gameObject as LivingEntity);
|
livingEntities.Add(gameObject as LivingEntity);
|
||||||
players.Add(objPl);
|
players.Add(objPl);
|
||||||
|
GetPlayer1 = players[0];
|
||||||
}
|
}
|
||||||
else if (gameObject is LivingEntity objLE)
|
else if (gameObject is LivingEntity objLE)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue