From 087472ddc391eb568f08d0e84c86dd4df4d63218 Mon Sep 17 00:00:00 2001 From: Timofey06 Date: Thu, 17 Aug 2023 16:48:29 +0300 Subject: [PATCH] ColisionTracerOn --- DangerousD/GameCore/GameObjects/GameObject.cs | 2 +- DangerousD/GameCore/GameObjects/MapObject.cs | 4 +++- DangerousD/GameCore/GameObjects/MapObjects/Platform.cs | 8 ++++++++ DangerousD/GameCore/GameObjects/MapObjects/StopTile.cs | 8 ++++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/DangerousD/GameCore/GameObjects/GameObject.cs b/DangerousD/GameCore/GameObjects/GameObject.cs index ae5cd2c..952e1de 100644 --- a/DangerousD/GameCore/GameObjects/GameObject.cs +++ b/DangerousD/GameCore/GameObjects/GameObject.cs @@ -55,7 +55,7 @@ namespace DangerousD.GameCore { GraphicsComponent.DrawAnimation(Rectangle, spriteBatch); //debug - // spriteBatch.Draw(debugTexture, Rectangle, Color.White); + spriteBatch.Draw(debugTexture,new Rectangle(Rectangle.X-GraphicsComponent.CameraPosition.X,Rectangle.Y-GraphicsComponent.CameraPosition.Y,Rectangle.Width,Rectangle.Height), Color.White); } } } \ No newline at end of file diff --git a/DangerousD/GameCore/GameObjects/MapObject.cs b/DangerousD/GameCore/GameObjects/MapObject.cs index 654103d..02576ef 100644 --- a/DangerousD/GameCore/GameObjects/MapObject.cs +++ b/DangerousD/GameCore/GameObjects/MapObject.cs @@ -22,8 +22,10 @@ public abstract class MapObject : GameObject } - public void Draw(SpriteBatch spriteBatch) + public virtual void Draw(SpriteBatch spriteBatch) { GraphicsComponent.DrawAnimation(Rectangle, spriteBatch, _sourceRectangle); + //spriteBatch.Draw(debugTexture, new Rectangle(Rectangle.X - GraphicsComponent.CameraPosition.X, Rectangle.Y - GraphicsComponent.CameraPosition.Y, Rectangle.Width, Rectangle.Height), Color.White); + } } \ No newline at end of file diff --git a/DangerousD/GameCore/GameObjects/MapObjects/Platform.cs b/DangerousD/GameCore/GameObjects/MapObjects/Platform.cs index 12d7813..fc14c79 100644 --- a/DangerousD/GameCore/GameObjects/MapObjects/Platform.cs +++ b/DangerousD/GameCore/GameObjects/MapObjects/Platform.cs @@ -1,5 +1,6 @@ using DangerousD.GameCore.Graphics; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace DangerousD.GameCore.GameObjects.MapObjects; @@ -9,5 +10,12 @@ public class Platform : MapObject public Platform(Vector2 position, Vector2 size, Rectangle sourceRectangle) : base(position, size, sourceRectangle) { } + public override void Draw(SpriteBatch spriteBatch) + { + base.Draw(spriteBatch); + //debug + spriteBatch.Draw(debugTexture, new Rectangle(Rectangle.X - GraphicsComponent.CameraPosition.X, Rectangle.Y - GraphicsComponent.CameraPosition.Y, Rectangle.Width, Rectangle.Height), Color.White); + + } } \ No newline at end of file diff --git a/DangerousD/GameCore/GameObjects/MapObjects/StopTile.cs b/DangerousD/GameCore/GameObjects/MapObjects/StopTile.cs index 6b77cc9..ab4f6d4 100644 --- a/DangerousD/GameCore/GameObjects/MapObjects/StopTile.cs +++ b/DangerousD/GameCore/GameObjects/MapObjects/StopTile.cs @@ -1,5 +1,6 @@ using DangerousD.GameCore.Graphics; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace DangerousD.GameCore.GameObjects.MapObjects; @@ -9,4 +10,11 @@ public class StopTile : MapObject public StopTile(Vector2 position, Vector2 size, Rectangle sourceRectangle) : base(position, size, sourceRectangle) { } + public override void Draw(SpriteBatch spriteBatch) + { + base.Draw(spriteBatch); + //debug + spriteBatch.Draw(debugTexture, new Rectangle(Rectangle.X - GraphicsComponent.CameraPosition.X, Rectangle.Y - GraphicsComponent.CameraPosition.Y, Rectangle.Width, Rectangle.Height), Color.White); + + } } \ No newline at end of file