diff --git a/DangerousD/Content/animation1.png b/DangerousD/Content/animation1.png deleted file mode 100644 index a599347..0000000 Binary files a/DangerousD/Content/animation1.png and /dev/null differ diff --git a/DangerousD/Content/animations/SilasAttack b/DangerousD/Content/animations/SilasAttack new file mode 100644 index 0000000..4727523 --- /dev/null +++ b/DangerousD/Content/animations/SilasAttack @@ -0,0 +1,20 @@ +{ + "id": "SilasAttack", + "textureName": "MonstersAnimations", + "startSpriteRectangle": { + "X": 1, + "Y": 618, + "Width": 72, + "Height": 80 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 1, + "framesCount": 2, + "isCycle": true, + "offset": "0, 0" +} diff --git a/DangerousD/Content/animations/SilasMove b/DangerousD/Content/animations/SilasMove index b584c4a..334d3c5 100644 --- a/DangerousD/Content/animations/SilasMove +++ b/DangerousD/Content/animations/SilasMove @@ -1 +1,20 @@ -{"id":"SilasMove","textureName":"animation1","startSpriteRectangle":{"X":1,"Y":618,"Width":72,"Height":80},"frameSecond":[{"Item1":0,"Item2":30}],"textureFrameInterval":1,"framesCount":2,"isCycle":true,"offset":"0, 0"} +{ + "id": "SilasMove", + "textureName": "MonstersAnimations", + "startSpriteRectangle": { + "X": 1, + "Y": 618, + "Width": 72, + "Height": 80 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 60 + } + ], + "textureFrameInterval": 1, + "framesCount": 2, + "isCycle": true, + "offset": "0, 0" +} diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs index 63cfcaa..cf33f30 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs @@ -57,6 +57,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters } public override void Update(GameTime gameTime) { + base.Update(gameTime); if ((Pos.X + 20 <= AppManager.Instance.GameManager.GetPlayer1.Pos.X || Pos.X - 20 >= AppManager.Instance.GameManager.GetPlayer1.Pos.X)&&(Pos.Y + 20 <= AppManager.Instance.GameManager.GetPlayer1.Pos.Y || Pos.Y - 20 >= AppManager.Instance.GameManager.GetPlayer1.Pos.Y)) { diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs index 72c8c2d..09a3928 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs @@ -12,14 +12,31 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters { public class SilasMaster : CoreEnemy { + private int attackTime = 60; + private int moveTime = 360; + private int currentTime = 0; public SilasMaster(Vector2 position) : base(position) { - + name = "SilasMaster"; + Width = 144; + Height = 160; + monster_health = 15; + monster_speed = 4; + acceleration = Vector2.Zero; } - protected override GraphicsComponent GraphicsComponent { get; } = new GraphicsComponent(new List() { "SilasMove" }, "SilasMove"); + protected override GraphicsComponent GraphicsComponent { get; } = new GraphicsComponent(new List() { "SilasMove", "SilasAttack" }, "SilasMove"); public override void Attack() { - throw new NotImplementedException(); + if (currentTime==0) + { + GraphicsComponent.StartAnimation("SilasAttack"); + } + else if (currentTime >= attackTime) + { + GraphicsComponent.StartAnimation("SilasMove"); + currentTime = 0; + } + currentTime++; } public override void Death() @@ -29,7 +46,28 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters public override void Move(GameTime gameTime) { - throw new NotImplementedException(); + if (currentTime == 0) + { + GraphicsComponent.StartAnimation("SilasMove"); + } + else if (currentTime >= moveTime) + { + GraphicsComponent.StartAnimation("SilasAttack"); + currentTime = 0; + } + currentTime++; + } + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + if (GraphicsComponent.CurrentAnimation.Id=="SilasMove") + { + Move(gameTime); + } + else + { + Attack(); + } } } } diff --git a/DangerousD/GameCore/Levels/Level1.cs b/DangerousD/GameCore/Levels/Level1.cs index 532517d..24c10b1 100644 --- a/DangerousD/GameCore/Levels/Level1.cs +++ b/DangerousD/GameCore/Levels/Level1.cs @@ -15,6 +15,7 @@ namespace DangerousD.GameCore.Levels var Zombie = new Zombie(new Vector2(300, 64)); var Frank = new Frank(new Vector2(100, 64)); var SilasHand = new SilasHands(new Vector2(200,64)); + var SilasMaster = new SilasMaster(new Vector2(400, 64)); new GrassBlock(new Vector2(0, 224)); for (int i = 0; i < 50; i++) {