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/FrankBalls.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FrankBalls.cs index fc871f7..a235c3b 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FrankBalls.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FrankBalls.cs @@ -15,6 +15,8 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters private Rectangle collision; private Vector2 position; private int healthBall; + private bool isFlyRight = true; + private bool isAttacking = false; public Rectangle Collision { @@ -27,16 +29,36 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters 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); + } + } public override void Death() @@ -46,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 dba2deb..34aa9d5 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs @@ -43,7 +43,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 cd23ad2..7b9c0d6 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs @@ -16,7 +16,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities { Width = 32; Height = 64; - GraphicsComponent.actionOfAnimationEnd += () => + GraphicsComponent.actionOfAnimationEnd += (a) => { AppManager.Instance.ChangeGameState(GameState.GameOver); }; @@ -35,7 +35,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities if(monsterName == "Zombie") { DeathRectangle deathRectangle = new DeathRectangle(Pos, "DeathFrom" + monsterName); - GraphicsComponent.actionOfAnimationEnd(); + GraphicsComponent.actionOfAnimationEnd("0"); } isAlive = false; } diff --git a/DangerousD/GameCore/Managers/SoundManager.cs b/DangerousD/GameCore/Managers/SoundManager.cs index 9021fa8..92feea5 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) // запустить звук у которого нет позиции