diff --git a/.gitignore b/.gitignore index 1537aee..32fcc78 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ bin obj .vs .idea -DangerousD.sln.DotSettings.user \ No newline at end of file +DangerousD.sln.DotSettings.user +.DS_Store diff --git a/AnimationsFileCreator/AnimationsFileCreator.csproj b/AnimationsFileCreator/AnimationsFileCreator.csproj index 9e982a1..296b0a7 100644 --- a/AnimationsFileCreator/AnimationsFileCreator.csproj +++ b/AnimationsFileCreator/AnimationsFileCreator.csproj @@ -2,8 +2,7 @@ Exe - net6.0-windows - true + net6.0 diff --git a/AnimationsFileCreator/Program.cs b/AnimationsFileCreator/Program.cs index 9a712a0..0eae948 100644 --- a/AnimationsFileCreator/Program.cs +++ b/AnimationsFileCreator/Program.cs @@ -2,7 +2,6 @@ using Microsoft.Xna.Framework; using Newtonsoft.Json; using System; -using System.Windows.Forms; using System.IO; using System.Linq; using System.Reflection.Metadata; @@ -17,13 +16,7 @@ namespace AnimationsFileCreator Console.WriteLine("Добро пожаловать в костыльную программу по созданию файлов анимации для игры DungerousD"); Console.Write("Введите название текстуры (нажмите enter, чтобы выбрать файл во всплывающем окошке): "); string textureName = Console.ReadLine(); - if (textureName == "") - { - OpenFileDialog dialog = new OpenFileDialog(); - dialog.ShowDialog(); - textureName = dialog.FileName.Split('\\').Last(); - textureName = textureName.Split('.')[0]; - } + Console.WriteLine("Введите количество кадров анимации: "); int framesCount = int.Parse(Console.ReadLine()); Console.WriteLine("Введите длительность кадра в анимации: "); diff --git a/DangerousD/Content/Content.mgcb b/DangerousD/Content/Content.mgcb index 29141fb..0eb0044 100644 --- a/DangerousD/Content/Content.mgcb +++ b/DangerousD/Content/Content.mgcb @@ -17,6 +17,7 @@ #begin ButtonFont.spritefont /importer:FontDescriptionImporter /processor:FontDescriptionProcessor +<<<<<<< HEAD /processorParam:PremultiplyAlpha=True /processorParam:TextureFormat=Compressed /build:ButtonFont.spritefont @@ -56,6 +57,11 @@ /processorParam:MakeSquare=False /processorParam:TextureFormat=Color /build:checkboxs_on.png +======= +/processorParam:PremultiplyAlpha=True +/processorParam:TextureFormat=Compressed +/build:ButtonFont.spritefont +>>>>>>> Diamond #begin deathAnimation.png /importer:TextureImporter @@ -69,6 +75,7 @@ /processorParam:TextureFormat=Color /build:deathAnimation.png +<<<<<<< HEAD #begin deathBackground.jpg /importer:TextureImporter /processor:TextureProcessor @@ -82,6 +89,8 @@ /build:deathBackground.jpg +======= +>>>>>>> Diamond #begin DoomTestSong.mp3 /importer:Mp3Importer /processor:SoundEffectProcessor @@ -141,6 +150,7 @@ /build:menuFon.jpg #begin MenuFon2.jpg +<<<<<<< HEAD /importer:TextureImporter /processor:TextureProcessor /processorParam:ColorKeyColor=255,0,255,255 @@ -165,6 +175,8 @@ /build:menuFon3.jpg #begin MonstersAnimations.png +======= +>>>>>>> Diamond /importer:TextureImporter /processor:TextureProcessor /processorParam:ColorKeyColor=255,0,255,255 @@ -174,9 +186,15 @@ /processorParam:ResizeToPowerOfTwo=False /processorParam:MakeSquare=False /processorParam:TextureFormat=Color +<<<<<<< HEAD /build:MonstersAnimations.png #begin optionsBackground.jpg +======= +/build:MenuFon2.jpg + +#begin menuFon3.jpg +>>>>>>> Diamond /importer:TextureImporter /processor:TextureProcessor /processorParam:ColorKeyColor=255,0,255,255 @@ -186,9 +204,15 @@ /processorParam:ResizeToPowerOfTwo=False /processorParam:MakeSquare=False /processorParam:TextureFormat=Color +<<<<<<< HEAD /build:optionsBackground.jpg #begin PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png +======= +/build:menuFon3.jpg + +#begin MonstersAnimations.png +>>>>>>> Diamond /importer:TextureImporter /processor:TextureProcessor /processorParam:ColorKeyColor=255,0,255,255 @@ -198,9 +222,15 @@ /processorParam:ResizeToPowerOfTwo=False /processorParam:MakeSquare=False /processorParam:TextureFormat=Color +<<<<<<< HEAD /build:PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png #begin playerAnimation.png +======= +/build:MonstersAnimations.png + +#begin spriteDiamond.png +>>>>>>> Diamond /importer:TextureImporter /processor:TextureProcessor /processorParam:ColorKeyColor=255,0,255,255 @@ -210,6 +240,7 @@ /processorParam:ResizeToPowerOfTwo=False /processorParam:MakeSquare=False /processorParam:TextureFormat=Color +<<<<<<< HEAD /build:playerAnimation.png #begin slider.png @@ -307,6 +338,9 @@ /processorParam:MakeSquare=False /processorParam:TextureFormat=Color /build:textboxbackground6-1.png +======= +/build:spriteDiamond.png +>>>>>>> Diamond #begin tiles.png /importer:TextureImporter diff --git a/DangerousD/Content/animations/diamondAnimation b/DangerousD/Content/animations/diamondAnimation new file mode 100644 index 0000000..724688c --- /dev/null +++ b/DangerousD/Content/animations/diamondAnimation @@ -0,0 +1 @@ +{"id":"diamondAnimation","textureName":"spriteDiamond","startSpriteRectangle":{"X":0,"Y":0,"Width":512,"Height":420},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":8,"isCycle":true,"offset":"0, 0"} diff --git a/DangerousD/Content/spriteDiamond.png b/DangerousD/Content/spriteDiamond.png new file mode 100644 index 0000000..ef28f51 Binary files /dev/null and b/DangerousD/Content/spriteDiamond.png differ diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Diamond.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Diamond.cs new file mode 100644 index 0000000..6826a40 --- /dev/null +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Diamond.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using DangerousD.GameCore.Graphics; +using Microsoft.Xna.Framework; + +namespace DangerousD.GameCore.GameObjects.LivingEntities +{ + public class Diamond : Entity + { + + protected override GraphicsComponent GraphicsComponent { get; } = new GraphicsComponent(new List() { "spriteDiamond" }, "spriteDiamond"); + + public Diamond(Vector2 position) : base(position) + { + + } + + + public void Update(Player player) + { + if (Rectangle.Intersects(player.Rectangle)) + { + player.score++; + } + } + } +} + diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs index 8fc27bf..945fbae 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs @@ -89,10 +89,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities } public Rectangle GetShootRectangle(bool isRight) { - if (isRight) + if (isRight) return new Rectangle((int)Pos.X, (int)(Pos.Y) + 10, shootLength + Width, Height / 2); else - return new Rectangle((int)Pos.X-shootLength, (int)(Pos.Y) + 10, shootLength, Height / 2); + return new Rectangle((int)Pos.X - shootLength, (int)(Pos.Y) + 10, shootLength, Height / 2); } public override void Draw(SpriteBatch spriteBatch) { @@ -108,9 +108,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities (attackRect.Y - GraphicsComponent.CameraPosition.Y) * GraphicsComponent.scaling, attackRect.Width * GraphicsComponent.scaling, attackRect.Height * GraphicsComponent.scaling), Color.White); - } + + } + public void Death(string monsterName) { if (AppManager.Instance.InputManager.InvincibilityCheat) @@ -118,7 +120,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities return; } isAttacked = true; - if(monsterName == "Zombie") + if (monsterName == "Zombie") { AnimationRectangle deathRectangle = new AnimationRectangle(Pos, "DeathFrom" + monsterName); deathRectangle.Gr.actionOfAnimationEnd += (a) => @@ -129,7 +131,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities } }; } - else if(monsterName == "Spider") + else if (monsterName == "Spider") { AnimationRectangle deathRectangle = new AnimationRectangle(Pos, "DeathFrom" + monsterName); deathRectangle.Gr.actionOfAnimationEnd += (a) => @@ -190,73 +192,14 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities { Zombie targetZombie = (Zombie)targets.First(); targetZombie.TakeDamage(); + } - } - targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(GetShootRectangle(isRight), typeof(SilasHands)).OrderBy(x => (x.Pos - Pos).LengthSquared()); - if (targets.Count() > 0) - { - SilasHands targetHand = (SilasHands)targets.First(); - targetHand.TakeDamage(); - } - SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X + 30, Pos.Y + 7)); - } - else - { - StartCicycleAnimation("playerShootLeft"); - var targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(GetShootRectangle(isRight), typeof(Zombie)); - if (targets != null) - { - foreach (var target in targets) - { - Zombie targetZombie = (Zombie)target; - targetZombie.TakeDamage(); - } - } - targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(GetShootRectangle(isRight), typeof(SilasHands)); - if (targets.Count() > 0) - { - SilasHands targetHand = (SilasHands)targets.First(); - targetHand.TakeDamage(); - } - SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X - 12, Pos.Y + 7)); } } } } } - public override void Update(GameTime gameTime) - { - if (AppManager.Instance.InputManager.ScopeState == ScopeState.Up) - { - isUping = true; - } - else - { - isUping = false; - } - if (isOnGround && FallingThroughPlatform) - { - FallingThroughPlatform = false; - } - GraphicsComponent.SetCameraPosition(Pos); - if (!isAttacked || AppManager.Instance.InputManager.InvincibilityCheat) - { - if (!isShooting) - { - Move(gameTime); - } - else - { - velocity.X = 0; - } - } - else - { - velocity.X = 0; - } - base.Update(gameTime); - } public void Move(GameTime gameTime) { @@ -282,7 +225,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities } else if (AppManager.Instance.InputManager.VectorMovementDirection.X == 0)//стоит { - if(bullets < 5) + if (bullets < 5) { if (GraphicsComponent.GetCurrentAnimation != "playerReload") { @@ -309,6 +252,8 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities { FallingThroughPlatform = true; isOnGround = false; - } + } } } + } +} \ No newline at end of file