Debug rects: pull in top & left sides by a 1-pixel margin.
GitOrigin-RevId: 0f1f846e3f9251699917c43241efe73d6ba74849
This commit is contained in:
parent
a0ea63f96b
commit
74b5e1ec2d
@ -66,10 +66,11 @@ namespace SemiColinGames {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void AddRect(Rectangle rect, Color color) {
|
public static void AddRect(Rectangle rect, Color color) {
|
||||||
AddLine(rect.Left, rect.Top, rect.Right, rect.Top, color);
|
AddLine(rect.Left, rect.Top + 1, rect.Right, rect.Top + 1, color);
|
||||||
AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom, color);
|
AddLine(rect.Left + 1, rect.Top + 1, rect.Left + 1, rect.Bottom, color);
|
||||||
AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom, color);
|
AddLine(rect.Right, rect.Top + 1, rect.Right, rect.Bottom, color);
|
||||||
AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top, color);
|
AddLine(rect.Left + 1, rect.Bottom, rect.Right, rect.Bottom, color);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddRect(AABB box, Color color) {
|
public static void AddRect(AABB box, Color color) {
|
||||||
|
@ -66,7 +66,7 @@ namespace SemiColinGames {
|
|||||||
new Vector2(halfSize.X + Math.Abs(movement.X) + 1, halfSize.Y + Math.Abs(movement.Y) + 1));
|
new Vector2(halfSize.X + Math.Abs(movement.X) + 1, halfSize.Y + Math.Abs(movement.Y) + 1));
|
||||||
foreach (var box in collisionTargets) {
|
foreach (var box in collisionTargets) {
|
||||||
if (box.Intersect(largeBox) != null) {
|
if (box.Intersect(largeBox) != null) {
|
||||||
// Debug.AddRect(box, Color.Green);
|
Debug.AddRect(box, Color.Green);
|
||||||
candidates.Add(box);
|
candidates.Add(box);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ namespace SemiColinGames {
|
|||||||
if (standingOnGround) {
|
if (standingOnGround) {
|
||||||
jumps = 1;
|
jumps = 1;
|
||||||
ySpeed = -0.0001f;
|
ySpeed = -0.0001f;
|
||||||
// Debug.AddRect(Box(position), Color.Cyan);
|
Debug.AddRect(Box(position), Color.Cyan);
|
||||||
double jumpElapsed = Clock.ModelTime.TotalSeconds - jumpTime;
|
double jumpElapsed = Clock.ModelTime.TotalSeconds - jumpTime;
|
||||||
if (jumpElapsed > 0.2) {
|
if (jumpElapsed > 0.2) {
|
||||||
Debug.WriteLine("jump time: " + jumpElapsed);
|
Debug.WriteLine("jump time: " + jumpElapsed);
|
||||||
@ -125,7 +125,7 @@ namespace SemiColinGames {
|
|||||||
jumpTime = Clock.ModelTime.TotalSeconds;
|
jumpTime = Clock.ModelTime.TotalSeconds;
|
||||||
} else {
|
} else {
|
||||||
jumps = 0;
|
jumps = 0;
|
||||||
// Debug.AddRect(Box(position), Color.Orange);
|
Debug.AddRect(Box(position), Color.Orange);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (movement.X > 0) {
|
if (movement.X > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user