diff --git a/DangerousD/Content/Content.mgcb b/DangerousD/Content/Content.mgcb index 2075f19..b5e65dd 100644 --- a/DangerousD/Content/Content.mgcb +++ b/DangerousD/Content/Content.mgcb @@ -13,18 +13,6 @@ #---------------------------------- Content ---------------------------------# -#begin ../../../animation1.png -/importer:TextureImporter -/processor:TextureProcessor -/processorParam:ColorKeyColor=255,0,255,255 -/processorParam:ColorKeyEnabled=True -/processorParam:GenerateMipmaps=False -/processorParam:PremultiplyAlpha=True -/processorParam:ResizeToPowerOfTwo=False -/processorParam:MakeSquare=False -/processorParam:TextureFormat=Color -/build:../../../animation1.png;animation1.png - #begin File.spritefont /importer:FontDescriptionImporter /processor:FontDescriptionProcessor diff --git a/DangerousD/Content/MonstersAnimations.png b/DangerousD/Content/MonstersAnimations.png index 01d185c..97e3e11 100644 Binary files a/DangerousD/Content/MonstersAnimations.png and b/DangerousD/Content/MonstersAnimations.png differ diff --git a/DangerousD/Content/animation1.png b/DangerousD/Content/animation1.png deleted file mode 100644 index 01d185c..0000000 Binary files a/DangerousD/Content/animation1.png and /dev/null differ diff --git a/DangerousD/Content/animations/ZombieLeftAttack b/DangerousD/Content/animations/ZombieLeftAttack index a5eae6c..63d7675 100644 --- a/DangerousD/Content/animations/ZombieLeftAttack +++ b/DangerousD/Content/animations/ZombieLeftAttack @@ -1 +1 @@ -{"id":"ZombieLeftAttack","textureName":"animation1","startSpriteRectangle":{"X":126,"Y":50,"Width":50,"Height":40},"frameSecond":[{"Item1":0,"Item2":25}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"16, 0"} +{"id":"ZombieLeftAttack","textureName":"MonstersAnimations","startSpriteRectangle":{"X":126,"Y":50,"Width":50,"Height":40},"frameSecond":[{"Item1":0,"Item2":25}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"16, 0"} diff --git a/DangerousD/Content/animations/ZombieMoveLeft b/DangerousD/Content/animations/ZombieMoveLeft index 2f41b50..607e14e 100644 --- a/DangerousD/Content/animations/ZombieMoveLeft +++ b/DangerousD/Content/animations/ZombieMoveLeft @@ -1 +1 @@ -{"id":"ZombieMoveLeft","textureName":"animation1","startSpriteRectangle":{"X":1,"Y":50,"Width":24,"Height":40},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":4,"isCycle":true} +{"id":"ZombieMoveLeft","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":50,"Width":24,"Height":40},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":4,"isCycle":true} diff --git a/DangerousD/Content/animations/ZombieRightAttack b/DangerousD/Content/animations/ZombieRightAttack index d2e6456..2a48da2 100644 --- a/DangerousD/Content/animations/ZombieRightAttack +++ b/DangerousD/Content/animations/ZombieRightAttack @@ -1 +1 @@ -{"id":"ZombieRightAttack","textureName":"animation1","startSpriteRectangle":{"X":126,"Y":9,"Width":50,"Height":40},"frameSecond":[{"Item1":0,"Item2":25}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"16, 0"} +{"id":"ZombieRightAttack","textureName":"MonstersAnimations","startSpriteRectangle":{"X":126,"Y":9,"Width":50,"Height":40},"frameSecond":[{"Item1":0,"Item2":25}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"16, 0"} diff --git a/DangerousD/GameCore/GameObjects/Entity.cs b/DangerousD/GameCore/GameObjects/Entity.cs index 685ffae..6699710 100644 --- a/DangerousD/GameCore/GameObjects/Entity.cs +++ b/DangerousD/GameCore/GameObjects/Entity.cs @@ -22,7 +22,7 @@ namespace DangerousD.GameCore.GameObjects { Vector2 dir = targetPosition - Pos; dir.Normalize(); - Pos += dir * speed; + _pos += dir * speed; } base.Update(gameTime); } diff --git a/DangerousD/GameCore/GameObjects/GameObject.cs b/DangerousD/GameCore/GameObjects/GameObject.cs index 3eb584d..52c96c1 100644 --- a/DangerousD/GameCore/GameObjects/GameObject.cs +++ b/DangerousD/GameCore/GameObjects/GameObject.cs @@ -12,7 +12,7 @@ namespace DangerousD.GameCore { public abstract class GameObject : IDrawableObject { - private Vector2 _pos; + protected Vector2 _pos; public Vector2 Pos => _pos; public int Width { get; protected set; } public int Height { get; protected set; } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/CoreEnemy.cs b/DangerousD/GameCore/GameObjects/LivingEntities/CoreEnemy.cs index c49c08b..7a64f2d 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/CoreEnemy.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/CoreEnemy.cs @@ -28,12 +28,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities { Death(); } + + Move(gameTime, AppManager.Instance.GameManager.Player); + base.Update(gameTime); } public abstract void Death(); public abstract void Attack(Player player); - public abstract void Move(GameTime gameTime); + public abstract void Move(GameTime gameTime, Player player); } } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FlameSkull.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FlameSkull.cs index c521c2e..7bc1ef8 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FlameSkull.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FlameSkull.cs @@ -19,7 +19,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "FlameSkullMoveLeft", "FlameSkullMoveRight" }, "FlameSkullMoveRight"); - public override void Attack() + public override void Attack(Player player) { } @@ -29,7 +29,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters } - public override void Move(GameTime gameTime) + public override void Move(GameTime gameTime, Player player) { } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Frank.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Frank.cs index cab454c..9c0ad65 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Frank.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Frank.cs @@ -15,14 +15,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters private bool isGoRight = false; public Frank(Vector2 position) : base(position) { - Width = 56; - Height = 80; + Width = 112; + Height = 160; GraphicsComponent.StartAnimation("FrankMoveLeft"); - monster_speed = 50; + monster_speed = 1; + name = "Фрэнк"; } protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "FrankMoveRight", "FrankMoveLeft" }, "FrankMoveRight"); - public override void Attack() + public override void Attack(Player player) { } @@ -32,13 +33,19 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters } - public override void Move(GameTime gameTime) + public override void Move(GameTime gameTime, Player player) { + /* if (player.Pos.X - _pos.X <= 20 || player.Pos.X - _pos.X <= -20) + { + player.Death(name); + } */ + if (isGoRight) { if (GraphicsComponent.GetCurrentAnimation != "FrankMoveRight") { GraphicsComponent.StartAnimation("FrankMoveRight"); + velocity = new Vector2(monster_speed, 0); } } else if (!isGoRight) @@ -46,8 +53,18 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters if (GraphicsComponent.GetCurrentAnimation != "FrankMoveLeft") { GraphicsComponent.StartAnimation("FrankMoveLeft"); + velocity = new Vector2(-monster_speed, 0); } } + + if (_pos.X <= 1) + { + isGoRight = true; + } + else if (_pos.X >= 500) + { + isGoRight = false; + } } } } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Ghost.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Ghost.cs index b8827b1..f0440de 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Ghost.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Ghost.cs @@ -18,7 +18,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "GhostMoveRight", "GhostMoveLeft", "GhostSpawn", "GhostAttack" }, ""); - public override void Attack() + public override void Attack(Player player) { } @@ -28,7 +28,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters } - public override void Move(GameTime gameTime) + public override void Move(GameTime gameTime, Player player) { } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Hunchman.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Hunchman.cs index cc6ecd5..1690ba3 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Hunchman.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Hunchman.cs @@ -18,7 +18,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "HunchmanMoveLeft", "HunchmanMoveRight", "HunchmanAttackLeft", "HunchmanAttackRight" }, "HunchmanMoveRight"); - public override void Attack() + public override void Attack(Player player) { } @@ -28,7 +28,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters } - public override void Move(GameTime gameTime) + public override void Move(GameTime gameTime, Player player) { } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Slime.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Slime.cs index 9f3f936..d0e3003 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Slime.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Slime.cs @@ -20,7 +20,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters "SlimeMoveRightBottom", "SlimeReadyJumpRightBottom", "SlimeReadyJumpRightTop", "SlimeReadyJumpLeftBottom", "SlimeReadyJumpLeftTop", "SlimeJumpRightBottom", "SlimeJumpRightTop", "SlimeJumpLeftBottom", "SlimeJumpLeftTop" }, ""); - public override void Attack() + public override void Attack(Player player) { } @@ -30,7 +30,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters } - public override void Move(GameTime gameTime) + public override void Move(GameTime gameTime, Player player) { } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Spider.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Spider.cs index 9513d71..0dfcef4 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Spider.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Spider.cs @@ -18,7 +18,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "SpiderMoveRight", "SpiderMoveLeft", "SpiderDown", "SpiderUp" }, ""); - public override void Attack() + public override void Attack(Player player) { } @@ -28,7 +28,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters } - public override void Move(GameTime gameTime) + public override void Move(GameTime gameTime, Player player) { } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Werewolf.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Werewolf.cs index 91af742..dc4df47 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Werewolf.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Werewolf.cs @@ -18,7 +18,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "WolfMoveRight", "WolfMoveLeft", "WolfJumpRight", "WolfJumpLeft" }, ""); - public override void Attack() + public override void Attack(Player player) { } @@ -28,7 +28,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters } - public override void Move(GameTime gameTime) + public override void Move(GameTime gameTime, Player player) { } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs index 73c4943..e1f79c8 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs @@ -55,7 +55,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters } - public override void Move(GameTime gameTime) + public override void Move(GameTime gameTime, Player player) { if (isGoRight) {