From b4113d50d1e10ca9b7b2ec459a1466de1eb37514 Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Sun, 12 Jul 2026 09:31:14 -0600 Subject: [PATCH] Querystring Argument --- src/scenes/PreloadScene.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/scenes/PreloadScene.js b/src/scenes/PreloadScene.js index 9c558b7..5c561cb 100644 --- a/src/scenes/PreloadScene.js +++ b/src/scenes/PreloadScene.js @@ -1,6 +1,8 @@ import * as Phaser from 'phaser'; import { GAME_HEIGHT, GAME_WIDTH, COLORS } from '../config.js'; import { auth } from '../services/auth.js'; +import { getGame } from '../data/gamesRegistry.js'; +import { stopMenuMusic } from '../ui/MenuMusic.js'; export default class PreloadScene extends Phaser.Scene { constructor() { super('Preload'); } @@ -177,6 +179,20 @@ export default class PreloadScene extends Phaser.Scene { this.scene.start('PeggleEditor'); return; } + + // Deep link: index.html?game= jumps straight to the same place a + // main-menu click would (GameMenuScene.openGame's branching logic). + const deepLinkGame = getGame(params.get('game')); + if (deepLinkGame) { + if (deepLinkGame.maxOpponents === 0) { + stopMenuMusic(); + this.scene.start('GameRoom', { game: deepLinkGame, opponents: [] }); + } else { + this.scene.start('OpponentSelect', { game: deepLinkGame }); + } + return; + } + this.scene.start('Landing'); } }