diff --git a/DangerousD/Content/Content.mgcb b/DangerousD/Content/Content.mgcb index 8d94070..70c3dd0 100644 --- a/DangerousD/Content/Content.mgcb +++ b/DangerousD/Content/Content.mgcb @@ -10,6 +10,7 @@ #-------------------------------- References --------------------------------# +/reference:references/MonoGame.Extended.Content.Pipeline.dll #---------------------------------- Content ---------------------------------# @@ -70,6 +71,11 @@ /processorParam:TextureFormat=Color /build:PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png +#begin sus.tmx +/importer:TiledMapImporter +/processor:TiledMapProcessor +/build:sus.tmx + #begin wall.jpg /importer:TextureImporter /processor:TextureProcessor diff --git a/DangerousD/Content/lvl1.tmx b/DangerousD/Content/lvl1.tmx new file mode 100644 index 0000000..6909dd5 --- /dev/null +++ b/DangerousD/Content/lvl1.tmx @@ -0,0 +1,14 @@ + + + + + + + eJxjYBgFo2AUDFVgxkgZBgB40ANx + + + eJzzY2RgMKMAj4JRMAqGLgAAvZMDiQ== + + + + diff --git a/DangerousD/Content/map.tsx b/DangerousD/Content/map.tsx new file mode 100644 index 0000000..288bb53 --- /dev/null +++ b/DangerousD/Content/map.tsx @@ -0,0 +1,4 @@ + + + + diff --git a/DangerousD/Content/references/MonoGame.Extended.Content.Pipeline.dll b/DangerousD/Content/references/MonoGame.Extended.Content.Pipeline.dll new file mode 100644 index 0000000..230a912 Binary files /dev/null and b/DangerousD/Content/references/MonoGame.Extended.Content.Pipeline.dll differ diff --git a/DangerousD/Content/references/MonoGame.Extended.Graphics.dll b/DangerousD/Content/references/MonoGame.Extended.Graphics.dll new file mode 100644 index 0000000..0460327 Binary files /dev/null and b/DangerousD/Content/references/MonoGame.Extended.Graphics.dll differ diff --git a/DangerousD/Content/references/MonoGame.Extended.Tiled.dll b/DangerousD/Content/references/MonoGame.Extended.Tiled.dll new file mode 100644 index 0000000..dd72fb2 Binary files /dev/null and b/DangerousD/Content/references/MonoGame.Extended.Tiled.dll differ diff --git a/DangerousD/Content/references/MonoGame.Extended.dll b/DangerousD/Content/references/MonoGame.Extended.dll new file mode 100644 index 0000000..d4e7679 Binary files /dev/null and b/DangerousD/Content/references/MonoGame.Extended.dll differ diff --git a/DangerousD/Content/references/Newtonsoft.Json.dll b/DangerousD/Content/references/Newtonsoft.Json.dll new file mode 100644 index 0000000..b501fb6 Binary files /dev/null and b/DangerousD/Content/references/Newtonsoft.Json.dll differ diff --git a/DangerousD/Content/tiles.BMP b/DangerousD/Content/tiles.BMP new file mode 100644 index 0000000..a9709a0 Binary files /dev/null and b/DangerousD/Content/tiles.BMP differ diff --git a/DangerousD/DangerousD.csproj b/DangerousD/DangerousD.csproj index 99e6800..725d7c1 100644 --- a/DangerousD/DangerousD.csproj +++ b/DangerousD/DangerousD.csproj @@ -19,6 +19,9 @@ + + + diff --git a/DangerousD/Desktop/DangerousD map/map_0.mgcontent b/DangerousD/Desktop/DangerousD map/map_0.mgcontent new file mode 100644 index 0000000..acc2649 --- /dev/null +++ b/DangerousD/Desktop/DangerousD map/map_0.mgcontent @@ -0,0 +1,16 @@ + + + C:/Users/Semejkin_AV/Desktop/DangerousD map/map.tsx + 2023-08-16T13:04:13.796245+03:00 + C:/Users/Semejkin_AV/Documents/Github_repos/DangerousD/DangerousD/Content/bin/DesktopGL/Content/../../../../../Desktop/DangerousD map/map_0.xnb + 2023-08-16T15:38:41.8125207+03:00 + TiledMapTilesetImporter + 2023-07-14T20:14:40+03:00 + TiledMapTilesetProcessor + 2023-07-14T20:14:40+03:00 + + + C:/Users/Semejkin_AV/Documents/Github_repos/DangerousD/DangerousD/Content/bin/DesktopGL/Content/../../../../../Desktop/DangerousD map/tiles_0.xnb + + + \ No newline at end of file diff --git a/DangerousD/Desktop/DangerousD map/tiles_0.mgcontent b/DangerousD/Desktop/DangerousD map/tiles_0.mgcontent new file mode 100644 index 0000000..4cfff75 --- /dev/null +++ b/DangerousD/Desktop/DangerousD map/tiles_0.mgcontent @@ -0,0 +1,22 @@ + + + C:/Users/Semejkin_AV/Desktop/DangerousD map/tiles.BMP + 2023-08-16T12:47:16.3453923+03:00 + C:/Users/Semejkin_AV/Documents/Github_repos/DangerousD/DangerousD/Content/bin/DesktopGL/Content/../../../../../Desktop/DangerousD map/tiles_0.xnb + 2023-08-16T15:38:41.7865192+03:00 + TextureImporter + 2022-07-26T14:44:56+03:00 + TextureProcessor + 2022-07-26T14:44:56+03:00 + + ColorKeyColor + 0,0,0,0 + + + ColorKeyEnabled + True + + + + + \ No newline at end of file diff --git a/DangerousD/GameCore/GameObjects/MapObjects/GrassBlock.cs b/DangerousD/GameCore/GameObjects/MapObjects/GrassBlock.cs deleted file mode 100644 index 3ada6f5..0000000 --- a/DangerousD/GameCore/GameObjects/MapObjects/GrassBlock.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using DangerousD.GameCore.Graphics; - -namespace DangerousD.GameCore.GameObjects.MapObjects -{ - internal class GrassBlock : MapObject - { - protected override GraphicsComponent GraphicsComponent { get; } = new("wall"); - - public GrassBlock(Vector2 position) : base(position) - { - Width = 32; - Height = 32; - } - } -} diff --git a/DangerousD/GameCore/GameObjects/MapObjects/Platform.cs b/DangerousD/GameCore/GameObjects/MapObjects/Platform.cs new file mode 100644 index 0000000..2739422 --- /dev/null +++ b/DangerousD/GameCore/GameObjects/MapObjects/Platform.cs @@ -0,0 +1,14 @@ +using DangerousD.GameCore.Graphics; +using Microsoft.Xna.Framework; + +namespace DangerousD.GameCore.GameObjects.MapObjects; + +public class Platform : MapObject +{ + public Platform(Vector2 position, string texture) : base(position) + { + IsColliderOn = true; + } + + protected override GraphicsComponent GraphicsComponent { get; } +} \ No newline at end of file diff --git a/DangerousD/GameCore/GameObjects/MapObjects/StopTile.cs b/DangerousD/GameCore/GameObjects/MapObjects/StopTile.cs new file mode 100644 index 0000000..9032ed3 --- /dev/null +++ b/DangerousD/GameCore/GameObjects/MapObjects/StopTile.cs @@ -0,0 +1,14 @@ +using DangerousD.GameCore.Graphics; +using Microsoft.Xna.Framework; + +namespace DangerousD.GameCore.GameObjects.MapObjects; + +public class StopTile : MapObject +{ + public StopTile(Vector2 position) : base(position) + { + IsColliderOn = true; + } + + protected override GraphicsComponent GraphicsComponent { get; } +} \ No newline at end of file diff --git a/DangerousD/GameCore/GameObjects/MapObjects/TestAnimationDeath.cs b/DangerousD/GameCore/GameObjects/MapObjects/TestAnimationDeath.cs deleted file mode 100644 index 8e9be4d..0000000 --- a/DangerousD/GameCore/GameObjects/MapObjects/TestAnimationDeath.cs +++ /dev/null @@ -1,25 +0,0 @@ -using DangerousD.GameCore.Graphics; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DangerousD.GameCore.GameObjects.MapObjects -{ - internal class TestAnimationDeath : Entity - { - protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "death1", "deathbear" },"death1"); - - public TestAnimationDeath(Vector2 position) : base(position) - { - Width =512; - Height = 512; - - GraphicsComponent.StartAnimation("deathbear"); - - } - } -} diff --git a/DangerousD/GameCore/GameObjects/MapObjects/Tile.cs b/DangerousD/GameCore/GameObjects/MapObjects/Tile.cs new file mode 100644 index 0000000..640dc9b --- /dev/null +++ b/DangerousD/GameCore/GameObjects/MapObjects/Tile.cs @@ -0,0 +1,14 @@ +using DangerousD.GameCore.Graphics; +using Microsoft.Xna.Framework; + +namespace DangerousD.GameCore.GameObjects.MapObjects; + +public class Tile : MapObject +{ + public Tile(Vector2 position) : base(position) + { + IsColliderOn = false; + } + + protected override GraphicsComponent GraphicsComponent { get; } +} \ No newline at end of file diff --git a/DangerousD/GameCore/Levels/Level1.cs b/DangerousD/GameCore/Levels/Level1.cs deleted file mode 100644 index 323370b..0000000 --- a/DangerousD/GameCore/Levels/Level1.cs +++ /dev/null @@ -1,25 +0,0 @@ -using DangerousD.GameCore.GameObjects.LivingEntities; -using DangerousD.GameCore.GameObjects.MapObjects; -using Microsoft.Xna.Framework; -using DangerousD.GameCore.GameObjects.LivingEntities.Monsters; - - -namespace DangerousD.GameCore.Levels -{ - public class Level1 : ILevel - { - public void InitLevel() - { - new Player(new Vector2(0,0)); - var Zombie = new Zombie(new Vector2(256, 128)); - var Frank = new Frank(new Vector2(384, 128)); - - new GrassBlock(new Vector2(0, 224)); - for (int i = 0; i < 50; i++) - { - new GrassBlock(new Vector2(i*32, 256)); - } - new GrassBlock(new Vector2(500, 224)); - } - } -} diff --git a/DangerousD/GameCore/Managers/MapManager.cs b/DangerousD/GameCore/Managers/MapManager.cs index f5c9d28..711f12e 100644 --- a/DangerousD/GameCore/Managers/MapManager.cs +++ b/DangerousD/GameCore/Managers/MapManager.cs @@ -7,20 +7,45 @@ using System.Linq; using System.Net.Security; using System.Text; using System.Threading.Tasks; +using System.Xml; +using DangerousD.GameCore.GameObjects.MapObjects; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace DangerousD.GameCore.Managers { public class MapManager { - ILevel Level; + private Texture2D _texture; public void Init() { - Level = new Level1(); } //Level public void LoadLevel(string level) { - Level.InitLevel(); + XmlDocument xml = new(); + xml.Load($"{level}.tmx"); + XmlNode mapNode = xml.DocumentElement[].SelectSingleNode("//layer[@type='collidable']"); + Vector2 tileSize = new(int.Parse(xml.DocumentElement.Attributes["tilewidth"].Value), + int.Parse(xml.DocumentElement.Attributes["tileheight"].Value)); + + foreach (XmlNode chunk in mapNode.ChildNodes) + { + Vector2 chunkSize = new(int.Parse(chunk.Attributes["width"].Value), int.Parse(chunk.Attributes["height"].Value)) + Vector2 chunkPos = new(int.Parse(chunk.Attributes["x"].Value), int.Parse(chunk.Attributes["y"].Value)); + + + List tiles = chunk.Value.Split(',').Select(int.Parse).ToList(); + for (int i = 0; i < tiles.Count; i++) + { + new StopTile(chunk) + } + } + } + + private void CreateTiles(T d) + { + } } } diff --git a/NuGet.config b/NuGet.config new file mode 100644 index 0000000..90dab50 --- /dev/null +++ b/NuGet.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file