Add debug level

This commit is contained in:
Mootfrost777 2023-08-18 01:05:36 +03:00
parent c786c09639
commit 2deaa74ede
2 changed files with 9 additions and 6 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="left-up" width="200" height="200" tilewidth="16" tileheight="16" infinite="1" nextlayerid="7" nextobjectid="42"> <map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="left-up" width="200" height="200" tilewidth="16" tileheight="16" infinite="1" nextlayerid="8" nextobjectid="43">
<tileset firstgid="1" source="../Documents/Github_repos/DangerousD/DangerousD/Content/map.tsx"/> <tileset firstgid="1" source="../Documents/Github_repos/DangerousD/DangerousD/Content/map.tsx"/>
<layer id="3" name="Слой тайлов 3" class="Tile" width="200" height="200"> <layer id="3" name="Слой тайлов 3" class="Tile" width="200" height="200">
<data encoding="csv"> <data encoding="csv">
@ -77,6 +77,11 @@
</chunk> </chunk>
</data> </data>
</layer> </layer>
<objectgroup id="7" name="Player" class="LivingEntities">
<object id="42" type="Player" x="236.506" y="-54.4681">
<point/>
</object>
</objectgroup>
<layer id="1" name="Collidable" class="StopTile" width="200" height="200"> <layer id="1" name="Collidable" class="StopTile" width="200" height="200">
<data encoding="csv"> <data encoding="csv">
<chunk x="-32" y="0" width="16" height="16"> <chunk x="-32" y="0" width="16" height="16">
@ -189,7 +194,7 @@
</chunk> </chunk>
</data> </data>
</layer> </layer>
<objectgroup id="6" name="Zombies" class="LivingEntity.Zombie"> <objectgroup id="6" name="Zombies" class="LivingEntities.Monsters.Zombie">
<object id="17" x="568" y="130"> <object id="17" x="568" y="130">
<point/> <point/>
</object> </object>
@ -343,9 +348,6 @@
</data> </data>
</layer> </layer>
<objectgroup id="5" name="Various enemies" class="LivingEntities.Monsters"> <objectgroup id="5" name="Various enemies" class="LivingEntities.Monsters">
<object id="3" type="Player" x="262" y="-11">
<point/>
</object>
<object id="7" type="SilasMaster" x="126" y="-25"> <object id="7" type="SilasMaster" x="126" y="-25">
<point/> <point/>
</object> </object>

View file

@ -105,7 +105,8 @@ namespace DangerousD.GameCore.Managers
float offsetY = group.Attributes["offsety"] is not null ? float.Parse(group.Attributes["offsety"].Value) : 0; float offsetY = group.Attributes["offsety"] is not null ? float.Parse(group.Attributes["offsety"].Value) : 0;
foreach (XmlNode entity in group.ChildNodes) foreach (XmlNode entity in group.ChildNodes)
{ {
string entityType = group.Attributes["type"] is not null ? "." + group.Attributes["type"].Value : ""; Debug.WriteLine(entity.Attributes["type"] is not null ? "." + entity.Attributes["type"].Value : "");
string entityType = entity.Attributes["type"] is not null ? "." + entity.Attributes["type"].Value : "";
Type type = Type.GetType($"DangerousD.GameCore.GameObjects.{entityGroup}{entityType}"); Type type = Type.GetType($"DangerousD.GameCore.GameObjects.{entityGroup}{entityType}");
Entity inst = (Entity)Activator.CreateInstance(type, new Vector2(float.Parse(entity.Attributes["x"].Value, CultureInfo.InvariantCulture) + offsetX, float.Parse(entity.Attributes["y"].Value, CultureInfo.InvariantCulture) + offsetY) * _scale); Entity inst = (Entity)Activator.CreateInstance(type, new Vector2(float.Parse(entity.Attributes["x"].Value, CultureInfo.InvariantCulture) + offsetX, float.Parse(entity.Attributes["y"].Value, CultureInfo.InvariantCulture) + offsetY) * _scale);
inst.SetPosition(new Vector2(inst.Pos.X, inst.Pos.Y - inst.Height)); inst.SetPosition(new Vector2(inst.Pos.X, inst.Pos.Y - inst.Height));