Debug rects: pull in top & left sides by a 1-pixel margin.

GitOrigin-RevId: 0f1f846e3f9251699917c43241efe73d6ba74849
This commit is contained in:
Colin McMillen 2020-02-25 09:57:31 -05:00
parent a0ea63f96b
commit 74b5e1ec2d
2 changed files with 8 additions and 7 deletions

View File

@ -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) {

View File

@ -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) {