From 74b5e1ec2dc56730909fe55a678703e1aa621057 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Tue, 25 Feb 2020 09:57:31 -0500 Subject: [PATCH] Debug rects: pull in top & left sides by a 1-pixel margin. GitOrigin-RevId: 0f1f846e3f9251699917c43241efe73d6ba74849 --- Shared/Debug.cs | 9 +++++---- Shared/Player.cs | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Shared/Debug.cs b/Shared/Debug.cs index 0bab3ed..202fa03 100644 --- a/Shared/Debug.cs +++ b/Shared/Debug.cs @@ -66,10 +66,11 @@ namespace SemiColinGames { } public static void AddRect(Rectangle rect, Color color) { - AddLine(rect.Left, rect.Top, rect.Right, rect.Top, color); - AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom, color); - AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom, color); - AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top, color); + AddLine(rect.Left, rect.Top + 1, rect.Right, rect.Top + 1, color); + AddLine(rect.Left + 1, rect.Top + 1, rect.Left + 1, rect.Bottom, color); + AddLine(rect.Right, rect.Top + 1, rect.Right, rect.Bottom, color); + AddLine(rect.Left + 1, rect.Bottom, rect.Right, rect.Bottom, color); + } public static void AddRect(AABB box, Color color) { diff --git a/Shared/Player.cs b/Shared/Player.cs index 059ca16..45bcf7b 100644 --- a/Shared/Player.cs +++ b/Shared/Player.cs @@ -66,7 +66,7 @@ namespace SemiColinGames { new Vector2(halfSize.X + Math.Abs(movement.X) + 1, halfSize.Y + Math.Abs(movement.Y) + 1)); foreach (var box in collisionTargets) { if (box.Intersect(largeBox) != null) { - // Debug.AddRect(box, Color.Green); + Debug.AddRect(box, Color.Green); candidates.Add(box); } } @@ -117,7 +117,7 @@ namespace SemiColinGames { if (standingOnGround) { jumps = 1; ySpeed = -0.0001f; - // Debug.AddRect(Box(position), Color.Cyan); + Debug.AddRect(Box(position), Color.Cyan); double jumpElapsed = Clock.ModelTime.TotalSeconds - jumpTime; if (jumpElapsed > 0.2) { Debug.WriteLine("jump time: " + jumpElapsed); @@ -125,7 +125,7 @@ namespace SemiColinGames { jumpTime = Clock.ModelTime.TotalSeconds; } else { jumps = 0; - // Debug.AddRect(Box(position), Color.Orange); + Debug.AddRect(Box(position), Color.Orange); } if (movement.X > 0) {