This commit is contained in:
Pierre Wessman 2025-09-16 20:57:39 +02:00
parent 14e0794aae
commit cb8d4919a7
3 changed files with 18 additions and 20 deletions

View File

@ -168,7 +168,6 @@ class GameState {
location: location, location: location,
participants: { home: null, away: null } participants: { home: null, away: null }
}; };
console.log('Faceoff state set to:', this.faceoff);
this.emit('faceoff-start', { location }); this.emit('faceoff-start', { location });
} }

View File

@ -5,7 +5,7 @@ class Puck {
this.radius = 8; this.radius = 8;
this.mass = 0.5; this.mass = 0.5;
this.restitution = 0.9; this.restitution = 0.9;
this.friction = 3; this.friction = 1;
this.lastPlayerTouch = null; this.lastPlayerTouch = null;
this.lastTeamTouch = null; this.lastTeamTouch = null;

View File

@ -56,15 +56,17 @@ class Renderer {
} }
drawRinkLines(rink) { drawRinkLines(rink) {
// Outer lines
this.ctx.strokeStyle = '#d32f2f'; this.ctx.strokeStyle = '#d32f2f';
this.ctx.lineWidth = 3; this.ctx.lineWidth = 3;
// Zone lines
this.ctx.beginPath(); this.ctx.beginPath();
this.ctx.rect(0, 0, rink.width, rink.height); this.ctx.rect(0, 0, rink.width, rink.height);
this.ctx.stroke(); this.ctx.stroke();
this.ctx.strokeStyle = '#2196f3'; this.ctx.strokeStyle = '#d32f2f';
this.ctx.lineWidth = 2; this.ctx.lineWidth = 3;
this.ctx.beginPath(); this.ctx.beginPath();
this.ctx.moveTo(rink.centerX, 0); this.ctx.moveTo(rink.centerX, 0);
@ -73,7 +75,6 @@ class Renderer {
const zoneWidth = rink.width / 3; const zoneWidth = rink.width / 3;
this.ctx.strokeStyle = '#2196f3'; this.ctx.strokeStyle = '#2196f3';
this.ctx.setLineDash([10, 5]);
this.ctx.beginPath(); this.ctx.beginPath();
this.ctx.moveTo(zoneWidth, 0); this.ctx.moveTo(zoneWidth, 0);
@ -85,11 +86,22 @@ class Renderer {
this.ctx.lineTo(rink.width - zoneWidth, rink.height); this.ctx.lineTo(rink.width - zoneWidth, rink.height);
this.ctx.stroke(); this.ctx.stroke();
this.ctx.setLineDash([]);
this.ctx.beginPath(); this.ctx.beginPath();
this.ctx.arc(rink.centerX, rink.centerY, 100, 0, Math.PI * 2); this.ctx.arc(rink.centerX, rink.centerY, 100, 0, Math.PI * 2);
this.ctx.stroke(); this.ctx.stroke();
// Goal lines
this.ctx.strokeStyle = '#d32f2f';
this.ctx.lineWidth = 3;
this.ctx.beginPath();
this.ctx.moveTo(this.goalXOffset, 0);
this.ctx.lineTo(this.goalXOffset, rink.height);
this.ctx.stroke();
this.ctx.beginPath();
this.ctx.moveTo(rink.width - this.goalXOffset, 0);
this.ctx.lineTo(rink.width - this.goalXOffset, rink.height);
this.ctx.stroke();
} }
drawGoals(rink) { drawGoals(rink) {
@ -117,19 +129,6 @@ class Renderer {
this.ctx.fillStyle = 'rgba(211, 47, 47, 0.1)'; this.ctx.fillStyle = 'rgba(211, 47, 47, 0.1)';
this.ctx.fillRect(this.goalXOffset - goalDepth, goalY - goalHeight, goalDepth, goalHeight * 2); this.ctx.fillRect(this.goalXOffset - goalDepth, goalY - goalHeight, goalDepth, goalHeight * 2);
this.ctx.fillRect(rink.width - this.goalXOffset, goalY - goalHeight, goalDepth, goalHeight * 2); this.ctx.fillRect(rink.width - this.goalXOffset, goalY - goalHeight, goalDepth, goalHeight * 2);
// Goal lines
this.ctx.strokeStyle = '#d32f2f';
this.ctx.lineWidth = 3;
this.ctx.beginPath();
this.ctx.moveTo(this.goalXOffset, 0);
this.ctx.lineTo(this.goalXOffset, rink.height);
this.ctx.stroke();
this.ctx.beginPath();
this.ctx.moveTo(rink.width - this.goalXOffset, 0);
this.ctx.lineTo(rink.width - this.goalXOffset, rink.height);
this.ctx.stroke();
} }
drawCreases(rink) { drawCreases(rink) {