Compare commits

..

No commits in common. "14e0794aaeb3e7dea2cf5fde8bff01701ec5b03b" and "cad05ad8950e1bc829570bbf7bc9b305dd0759cf" have entirely different histories.

3 changed files with 17 additions and 35 deletions

View File

@ -26,10 +26,8 @@ class GameEngine {
}
setupPlayers() {
const goalXOffset = this.renderer.goalXOffset;
const homeTeamPositions = [
{ role: 'G', x: goalXOffset, y: 300 },
{ role: 'G', x: 10, y: 300 },
{ role: 'LD', x: 200, y: 220 },
{ role: 'RD', x: 200, y: 380 },
{ role: 'LW', x: 350, y: 200 },
@ -38,7 +36,7 @@ class GameEngine {
];
const awayTeamPositions = [
{ role: 'G', x: 1000 - goalXOffset, y: 300 },
{ role: 'G', x: 970, y: 300 },
{ role: 'LD', x: 800, y: 220 },
{ role: 'RD', x: 800, y: 380 },
{ role: 'LW', x: 650, y: 200 },

View File

@ -149,6 +149,7 @@ class Player {
// Handle faceoff positioning
if (gameState.faceoff && gameState.faceoff.isActive) {
console.log(`Player ${this.name} (${this.role}) in faceoff mode, phase: ${gameState.faceoff.phase}`);
this.handleFaceoffPositioning(gameState, players);
return;
}
@ -245,11 +246,9 @@ class Player {
* @param {Array} players - Array of all players (unused but maintained for consistency)
*/
updateGoalie(gameState, puck, players) {
const goalXOffset = gameState.renderer?.goalXOffset || 80; // Fallback to 80 if renderer not available
const goal = this.team === 'home' ?
new Vector2(goalXOffset, gameState.rink.centerY) :
new Vector2(gameState.rink.width - goalXOffset, gameState.rink.centerY);
new Vector2(10, gameState.rink.centerY) :
new Vector2(gameState.rink.width - 10, gameState.rink.centerY);
const crease = {
x: goal.x - 30,

View File

@ -2,7 +2,6 @@ class Renderer {
constructor(canvas) {
this.canvas = canvas;
this.ctx = canvas.getContext('2d');
this.goalXOffset = 80; // Distance from rink edge
this.setupCanvas();
this.setupFixedCamera();
@ -98,38 +97,24 @@ class Renderer {
const goalY = rink.centerY;
const goalHeight = rink.goalHeight;
const goalDepth = 25;
this.ctx.beginPath();
this.ctx.moveTo(this.goalXOffset, goalY - goalHeight);
this.ctx.lineTo(this.goalXOffset - goalDepth, goalY - goalHeight);
this.ctx.lineTo(this.goalXOffset - goalDepth, goalY + goalHeight);
this.ctx.lineTo(this.goalXOffset, goalY + goalHeight);
this.ctx.moveTo(0, goalY - goalHeight);
this.ctx.lineTo(-10, goalY - goalHeight);
this.ctx.lineTo(-10, goalY + goalHeight);
this.ctx.lineTo(0, goalY + goalHeight);
this.ctx.stroke();
this.ctx.beginPath();
this.ctx.moveTo(rink.width - this.goalXOffset, goalY - goalHeight);
this.ctx.lineTo(rink.width - this.goalXOffset + goalDepth, goalY - goalHeight);
this.ctx.lineTo(rink.width - this.goalXOffset + goalDepth, goalY + goalHeight);
this.ctx.lineTo(rink.width - this.goalXOffset, goalY + goalHeight);
this.ctx.moveTo(rink.width, goalY - goalHeight);
this.ctx.lineTo(rink.width + 10, goalY - goalHeight);
this.ctx.lineTo(rink.width + 10, goalY + goalHeight);
this.ctx.lineTo(rink.width, goalY + goalHeight);
this.ctx.stroke();
this.ctx.fillStyle = 'rgba(211, 47, 47, 0.1)';
this.ctx.fillRect(this.goalXOffset - goalDepth, 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();
this.ctx.fillRect(-10, goalY - goalHeight, 10, goalHeight * 2);
this.ctx.fillRect(rink.width, goalY - goalHeight, 10, goalHeight * 2);
}
drawCreases(rink) {
@ -141,12 +126,12 @@ class Renderer {
const goalY = rink.centerY;
this.ctx.beginPath();
this.ctx.arc(this.goalXOffset, goalY, creaseRadius, -Math.PI/2, Math.PI/2);
this.ctx.arc(0, goalY, creaseRadius, -Math.PI/2, Math.PI/2);
this.ctx.fill();
this.ctx.stroke();
this.ctx.beginPath();
this.ctx.arc(rink.width - this.goalXOffset, goalY, creaseRadius, Math.PI/2, -Math.PI/2);
this.ctx.arc(rink.width, goalY, creaseRadius, Math.PI/2, -Math.PI/2);
this.ctx.fill();
this.ctx.stroke();
}