feat(duel): allow swapping main view to opponent's board

- Add a toggle on the picture-in-picture window to swap the big board
  with the mini view of the opponent's field
- Color-coded frame and badge identify whose board is currently shown
  (blue = player 1, orange = player 2)
- Block building and rushing while spectating the opponent's board;
  the PiP then shows your own field instead
- Clarify duel-mode descriptions in lobby and start screen, add hints
  in the multiplayer bar
- Replace previous announcement banners so only one shows at a time
This commit is contained in:
Tronax 2026-08-16 13:35:46 +02:00
parent 4ec0e483aa
commit ef75203db7
Signed by: Tronax
SSH key fingerprint: SHA256:2pKKXDZucWvaF/GzXNz0FY53EAO1YDLN80bqS+TTz/o
12 changed files with 130 additions and 15 deletions

View file

@ -1,4 +1,4 @@
import { ENEMIES, H, TILE, TOWERS, W } from './config'
import { ENEMIES, H, TILE, TOWERS, W, playerColor } from './config'
import type { GameEngine } from './engine'
import type { Enemy, Tower } from './types'
import { mulberry32 } from './utils'
@ -342,7 +342,7 @@ export class Renderer {
g.lineTo(x + 10, y + 26)
g.closePath()
g.fill()
// banner
// banner carries the owner's color in duel mode (blue/orange)
g.strokeStyle = '#5b4a35'
g.lineWidth = 3
g.beginPath()
@ -350,7 +350,7 @@ export class Renderer {
g.lineTo(x, y - 62)
g.stroke()
const wave = Math.sin(eng.time * 4) * 3
g.fillStyle = '#d84b3f'
g.fillStyle = eng.mpMode === 'duel' ? playerColor(eng.localPlayerId) : '#d84b3f'
g.beginPath()
g.moveTo(x + 1, y - 62)
g.lineTo(x + 22 + wave, y - 56)