GhostAdding
This commit is contained in:
parent
d87770f9ec
commit
1ed1dd635f
3 changed files with 48 additions and 13 deletions
|
@ -1 +1 @@
|
||||||
{"id":"GhostAttack","textureName":"MonstersAnimations","startSpriteRectangle":{"X":101,"Y":503,"Width":24,"Height":31},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":2,"isCycle":false,"offset":"0, 0"}
|
{"id":"GhostAttack","textureName":"MonstersAnimations","startSpriteRectangle":{"X":101,"Y":503,"Width":24,"Height":31},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":50,"framesCount":2,"isCycle":false,"offset":"0, 0"}
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
<objectgroup id="6" name="Слой объектов 1" class="LivingEntities.Monsters.Werewolf">
|
<objectgroup id="6" name="Слой объектов 1" class="LivingEntities.Monsters.Ghost">
|
||||||
<object id="5" x="150" y="200">
|
<object id="5" x="150" y="200">
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
@ -17,11 +17,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
isGoRight = true;
|
isGoRight = true;
|
||||||
monster_speed = 3;
|
monster_speed = 3;
|
||||||
name = "Ghost";
|
name = "Ghost";
|
||||||
Width = 48;
|
Width = 24;
|
||||||
Height = 62;
|
Height = 30;
|
||||||
GraphicsComponent.StartAnimation("GhostSpawn");
|
GraphicsComponent.StartAnimation("GhostSpawn");
|
||||||
acceleration = Vector2.Zero;
|
acceleration = new Vector2(0,1);
|
||||||
|
monster_health = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "GhostMoveRight", "GhostMoveLeft", "GhostSpawn", "GhostAttack" }, "GhostMoveRight");
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "GhostMoveRight", "GhostMoveLeft", "GhostSpawn", "GhostAttack" }, "GhostMoveRight");
|
||||||
|
@ -38,13 +38,32 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Attack()
|
public override void Attack()
|
||||||
{
|
{
|
||||||
|
velocity.X = 0;
|
||||||
|
isAttack = true;
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "GhostAttack")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("GhostAttack");
|
||||||
|
}
|
||||||
|
|
||||||
|
AppManager.Instance.GameManager.players[0].Death(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Death()
|
public override void Death()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public override void OnCollision(GameObject gameObject)
|
||||||
|
{
|
||||||
|
if (gameObject is Player)
|
||||||
|
{
|
||||||
|
if (AppManager.Instance.GameManager.players[0].IsAlive)
|
||||||
|
{
|
||||||
|
Attack();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
base.OnCollision(gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
@ -64,17 +83,24 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
velocity.X = -monster_speed;
|
velocity.X = -monster_speed;
|
||||||
}
|
}
|
||||||
if (Pos.X >= rightBoarder)
|
var getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 50, 2));
|
||||||
|
if (isGoRight)
|
||||||
{
|
{
|
||||||
isGoRight = false;
|
getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, Width + 4, 2));
|
||||||
}
|
}
|
||||||
else if (Pos.X <= leftBoarder)
|
else
|
||||||
{
|
{
|
||||||
isGoRight = true;
|
getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X - 3, (int)Pos.Y + Height / 2 - 2, Width + 3, 2));
|
||||||
}
|
}
|
||||||
if (true)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var item in getCols)
|
||||||
|
{
|
||||||
|
if (item is MapObject)
|
||||||
|
{
|
||||||
|
isGoRight = !isGoRight;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +108,16 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void TakeDamage()
|
||||||
|
{
|
||||||
|
monster_health--;
|
||||||
|
|
||||||
|
|
||||||
|
if (monster_health <= 0)
|
||||||
|
{
|
||||||
|
Death();
|
||||||
|
}
|
||||||
|
}
|
||||||
public void Target()
|
public void Target()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|
Loading…
Add table
Reference in a new issue