diff --git a/DangerousD/Content/debug.tmx b/DangerousD/Content/debug.tmx new file mode 100644 index 0000000..f52dbe7 --- /dev/null +++ b/DangerousD/Content/debug.tmx @@ -0,0 +1,373 @@ + + + + + + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570 + + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570 + + +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + + +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570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0,0,0,0,0,0,0,0,0,49,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,49,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,49,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,49,0,0,0, +49,49,49,49,49,49,49,49,49,49,49,49,49,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0 + + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370 + + +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +369,370,0,0,0,0,0,0,0,0,369,370,0,0,0,0, +382,383,0,0,0,0,0,0,0,0,382,383,0,0,0,0, +395,396,0,0,0,0,0,0,0,0,395,396,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + + +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,369,370,0,0,0,0,0,0,0,0,369,370, +0,0,0,0,382,383,0,0,0,0,0,0,0,0,382,383, +0,0,0,0,395,396,0,0,0,0,0,0,0,0,395,396, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DangerousD/Content/lvl.tmx b/DangerousD/Content/lvl.tmx index 271b1e5..5377e12 100644 --- a/DangerousD/Content/lvl.tmx +++ b/DangerousD/Content/lvl.tmx @@ -1,7 +1,7 @@ - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -130,19 +130,19 @@ 0,0,0,0,0,0,0,0,0,0,13,75,0,0,0,0 -52,0,0,0,52,0,0,0,52,52,52,52,52,52,52,52, +52,0,0,0,0,0,0,0,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, -52,52,0,0,52,0,0,52,52,52,52,52,52,52,52,52, +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, -52,52,52,0,52,0,52,52,52,52,52,52,52,52,52,52, +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, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 @@ -441,7 +441,7 @@ - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -701,7 +701,7 @@ - + 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/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs index ed4dfcb..e16f168 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs @@ -1,4 +1,4 @@ -using DangerousD.GameCore.Graphics; + using DangerousD.GameCore.Graphics; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs index 8a777be..65c5e23 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs @@ -25,6 +25,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities public int leftBorder; public bool isVisible = true; private bool isAttacked = false; + public bool isInvincible = false; public GameObject objectAttack; public Player(Vector2 position) : base(position) @@ -40,7 +41,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities velocity = new Vector2(0, 0); rightBorder = (int)position.X + 100; leftBorder = (int)position.X - 100; + } + public Player(Vector2 position, bool isInvincible = false) : this(position) + { + this.isInvincible = isInvincible; } public bool IsAlive { get { return isAlive; } } diff --git a/DangerousD/GameCore/Managers/MapManager.cs b/DangerousD/GameCore/Managers/MapManager.cs index 5d7d6fc..fd23e3c 100644 --- a/DangerousD/GameCore/Managers/MapManager.cs +++ b/DangerousD/GameCore/Managers/MapManager.cs @@ -9,6 +9,7 @@ using Microsoft.Xna.Framework.Graphics; using System.Xml.Serialization; using DangerousD.GameCore.GameObjects; using System.Globalization; +using DangerousD.GameCore.GameObjects.LivingEntities; namespace DangerousD.GameCore.Managers { @@ -70,22 +71,8 @@ namespace DangerousD.GameCore.Managers Rectangle sourceRect = new(new Point((tiles[i] -1) % _columns, (tiles[i] -1) / _columns) * tileSize.ToPoint(), tileSize.ToPoint()); Type type = Type.GetType($"DangerousD.GameCore.GameObjects.MapObjects.{tileType}"); Activator.CreateInstance(type, pos, tileSize * _scale, sourceRect); - - /*switch (tileType) - { - case "collidable": - new StopTile(pos, tileSize * _scale, sourceRect); - break; - case "platform": - new Platform(pos, tileSize * _scale, sourceRect); - break; - case "non_collidable": - new Tile(pos, tileSize * _scale, sourceRect); - break; - }*/ - } - } + } } } @@ -100,13 +87,25 @@ namespace DangerousD.GameCore.Managers private void InstantiateEntities(XmlNode group) { - string entityType = group.Attributes["class"].Value; + string entityGroup = group.Attributes["class"] is not null ? group.Attributes["class"].Value : ""; float offsetX = group.Attributes["offsetx"] is not null ? float.Parse(group.Attributes["offsetx"].Value) : 0; float offsetY = group.Attributes["offsety"] is not null ? float.Parse(group.Attributes["offsety"].Value) : 0; foreach (XmlNode entity in group.ChildNodes) { - Type type = Type.GetType($"DangerousD.GameCore.GameObjects.{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); + string entityType = entity.Attributes["type"] is not null ? "." + entity.Attributes["type"].Value : ""; + Type type = Type.GetType($"DangerousD.GameCore.GameObjects.{entityGroup}{entityType}"); + Vector2 pos = + new Vector2(float.Parse(entity.Attributes["x"].Value, CultureInfo.InvariantCulture) + offsetX, + float.Parse(entity.Attributes["y"].Value, CultureInfo.InvariantCulture) + offsetY) * _scale; + Entity inst; + if (type.Equals(typeof(Player)) && entity.Attributes["name"] is not null && entity.Attributes["name"].Value == "DEBUGUS") + { + inst = (Entity)Activator.CreateInstance(type, pos, true); + } + else + { + inst = (Entity)Activator.CreateInstance(type, pos); + } inst.SetPosition(new Vector2(inst.Pos.X, inst.Pos.Y - inst.Height)); inst.Height *= _scale; inst.Width *= _scale;