HappyNarezkaAnimations

This commit is contained in:
N4K 2023-08-16 15:14:37 +03:00
parent 4925b11ab3
commit 8713898e49
5 changed files with 17 additions and 12 deletions

View file

@ -0,0 +1 @@
{"id":"FlameSkullMoveRight","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":576,"Width":24,"Height":16},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":2,"isCycle":true,"offset":"0, 0"}

View file

@ -22,7 +22,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
//здесь я не понял
}
public virtual void Update(GameTime gameTime)
public override void Update(GameTime gameTime)
{
if (monster_health <= 0)
{

View file

@ -14,10 +14,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
{
public FlameSkull(Vector2 position) : base(position)
{
Width = 62;
Height = 40;
}
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "FlameSkullMoveLeft", "FlameSkullMoveRight" }, "FlameSkullMoveRight");
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "FlameSkullMoveRight" }, "FlameSkullMoveRight");
public override void Attack()
{

View file

@ -19,7 +19,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
Height = 160;
GraphicsComponent.StartAnimation("FrankMoveLeft");
monster_speed = 1;
name = "Фрэнк";
name = "Frank";
}
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "FrankMoveRight", "FrankMoveLeft" }, "FrankMoveRight");
@ -40,16 +40,18 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
player.Death(name);
} */
if (isGoRight)
if (_pos.X <= 1)
{
isGoRight = true;
if (GraphicsComponent.GetCurrentAnimation != "FrankMoveRight")
{
GraphicsComponent.StartAnimation("FrankMoveRight");
velocity = new Vector2(monster_speed, 0);
}
}
else if (!isGoRight)
else if (_pos.X >= 500)
{
isGoRight = false;
if (GraphicsComponent.GetCurrentAnimation != "FrankMoveLeft")
{
GraphicsComponent.StartAnimation("FrankMoveLeft");
@ -57,13 +59,13 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
}
}
if (_pos.X <= 1)
if (isGoRight)
{
isGoRight = true;
_pos.X += monster_speed;
}
else if (_pos.X >= 500)
else
{
isGoRight = false;
_pos.X -= monster_speed;
}
}
}

View file

@ -12,8 +12,9 @@ namespace DangerousD.GameCore.Levels
{
var Трава = new GrassBlock(new Vector2(0, 128));
var Death = new TestAnimationDeath(new Vector2(128, 128));
var Zombie = new Zombie(new Vector2(256, 128));
//var Zombie = new Zombie(new Vector2(256, 128));
var Frank = new Frank(new Vector2(384, 128));
var FlameSkull = new FlameSkull(new Vector2(512, 128));
}
}
}