diff --git a/AnimationsFileCreator/Program.cs b/AnimationsFileCreator/Program.cs index dc2bf5b..9a712a0 100644 --- a/AnimationsFileCreator/Program.cs +++ b/AnimationsFileCreator/Program.cs @@ -5,6 +5,7 @@ using System; using System.Windows.Forms; using System.IO; using System.Linq; +using System.Reflection.Metadata; namespace AnimationsFileCreator { @@ -62,7 +63,7 @@ namespace AnimationsFileCreator container.TextureFrameInterval = 1; container.Id = id; string json = JsonConvert.SerializeObject(container); - StreamWriter writer = new StreamWriter(id); + StreamWriter writer = new StreamWriter("../../../../DangerousD/Content/animations/"+id); writer.WriteLine(json); writer.Close(); } diff --git a/DangerousD/Content/animations/SilasHandMove b/DangerousD/Content/animations/SilasHandMove new file mode 100644 index 0000000..06589c3 --- /dev/null +++ b/DangerousD/Content/animations/SilasHandMove @@ -0,0 +1 @@ +{"id":"SilasHandMove","textureName":"MonstersAnimations","startSpriteRectangle":{"X":197,"Y":618,"Width":24,"Height":24},"frameSecond":[{"Item1":0,"Item2":8}],"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 6c13e1b..63cfcaa 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs @@ -1,4 +1,8 @@ -using System; +using DangerousD.GameCore.Graphics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +10,59 @@ using System.Threading.Tasks; namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters { - internal class SilasHands + public class SilasHands : CoreEnemy { + public SilasHands(Vector2 position) : base(position) + { + name = "SilasHand"; + Width = 48; + Height = 48; + monster_health = 2; + monster_speed = 2; + acceleration = Vector2.Zero; + + } + + protected override GraphicsComponent GraphicsComponent { get; }=new GraphicsComponent(new List() { "SilasHandMove" }, "SilasHandMove"); + + public override void Attack() + { + throw new NotImplementedException(); + } + + public override void Death() + { + throw new NotImplementedException(); + } + + public override void Move(GameTime gameTime) + { + if (Pos.Y> AppManager.Instance.GameManager.GetPlayer1.Pos.Y) + { + velocity.Y = monster_speed; + + } + else + { + velocity.Y = 0; + } + if (Pos.X> AppManager.Instance.GameManager.GetPlayer1.Pos.X) + { + velocity.X = -monster_speed; + } + else + { + velocity.X = monster_speed; + } + } + public override void Update(GameTime 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)) + { + + AppManager.Instance.GameManager.GetPlayer1.Death(name); + } + GraphicsComponent.Update(); + } } } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs index 4a5d727..656f5f8 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs @@ -1,4 +1,8 @@ -using System; +using DangerousD.GameCore.Graphics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +10,27 @@ using System.Threading.Tasks; namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters { - public class SilasMaster + public class SilasMaster : CoreEnemy { + public SilasMaster(Vector2 position) : base(position) + { + + } + protected override GraphicsComponent GraphicsComponent => throw new NotImplementedException(); + + public override void Attack() + { + throw new NotImplementedException(); + } + + public override void Death() + { + throw new NotImplementedException(); + } + + public override void Move(GameTime gameTime) + { + throw new NotImplementedException(); + } } } diff --git a/DangerousD/GameCore/Graphics/GraphicsComponent.cs b/DangerousD/GameCore/Graphics/GraphicsComponent.cs index c5834ab..849eae0 100644 --- a/DangerousD/GameCore/Graphics/GraphicsComponent.cs +++ b/DangerousD/GameCore/Graphics/GraphicsComponent.cs @@ -14,7 +14,14 @@ namespace DangerousD.GameCore.Graphics private List textures; private List texturesNames; private AnimationContainer currentAnimation; - + public AnimationContainer CurrentAnimation + { + get + { + return currentAnimation; + } + } + public string GetCurrentAnimation { get { return currentAnimation.Id; } @@ -24,6 +31,13 @@ namespace DangerousD.GameCore.Graphics //private SpriteBatch _spriteBatch; private int currentFrame; + public int CurrentFrame + { + get + { + return currentFrame; + } + } private int interval; private int lastInterval; private Rectangle sourceRectangle; diff --git a/DangerousD/GameCore/Levels/Level1.cs b/DangerousD/GameCore/Levels/Level1.cs index d23c7c6..532517d 100644 --- a/DangerousD/GameCore/Levels/Level1.cs +++ b/DangerousD/GameCore/Levels/Level1.cs @@ -14,7 +14,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)); new GrassBlock(new Vector2(0, 224)); for (int i = 0; i < 50; i++) {