fix: 3v3 team match wrong problems
This commit is contained in:
+13
-1
@@ -77,12 +77,24 @@ class Bullet {
|
||||
|
||||
/**
|
||||
* Render the bullet.
|
||||
* In team battle mode, bullet color is determined by the _isAlly flag
|
||||
* set by the scene: ally = bright yellow, enemy = red.
|
||||
* In single-player / PVE mode, owner-based colors are used.
|
||||
* @param {CanvasRenderingContext2D} ctx
|
||||
*/
|
||||
render(ctx) {
|
||||
if (!this.alive) return;
|
||||
|
||||
ctx.fillStyle = this.owner === 'player' ? '#FFFF00' : '#FF6600';
|
||||
let fillColor;
|
||||
if (this._isAlly !== undefined) {
|
||||
// Team mode: use team-aware coloring
|
||||
fillColor = this._isAlly ? '#FFFF00' : '#FF4444';
|
||||
} else {
|
||||
// Single-player / PVE fallback
|
||||
fillColor = this.owner === 'player' ? '#FFFF00' : '#FF6600';
|
||||
}
|
||||
|
||||
ctx.fillStyle = fillColor;
|
||||
ctx.fillRect(
|
||||
this.x - this.halfSize,
|
||||
this.y - this.halfSize,
|
||||
|
||||
@@ -45,7 +45,7 @@ class PlayerTank extends Tank {
|
||||
|
||||
// Skin colors (reserved for future use)
|
||||
this._skinColors = null;
|
||||
this._skinId = 'default';
|
||||
this._skinId = null;
|
||||
|
||||
// Fire level system
|
||||
this.fireLevel = FIRE_LEVEL.LV1;
|
||||
|
||||
@@ -307,6 +307,14 @@ class Tank {
|
||||
ctx.scale(k, k);
|
||||
drawTankSkin(ctx, this._skinId, this._skinColors, t);
|
||||
ctx.restore();
|
||||
// Gold border for local player identification
|
||||
if (this._isLocal) {
|
||||
ctx.strokeStyle = '#FFD700';
|
||||
ctx.lineWidth = 2;
|
||||
ctx.strokeRect(-this.halfSize, -this.halfSize, this.size, this.size);
|
||||
// Also outline the barrel area
|
||||
ctx.strokeRect(-this.size * 0.15 / 2, -this.halfSize - barrelExtra, this.size * 0.15, barrelExtra);
|
||||
}
|
||||
ctx.restore();
|
||||
return;
|
||||
}
|
||||
@@ -344,6 +352,15 @@ class Tank {
|
||||
ctx.fillRect(-hs, -hs, trackW, this.size);
|
||||
ctx.fillRect(hs - trackW, -hs, trackW, this.size);
|
||||
|
||||
// Gold border for local player identification
|
||||
if (this._isLocal) {
|
||||
ctx.strokeStyle = '#FFD700';
|
||||
ctx.lineWidth = 2;
|
||||
ctx.strokeRect(-hs, -hs, this.size, this.size);
|
||||
// Barrel outline
|
||||
ctx.strokeRect(-barrelW / 2, -hs - barrelH, barrelW, barrelH);
|
||||
}
|
||||
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user