diff --git a/DangerousD/GameCore/.DS_Store b/DangerousD/GameCore/.DS_Store new file mode 100644 index 0000000..e6c817c Binary files /dev/null and b/DangerousD/GameCore/.DS_Store differ diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Frank.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Frank.cs index b0b3429..b67dd12 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Frank.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Frank.cs @@ -12,9 +12,17 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters { internal class Frank : CoreEnemy { + private Vector2 position; private bool isGoRight = false; + + public Vector2 Position + { + get { return position; } + } + public Frank(Vector2 position) : base(position) { + this.position = position; Width = 112; Height = 160; GraphicsComponent.StartAnimation("FrankMoveLeft"); diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FrankBalls.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FrankBalls.cs index 7101da2..a235c3b 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FrankBalls.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FrankBalls.cs @@ -12,19 +12,52 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters { public class FrankBalls : CoreEnemy { + private Rectangle collision; + private Vector2 position; + private int healthBall; + private bool isFlyRight = true; + private bool isAttacking = false; + + public Rectangle Collision + { + get { return collision; } + } + public FrankBalls(Vector2 position) : base(position) { + this.position = position; name = "FrankBalls"; Width = 40; Height = 40; - monster_speed = 1; + monster_speed = 3; acceleration = Vector2.Zero; } protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "BallMoveRight" }, "BallMoveRight"); + public override void Update(GameTime gameTime) + { + if(!isAttacking) + { + Move(gameTime); + } + + base.Update(gameTime); + } + public override void Attack() { + collision = new Rectangle((int)position.X, (int)position.Y, 40, 40); + isAttacking = true; + + if(isFlyRight) + { + AppManager.Instance.GameManager.players[0].Death(name); + } + else if(!isFlyRight) + { + AppManager.Instance.GameManager.players[0].Death(name); + } } @@ -35,7 +68,19 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters public override void Move(GameTime gameTime) { + velocity.X = 0; + velocity.Y = 0; + if(isFlyRight) + { + velocity.X += monster_speed; + velocity.Y += monster_speed; + } + else if(!isFlyRight) + { + velocity.X -= monster_speed; + velocity.Y -= monster_speed; + } } } } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs index a322e92..b841dbd 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs @@ -48,7 +48,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters isAttaking = true; if (isGoRight) { - if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveRight") + if (GraphicsComponent.GetCurrentAnimation != "ZombieRightAttack") { GraphicsComponent.StartAnimation("ZombieAttackRight"); } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs index 04eec1b..6e1af79 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs @@ -17,7 +17,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities Width = 32; Height = 64; AppManager.Instance.InputManager.MovEventJump += AnimationJump; - } public bool IsAlive { get { return isAlive; } } diff --git a/DangerousD/GameCore/Managers/SoundManager.cs b/DangerousD/GameCore/Managers/SoundManager.cs index ffa61d2..aed8571 100644 --- a/DangerousD/GameCore/Managers/SoundManager.cs +++ b/DangerousD/GameCore/Managers/SoundManager.cs @@ -19,12 +19,17 @@ namespace DangerousD.GameCore public void LoadSounds() // метод для загрузки звуков из папки { - string[] soundFiles = Directory.GetFiles("../../../Content").Where(x=>x.EndsWith("mp3")).Select(x=>x.Split("\\").Last().Replace(".mp3", "")).ToArray();// папка со звуками там где exe - foreach (var soundFile in soundFiles) + var k = Directory.GetFiles("../../..//Content").Where(x => x.EndsWith("mp3")); + if (k.Count()>0) { - Sounds.Add(soundFile, AppManager.Instance.Content.Load(soundFile).CreateInstance()); - } + string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".mp3", "")).ToArray();// папка со звуками там где exe + foreach (var soundFile in soundFiles) + { + Sounds.Add(soundFile, AppManager.Instance.Content.Load(soundFile).CreateInstance()); + } + + } } public void StartAmbientSound(string soundName) // запустить звук у которого нет позиции