Skip to content
Snippets Groups Projects
Verified Commit d6d384ae authored by TheJoeCoder's avatar TheJoeCoder
Browse files

Add velocity debug

parent fa39a373
Branches
No related tags found
No related merge requests found
...@@ -17,6 +17,8 @@ const LINE_COLOUR = "#777"; ...@@ -17,6 +17,8 @@ const LINE_COLOUR = "#777";
const VELOCITY_SLOWDOWN_MULTIPLIER = 0.998; const VELOCITY_SLOWDOWN_MULTIPLIER = 0.998;
const VELOCITY_PUSH_MULTIPLIER = 1.8; const VELOCITY_PUSH_MULTIPLIER = 1.8;
const SHOW_VELOCITIES = true;
// ---- // ----
// Sort-of constants (change with window size) // Sort-of constants (change with window size)
...@@ -188,6 +190,15 @@ const drawConnectingLines = () => { ...@@ -188,6 +190,15 @@ const drawConnectingLines = () => {
ctx.closePath(); ctx.closePath();
}; };
const drawDebugText = () => {
for(let dot of dots) {
ctx.beginPath();
ctx.font = "15px Arial";
ctx.fillText(`${dot.vx}/${dot.vy}`,dot.x,dot.y);
ctx.closePath();
}
};
const draw = () => { const draw = () => {
// Clear the screen // Clear the screen
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, canvas.width, canvas.height);
...@@ -201,6 +212,11 @@ const draw = () => { ...@@ -201,6 +212,11 @@ const draw = () => {
// Draw connecting lines // Draw connecting lines
drawConnectingLines(); drawConnectingLines();
// Draw velocity text
if(SHOW_VELOCITIES) {
drawDebugText();
}
}; };
const physics = () => { const physics = () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment