From 9c9b2b035e46f4cf7db443cfba7ae793b9c4a70d Mon Sep 17 00:00:00 2001 From: Mootfrost777 Date: Fri, 18 Aug 2023 01:36:16 +0300 Subject: [PATCH] Main map convert to new format --- DangerousD/Content/lvl.tmx | 10 +++++----- .../GameObjects/LivingEntities/Monsters/SilasHands.cs | 2 +- .../GameObjects/LivingEntities/Player/Player.cs | 11 +++++++---- DangerousD/GameCore/Managers/AppManager.cs | 2 +- DangerousD/GameCore/Managers/MapManager.cs | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/DangerousD/Content/lvl.tmx b/DangerousD/Content/lvl.tmx index d643830..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, @@ -311,7 +311,7 @@ - + 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, @@ -517,7 +517,7 @@ - + 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29, @@ -701,7 +701,7 @@ - + diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasHands.cs index 16c06e1..a250868 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 43e191f..4e0b0cc 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs @@ -25,10 +25,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities public int leftBorder; public bool isVisible = true; private bool isAttacked = false; - public bool isInvincible; + public bool isInvincible = false; public GameObject objectAttack; - public Player(Vector2 position, bool isInvincible = false) : base(position) + public Player(Vector2 position) : base(position) { Width = 16; Height = 32; @@ -41,8 +41,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities velocity = new Vector2(0, 0); rightBorder = (int)position.X + 100; leftBorder = (int)position.X - 100; - this.isInvincible = isInvincible; + } + public Player(Vector2 position, bool isInvincible = false) : this(position) + { + this.isInvincible = isInvincible; } public bool IsAlive { get { return isAlive; } } @@ -127,7 +130,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities if (GraphicsComponent.GetCurrentAnimation != "playerMoveLeft") { GraphicsComponent.StartAnimation("playerMoveLeft"); - } + } } else if(AppManager.Instance.InputManager.VectorMovementDirection.X == 0)//стоит { diff --git a/DangerousD/GameCore/Managers/AppManager.cs b/DangerousD/GameCore/Managers/AppManager.cs index cd8bfe4..5e53677 100644 --- a/DangerousD/GameCore/Managers/AppManager.cs +++ b/DangerousD/GameCore/Managers/AppManager.cs @@ -202,7 +202,7 @@ namespace DangerousD.GameCore case GameState.Lobby: break; case GameState.Game: - GameManager.mapManager.LoadLevel("debug"); + GameManager.mapManager.LoadLevel("lvl"); break; case GameState.Death: break; diff --git a/DangerousD/GameCore/Managers/MapManager.cs b/DangerousD/GameCore/Managers/MapManager.cs index a8e1239..fd23e3c 100644 --- a/DangerousD/GameCore/Managers/MapManager.cs +++ b/DangerousD/GameCore/Managers/MapManager.cs @@ -98,7 +98,7 @@ namespace DangerousD.GameCore.Managers 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"].Value == "DEBUGUS") + if (type.Equals(typeof(Player)) && entity.Attributes["name"] is not null && entity.Attributes["name"].Value == "DEBUGUS") { inst = (Entity)Activator.CreateInstance(type, pos, true); }