feat: Add F3 debug mode with collision boxes and FPS display
This commit is contained in:
@@ -62,6 +62,24 @@ class Entity {
|
||||
);
|
||||
}
|
||||
|
||||
// Draw collision box in debug mode
|
||||
if (debugMode) {
|
||||
ctx.strokeStyle = '#00ff00';
|
||||
ctx.lineWidth = 1;
|
||||
ctx.strokeRect(
|
||||
-this.width/2 * PIXEL_SIZE,
|
||||
-this.height/2 * PIXEL_SIZE,
|
||||
this.width * PIXEL_SIZE,
|
||||
this.height * PIXEL_SIZE
|
||||
);
|
||||
|
||||
// Draw a dot at the entity's center
|
||||
ctx.fillStyle = '#ffff00';
|
||||
ctx.beginPath();
|
||||
ctx.arc(0, 0, 2, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user