Add MapObjects
This commit is contained in:
parent
13a6f05475
commit
d0b09baca0
20 changed files with 141 additions and 76 deletions
|
@ -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
|
||||
|
|
14
DangerousD/Content/lvl1.tmx
Normal file
14
DangerousD/Content/lvl1.tmx
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="left-up" width="1000" height="1000" tilewidth="16" tileheight="16" infinite="1" nextlayerid="2" nextobjectid="1">
|
||||
<tileset firstgid="1" source="map.tsx"/>
|
||||
<layer id="1" name="Слой тайлов 1" width="1000" height="1000">
|
||||
<data encoding="base64" compression="zlib">
|
||||
<chunk x="0" y="-16" width="16" height="16">
|
||||
eJxjYBgFo2AUDFVgxkgZBgB40ANx
|
||||
</chunk>
|
||||
<chunk x="0" y="0" width="16" height="16">
|
||||
eJzzY2RgMKMAj4JRMAqGLgAAvZMDiQ==
|
||||
</chunk>
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
4
DangerousD/Content/map.tsx
Normal file
4
DangerousD/Content/map.tsx
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tileset version="1.10" tiledversion="1.10.2" name="map" tilewidth="16" tileheight="16" tilecount="871" columns="13">
|
||||
<image source="tiles.BMP" width="208" height="1072"/>
|
||||
</tileset>
|
Binary file not shown.
BIN
DangerousD/Content/references/MonoGame.Extended.Graphics.dll
Normal file
BIN
DangerousD/Content/references/MonoGame.Extended.Graphics.dll
Normal file
Binary file not shown.
BIN
DangerousD/Content/references/MonoGame.Extended.Tiled.dll
Normal file
BIN
DangerousD/Content/references/MonoGame.Extended.Tiled.dll
Normal file
Binary file not shown.
BIN
DangerousD/Content/references/MonoGame.Extended.dll
Normal file
BIN
DangerousD/Content/references/MonoGame.Extended.dll
Normal file
Binary file not shown.
BIN
DangerousD/Content/references/Newtonsoft.Json.dll
Normal file
BIN
DangerousD/Content/references/Newtonsoft.Json.dll
Normal file
Binary file not shown.
BIN
DangerousD/Content/tiles.BMP
Normal file
BIN
DangerousD/Content/tiles.BMP
Normal file
Binary file not shown.
After Width: | Height: | Size: 653 KiB |
|
@ -19,6 +19,9 @@
|
|||
<EmbeddedResource Include="Icon.bmp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MonoGame.Extended" Version="3.9.0-alpha0094" />
|
||||
<PackageReference Include="MonoGame.Extended.Content.Pipeline" Version="3.9.0-alpha0094" />
|
||||
<PackageReference Include="MonoGame.Extended.Tiled" Version="3.9.0-alpha0094" />
|
||||
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" />
|
||||
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.1.303" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
|
|
16
DangerousD/Desktop/DangerousD map/map_0.mgcontent
Normal file
16
DangerousD/Desktop/DangerousD map/map_0.mgcontent
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PipelineBuildEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SourceFile>C:/Users/Semejkin_AV/Desktop/DangerousD map/map.tsx</SourceFile>
|
||||
<SourceTime>2023-08-16T13:04:13.796245+03:00</SourceTime>
|
||||
<DestFile>C:/Users/Semejkin_AV/Documents/Github_repos/DangerousD/DangerousD/Content/bin/DesktopGL/Content/../../../../../Desktop/DangerousD map/map_0.xnb</DestFile>
|
||||
<DestTime>2023-08-16T15:38:41.8125207+03:00</DestTime>
|
||||
<Importer>TiledMapTilesetImporter</Importer>
|
||||
<ImporterTime>2023-07-14T20:14:40+03:00</ImporterTime>
|
||||
<Processor>TiledMapTilesetProcessor</Processor>
|
||||
<ProcessorTime>2023-07-14T20:14:40+03:00</ProcessorTime>
|
||||
<Dependencies />
|
||||
<BuildAsset>
|
||||
<string>C:/Users/Semejkin_AV/Documents/Github_repos/DangerousD/DangerousD/Content/bin/DesktopGL/Content/../../../../../Desktop/DangerousD map/tiles_0.xnb</string>
|
||||
</BuildAsset>
|
||||
<BuildOutput />
|
||||
</PipelineBuildEvent>
|
22
DangerousD/Desktop/DangerousD map/tiles_0.mgcontent
Normal file
22
DangerousD/Desktop/DangerousD map/tiles_0.mgcontent
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PipelineBuildEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SourceFile>C:/Users/Semejkin_AV/Desktop/DangerousD map/tiles.BMP</SourceFile>
|
||||
<SourceTime>2023-08-16T12:47:16.3453923+03:00</SourceTime>
|
||||
<DestFile>C:/Users/Semejkin_AV/Documents/Github_repos/DangerousD/DangerousD/Content/bin/DesktopGL/Content/../../../../../Desktop/DangerousD map/tiles_0.xnb</DestFile>
|
||||
<DestTime>2023-08-16T15:38:41.7865192+03:00</DestTime>
|
||||
<Importer>TextureImporter</Importer>
|
||||
<ImporterTime>2022-07-26T14:44:56+03:00</ImporterTime>
|
||||
<Processor>TextureProcessor</Processor>
|
||||
<ProcessorTime>2022-07-26T14:44:56+03:00</ProcessorTime>
|
||||
<Parameters>
|
||||
<Key>ColorKeyColor</Key>
|
||||
<Value>0,0,0,0</Value>
|
||||
</Parameters>
|
||||
<Parameters>
|
||||
<Key>ColorKeyEnabled</Key>
|
||||
<Value>True</Value>
|
||||
</Parameters>
|
||||
<Dependencies />
|
||||
<BuildAsset />
|
||||
<BuildOutput />
|
||||
</PipelineBuildEvent>
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
14
DangerousD/GameCore/GameObjects/MapObjects/Platform.cs
Normal file
14
DangerousD/GameCore/GameObjects/MapObjects/Platform.cs
Normal file
|
@ -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; }
|
||||
}
|
14
DangerousD/GameCore/GameObjects/MapObjects/StopTile.cs
Normal file
14
DangerousD/GameCore/GameObjects/MapObjects/StopTile.cs
Normal file
|
@ -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; }
|
||||
}
|
|
@ -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<string> { "death1", "deathbear" },"death1");
|
||||
|
||||
public TestAnimationDeath(Vector2 position) : base(position)
|
||||
{
|
||||
Width =512;
|
||||
Height = 512;
|
||||
|
||||
GraphicsComponent.StartAnimation("deathbear");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
14
DangerousD/GameCore/GameObjects/MapObjects/Tile.cs
Normal file
14
DangerousD/GameCore/GameObjects/MapObjects/Tile.cs
Normal file
|
@ -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; }
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<int> tiles = chunk.Value.Split(',').Select(int.Parse).ToList();
|
||||
for (int i = 0; i < tiles.Count; i++)
|
||||
{
|
||||
new StopTile(chunk)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateTiles(T d)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
6
NuGet.config
Normal file
6
NuGet.config
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="MonoGame.Extended" value="https://www.myget.org/F/lithiumtoast/api/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
Loading…
Add table
Reference in a new issue