From 99585effd24754f24316d69e6abac631f8e4e5ba Mon Sep 17 00:00:00 2001 From: Mootfrost777 Date: Fri, 18 Aug 2023 11:12:25 +0300 Subject: [PATCH 1/3] Door render --- DangerousD/Content/Content.mgcb | 60 +++-- DangerousD/Content/Door.tsx | 4 + DangerousD/Content/doors.png | Bin 0 -> 472 bytes DangerousD/Content/lvl.tmx | 215 ++++-------------- .../GameCore/GameObjects/Entities/Door.cs | 17 +- .../GameObjects/Entities/Items/Coin.cs | 13 ++ .../GameObjects/Entities/Items/Diamond.cs | 13 ++ DangerousD/GameCore/Managers/MapManager.cs | 13 +- 8 files changed, 141 insertions(+), 194 deletions(-) create mode 100644 DangerousD/Content/Door.tsx create mode 100644 DangerousD/Content/doors.png create mode 100644 DangerousD/GameCore/GameObjects/Entities/Items/Coin.cs create mode 100644 DangerousD/GameCore/GameObjects/Entities/Items/Diamond.cs diff --git a/DangerousD/Content/Content.mgcb b/DangerousD/Content/Content.mgcb index 37d9842..9924833 100644 --- a/DangerousD/Content/Content.mgcb +++ b/DangerousD/Content/Content.mgcb @@ -21,18 +21,6 @@ /processorParam:TextureFormat=Compressed /build:ButtonFont.spritefont -#begin checkboxs_off-on.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:checkboxs_off-on.png - #begin checkboxs_off.png /importer:TextureImporter /processor:TextureProcessor @@ -45,6 +33,18 @@ /processorParam:TextureFormat=Color /build:checkboxs_off.png +#begin checkboxs_off-on.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:checkboxs_off-on.png + #begin checkboxs_on.png /importer:TextureImporter /processor:TextureProcessor @@ -87,6 +87,18 @@ /processorParam:Quality=Best /build:DoomTestSong.mp3 +#begin doors.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:doors.png + #begin Font_12.spritefont /importer:FontDescriptionImporter /processor:FontDescriptionProcessor @@ -235,18 +247,6 @@ /processorParam:TextureFormat=Color /build:textboxbackground1-1.png -#begin textboxbackground2-1.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:textboxbackground2-1.png - #begin textboxbackground2,5-1.png /importer:TextureImporter /processor:TextureProcessor @@ -259,6 +259,18 @@ /processorParam:TextureFormat=Color /build:textboxbackground2,5-1.png +#begin textboxbackground2-1.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:textboxbackground2-1.png + #begin textboxbackground6-1.png /importer:TextureImporter /processor:TextureProcessor diff --git a/DangerousD/Content/Door.tsx b/DangerousD/Content/Door.tsx new file mode 100644 index 0000000..a250dd5 --- /dev/null +++ b/DangerousD/Content/Door.tsx @@ -0,0 +1,4 @@ + + + + diff --git a/DangerousD/Content/doors.png b/DangerousD/Content/doors.png new file mode 100644 index 0000000000000000000000000000000000000000..60742ae1fa145b78510306d091579331a2f8e571 GIT binary patch literal 472 zcmV;}0Vn>6P)Px#1ZP1_K>z@;j|==^1poj55>QN3Mg08ysHms_002}}RH#${{QOj~pRX+d000Sa zNLh0L01m?d01m?e$8V@)0003`NkllD_|0 zriv;E*miI^r6ExsU-ls%1HAwNTkh&HAoAaVAS?0; zv>9v#0JK;fFjj%4A%LT$=?d=wK+rir0p9u0{v#`Z;xCv2P!Hm&jeLTLG6z%z9*o#l z0T&u>;a5;913DHR@FTvjU7zANEG^64VFF+JQeqw*W_$s{$Sj z%Pd%db*1stR3I53zX45BVBhzgscArR<%gty39J*q`z!D}0yP&6*neigF#)b~h&TgY z6Cg~1+c~^vK)wQi$y)+wDaG}f2=p}8n*nqxt5IIoe!Uf*c50_>w{wuKY%y_@d+@V)p0nhWBdcy;MKKc8ron0 O0000 - + - + + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -311,137 +312,7 @@ - - - -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,149,152,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,150,153,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,151,154,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,149,152,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,150,153,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,151,154,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - - -0,0,0,0,0,0,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,0,0,0,0,0,0,0,151,154,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - - - - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -466,7 +337,7 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,147,199,199,148,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -517,7 +388,7 @@ - + 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29, @@ -559,15 +430,15 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 157,157,157,178,179,157,157,157,157,157,157,157,157,157,157,157, -157,157,157,191,192,157,157,252,253,157,157,157,157,157,157,258, -157,157,157,157,157,157,157,265,266,157,157,157,696,697,157,271, -204,204,204,204,204,204,204,278,279,204,204,204,709,710,204,284, +157,157,157,191,192,157,157,149,152,157,157,157,157,157,157,258, +157,157,157,157,157,157,157,150,153,157,157,157,696,697,157,271, +204,204,204,204,204,204,204,151,154,204,204,204,709,710,204,284, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157, -157,157,157,157,157,157,258,157,157,157,252,253,157,157,157,157, -157,157,157,157,157,157,271,157,157,157,265,266,157,696,697,157, -157,157,272,204,204,204,284,204,204,204,278,279,204,709,710,204, +157,157,157,157,157,157,258,157,157,157,149,152,157,157,157,157, +157,157,157,157,157,157,271,157,157,157,150,153,157,696,697,157, +157,157,272,204,204,204,284,204,204,204,151,154,204,709,710,204, 157,157,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 157,157,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 157,157,157,157,157,157,157,157,157,157,157,167,157,157,209,210, @@ -589,25 +460,25 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 211,212,157,157,157,157,157,157,157,157,157,157,157,157,157,157, -224,225,157,157,252,253,157,248,249,157,157,258,157,157,157,157 +224,225,157,157,149,152,157,248,249,157,157,258,157,157,157,157 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -144,144,144,144,144,144,144,144,621,622,144,144,144,0,0,0, -157,157,157,157,157,157,157,157,634,635,157,157,157,0,0,0, -157,248,249,157,157,157,272,157,647,648,157,272,157,0,0,0, +144,144,144,144,144,144,144,144,79,80,144,144,144,0,0,0, +157,157,157,157,157,157,157,157,92,93,157,157,157,0,0,0, +157,248,249,157,157,157,272,157,105,106,157,272,157,0,0,0, 157,250,251,157,157,157,145,147,199,200,148,145,157,0,0,0, 204,239,240,204,204,204,204,160,199,200,161,204,204,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 144,144,144,144,144,144,144,144,144,144,144,144,144,0,0,0, 178,179,157,157,157,157,157,243,157,157,157,157,157,0,0,0, -191,192,157,157,157,157,157,256,257,157,252,253,157,0,0,0, -157,157,157,157,157,157,157,269,270,157,265,266,157,0,0,0, -204,204,204,204,204,204,204,282,283,204,278,279,204,0,0,0, +191,192,157,157,157,157,157,256,257,157,149,152,157,0,0,0, +157,157,157,157,157,157,157,269,270,157,150,153,157,0,0,0, +204,204,204,204,204,204,204,282,283,204,151,154,204,0,0,0, 0,0,0,147,199,148,0,0,0,0,0,0,0,0,0,0, 144,144,144,147,199,148,144,144,144,144,144,144,144,0,0,0, 157,157,157,147,199,148,157,243,157,157,157,157,157,0,0,0, -254,255,157,147,199,148,157,256,257,157,252,253,157,0,0,0 +254,255,157,147,199,148,157,256,257,157,149,152,157,0,0,0 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29, @@ -633,9 +504,9 @@ 29,29,29,29,0,0,0,0,0,0,0,0,157,157,260,157, 29,29,29,29,0,0,144,144,144,144,144,144,157,157,260,157, 29,29,29,29,0,0,157,167,157,157,157,157,157,157,260,157, -29,29,29,29,0,0,157,180,157,252,253,157,157,157,260,157, -29,29,29,29,0,0,157,193,157,265,266,157,157,157,260,157, -6,29,29,29,0,0,204,204,204,278,279,204,272,157,260,157, +29,29,29,29,0,0,157,180,157,149,152,157,157,157,260,157, +29,29,29,29,0,0,157,193,157,150,153,157,157,157,260,157, +6,29,29,29,0,0,204,204,204,151,154,204,272,157,260,157, 29,29,29,29,0,0,0,0,0,0,0,0,0,157,260,157, 29,29,29,29,0,0,144,144,144,144,144,144,144,157,260,157, 29,29,29,29,0,0,157,157,157,157,157,157,157,219,220,221, @@ -657,15 +528,15 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 157,157,157,157,157,157,157,157,243,157,157,209,210,211,212,157, -157,252,253,157,157,258,157,157,256,257,157,222,223,224,225,157, -218,265,266,157,157,271,157,157,269,270,157,235,236,237,238,157, -231,278,279,204,204,284,204,204,282,283,204,204,204,204,204,204, +157,149,152,157,157,258,157,157,256,257,157,222,223,224,225,157, +218,150,153,157,157,271,157,157,269,270,157,235,236,237,238,157, +231,151,154,204,204,284,204,204,282,283,204,204,204,204,204,204, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -237,238,157,157,265,266,157,250,251,157,157,271,157,157,157,157, -204,204,204,204,278,279,204,239,240,204,204,284,204,204,204,204, +237,238,157,157,150,153,157,250,251,157,157,271,157,157,157,157, +204,204,204,204,151,154,204,239,240,204,204,284,204,204,204,204, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 157,157,157,157,157,157,157,157,157,243,157,157,209,210,211,212, @@ -682,26 +553,26 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -267,268,157,147,199,148,157,269,270,157,265,266,218,0,0,0, -280,281,204,160,200,161,204,282,283,204,278,279,231,0,0,0, +267,268,157,147,199,148,157,269,270,157,150,153,218,0,0,0, +280,281,204,160,200,161,204,282,283,204,151,154,231,0,0,0, 0,0,0,147,199,148,0,0,0,0,0,0,0,0,0,0, 144,144,144,147,199,148,144,144,144,144,144,144,144,0,0,0, 157,157,157,147,199,148,157,157,157,157,157,157,157,0,0,0, -157,157,157,147,199,148,157,157,157,157,252,253,157,0,0,0, -157,157,157,147,199,148,157,217,157,157,265,266,157,0,0,0, -204,204,204,160,200,161,204,230,204,204,278,279,204,0,0,0, +157,157,157,147,199,148,157,157,157,157,149,152,157,0,0,0, +157,157,157,147,199,148,157,217,157,157,150,153,157,0,0,0, +204,204,204,160,200,161,204,230,204,204,151,154,204,0,0,0, 0,0,0,147,199,148,0,0,0,0,0,0,0,0,0,0, 144,144,144,147,199,148,144,144,144,144,144,144,144,0,0,0, 157,157,159,160,200,161,162,157,157,157,157,157,157,0,0,0, -157,171,172,173,199,174,175,176,157,157,252,253,157,0,0,0, -183,184,185,186,199,187,188,189,190,157,265,266,157,0,0,0, -196,197,198,199,199,200,201,202,203,204,278,279,204,0,0,0, +157,171,172,173,199,174,175,176,157,157,149,152,157,0,0,0, +183,184,185,186,199,187,188,189,190,157,150,153,157,0,0,0, +196,197,198,199,199,200,201,202,203,204,151,154,204,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - + @@ -756,4 +627,16 @@ + + + + + + + + + + + + diff --git a/DangerousD/GameCore/GameObjects/Entities/Door.cs b/DangerousD/GameCore/GameObjects/Entities/Door.cs index 0e21692..9c8afe6 100644 --- a/DangerousD/GameCore/GameObjects/Entities/Door.cs +++ b/DangerousD/GameCore/GameObjects/Entities/Door.cs @@ -6,21 +6,34 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Microsoft.Xna.Framework.Graphics; namespace DangerousD.GameCore.GameObjects.Entities { public class Door : Entity { - public Door(Vector2 position) : base(position) + private Rectangle _sourceRectangle; + + public Door(Vector2 position, Vector2 size, Rectangle sourceRectangle) : base(position) { + _sourceRectangle = sourceRectangle; + Width = (int)size.X; + Height = (int)size.Y; } - protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "SilasBallMove" }, "SilasBallMove"); + protected override GraphicsComponent GraphicsComponent { get; } = new("doors"); + public override void Update(GameTime gameTime) { base.Update(gameTime); } + + public override void Draw(SpriteBatch spriteBatch) + { + GraphicsComponent.DrawAnimation(Rectangle, spriteBatch, _sourceRectangle); + //spriteBatch.Draw(debugTexture, new Rectangle(Rectangle.X - GraphicsComponent.CameraPosition.X, Rectangle.Y - GraphicsComponent.CameraPosition.Y, Rectangle.Width, Rectangle.Height), Color.White); + } public override void OnCollision(GameObject gameObject) { base.OnCollision(gameObject); diff --git a/DangerousD/GameCore/GameObjects/Entities/Items/Coin.cs b/DangerousD/GameCore/GameObjects/Entities/Items/Coin.cs new file mode 100644 index 0000000..a42900e --- /dev/null +++ b/DangerousD/GameCore/GameObjects/Entities/Items/Coin.cs @@ -0,0 +1,13 @@ +using DangerousD.GameCore.Graphics; +using Microsoft.Xna.Framework; + +namespace DangerousD.GameCore.GameObjects.Entities.Items; + +public class Coin : Entity +{ + public Coin(Vector2 position) : base(position) + { + } + + protected override GraphicsComponent GraphicsComponent { get; } +} \ No newline at end of file diff --git a/DangerousD/GameCore/GameObjects/Entities/Items/Diamond.cs b/DangerousD/GameCore/GameObjects/Entities/Items/Diamond.cs new file mode 100644 index 0000000..7f81c6b --- /dev/null +++ b/DangerousD/GameCore/GameObjects/Entities/Items/Diamond.cs @@ -0,0 +1,13 @@ +using DangerousD.GameCore.Graphics; +using Microsoft.Xna.Framework; + +namespace DangerousD.GameCore.GameObjects.Entities.Items; + +public class Diamond : Entity +{ + public Diamond(Vector2 position) : base(position) + { + } + + protected override GraphicsComponent GraphicsComponent { get; } +} \ No newline at end of file diff --git a/DangerousD/GameCore/Managers/MapManager.cs b/DangerousD/GameCore/Managers/MapManager.cs index 6ab49b0..d45d53d 100644 --- a/DangerousD/GameCore/Managers/MapManager.cs +++ b/DangerousD/GameCore/Managers/MapManager.cs @@ -9,15 +9,18 @@ using Microsoft.Xna.Framework.Graphics; using System.Xml.Serialization; using DangerousD.GameCore.GameObjects; using System.Globalization; +using System.IO; +using DangerousD.GameCore.GameObjects.Entities; using DangerousD.GameCore.GameObjects.LivingEntities; namespace DangerousD.GameCore.Managers { public class MapManager { - private int _columns; + private int _scale; - + private int _columns; + public MapManager(int scale) { _scale = scale; @@ -78,6 +81,7 @@ namespace DangerousD.GameCore.Managers private void LoadTilesData() { + XmlDocument xml = new(); xml.Load($"../../../Content/map.tsx"); XmlNode root = xml.DocumentElement; @@ -102,6 +106,11 @@ namespace DangerousD.GameCore.Managers { inst = (Entity)Activator.CreateInstance(type, pos, false); } + else if (type.Equals(typeof(Door))) + { + int gid = entity.Attributes["type"] is not null ? int.Parse(entity.Attributes["type"].Value) : 0; + inst = (Entity)Activator.CreateInstance(type, pos, new Vector2(32, 48), new Rectangle(0, 0, 32, 48)); + } else { inst = (Entity)Activator.CreateInstance(type, pos); From a0de50ba70c4f3fe49613b802e1ec76f18f86eef Mon Sep 17 00:00:00 2001 From: Timofey06 Date: Fri, 18 Aug 2023 11:39:01 +0300 Subject: [PATCH 2/3] Fix --- DangerousD/GameCore/Managers/PhysicsManager.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/DangerousD/GameCore/Managers/PhysicsManager.cs b/DangerousD/GameCore/Managers/PhysicsManager.cs index dee4c27..4e8216e 100644 --- a/DangerousD/GameCore/Managers/PhysicsManager.cs +++ b/DangerousD/GameCore/Managers/PhysicsManager.cs @@ -142,14 +142,18 @@ namespace DangerousD.GameCore.Managers } private void CheckCollisionsE_LE(List entities, List livingEntities) { - foreach (var entity in entities) + for (int i = 0; i < entities.Count; i++) { - foreach (var livingEntity in livingEntities) + + + for (int j = 0; j < livingEntities.Count; j++) { - if (livingEntity.Rectangle.Intersects(entity.Rectangle)) + + + if (livingEntities[j].Rectangle.Intersects(entities[i].Rectangle)) { - livingEntity.OnCollision(entity); - entity.OnCollision(livingEntity); + livingEntities[j].OnCollision(entities[i]); + entities[i].OnCollision(livingEntities[j]); } } } From bf04d373b9279ac28f9a3b00e66b938129240c17 Mon Sep 17 00:00:00 2001 From: Mootfrost777 Date: Fri, 18 Aug 2023 11:47:24 +0300 Subject: [PATCH 3/3] Door fix --- DangerousD/Content/lvl.tmx | 33 +++++++++++++--------- DangerousD/GameCore/Managers/MapManager.cs | 4 +-- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/DangerousD/Content/lvl.tmx b/DangerousD/Content/lvl.tmx index b26fa01..df88666 100644 --- a/DangerousD/Content/lvl.tmx +++ b/DangerousD/Content/lvl.tmx @@ -1,8 +1,13 @@ - - - - + + + + + + + + + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -32,13 +37,13 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,272,0,272,0,0,0,0,0,0,0,0,0,0, 52,52,52,52,0,52,52,52,52,52,52,52,52,52,52,52, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +272,0,0,0,0,0,0,0,272,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -136,13 +141,13 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,272,0,0,0,0,0,272,0,0,0,0,0,0,0,0, 52,52,0,0,0,0,0,52,52,52,52,52,52,52,52,52, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,272,0,0,0,0,0,0,0,0,0,0,0,0,0, 52,52,52,0,0,0,52,52,52,52,52,52,52,52,52,52, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -414,13 +419,13 @@ 29,29,29,29,0,0,157,157,167,157,157,157,157,157,260,157, 29,29,29,29,0,0,157,157,180,157,254,255,157,157,260,157, 29,29,29,29,0,0,157,157,193,157,267,268,157,157,260,157, -29,29,29,29,0,0,204,204,204,204,280,281,204,272,260,272, +29,29,29,29,0,0,204,204,204,204,280,281,204,0,260,0, 29,29,29,29,0,0,147,199,148,0,0,0,0,0,260,0, 29,29,29,29,0,0,147,199,148,144,144,144,144,144,260,144, 29,29,29,29,0,0,147,199,148,157,157,157,157,157,260,157, 29,29,29,29,0,0,147,199,148,157,157,157,157,157,260,157, 29,29,29,29,0,0,147,199,148,157,157,157,157,157,260,157, -29,29,29,29,0,0,147,199,148,204,272,157,157,157,260,157, +29,29,29,29,0,0,147,199,148,204,0,157,157,157,260,157, 29,29,29,29,0,0,147,199,148,0,0,157,157,157,260,157, 29,29,29,29,0,0,147,199,148,144,144,157,157,157,260,157, 29,29,29,29,0,0,147,199,148,157,157,157,157,157,260,157, @@ -438,7 +443,7 @@ 157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157, 157,157,157,157,157,157,258,157,157,157,149,152,157,157,157,157, 157,157,157,157,157,157,271,157,157,157,150,153,157,696,697,157, -157,157,272,204,204,204,284,204,204,204,151,154,204,709,710,204, +157,157,0,204,204,204,284,204,204,204,151,154,204,709,710,204, 157,157,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 157,157,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 157,157,157,157,157,157,157,157,157,157,157,167,157,157,209,210, @@ -500,13 +505,13 @@ 29,29,29,29,0,0,147,199,148,157,157,157,157,157,260,157, -29,29,29,29,0,0,160,200,161,204,204,272,157,157,260,157, +29,29,29,29,0,0,160,200,161,204,204,0,157,157,260,157, 29,29,29,29,0,0,0,0,0,0,0,0,157,157,260,157, 29,29,29,29,0,0,144,144,144,144,144,144,157,157,260,157, 29,29,29,29,0,0,157,167,157,157,157,157,157,157,260,157, 29,29,29,29,0,0,157,180,157,149,152,157,157,157,260,157, 29,29,29,29,0,0,157,193,157,150,153,157,157,157,260,157, -6,29,29,29,0,0,204,204,204,151,154,204,272,157,260,157, +6,29,29,29,0,0,204,204,204,151,154,204,0,157,260,157, 29,29,29,29,0,0,0,0,0,0,0,0,0,157,260,157, 29,29,29,29,0,0,144,144,144,144,144,144,144,157,260,157, 29,29,29,29,0,0,157,157,157,157,157,157,157,219,220,221, @@ -518,7 +523,7 @@ 157,157,157,157,267,268,157,696,697,157,157,193,157,157,235,236, -157,272,204,204,280,281,204,709,710,204,204,204,204,204,204,204, +157,0,204,204,280,281,204,709,710,204,204,204,204,204,204,204, 157,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 157,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, 157,157,157,178,179,157,157,157,157,157,157,157,157,157,157,157, diff --git a/DangerousD/GameCore/Managers/MapManager.cs b/DangerousD/GameCore/Managers/MapManager.cs index d45d53d..9087d97 100644 --- a/DangerousD/GameCore/Managers/MapManager.cs +++ b/DangerousD/GameCore/Managers/MapManager.cs @@ -108,8 +108,8 @@ namespace DangerousD.GameCore.Managers } else if (type.Equals(typeof(Door))) { - int gid = entity.Attributes["type"] is not null ? int.Parse(entity.Attributes["type"].Value) : 0; - inst = (Entity)Activator.CreateInstance(type, pos, new Vector2(32, 48), new Rectangle(0, 0, 32, 48)); + int gid = entity.Attributes["gid"] is not null ? int.Parse(entity.Attributes["gid"].Value) : 0; + inst = (Entity)Activator.CreateInstance(type, pos, new Vector2(32, 48), new Rectangle((gid - 872)*32, 0, 32, 48)); } else {