orbit/js/combat/main.js

33 lines
1.3 KiB
JavaScript

import Phaser from '../vendor/phaser.js';
import { config } from '../config/Config.js';
import { ConfigLoader } from '../config/ConfigLoader.js';
import { createGameConfig } from '../config/GameConfig.js';
import { CombatScene } from './CombatScene.js';
import { awaitFonts } from '../utils/Fonts.js';
/**
* The combat sandbox boot (combat.html / the dev server's /combat /
* index.html?combat): the SAME config manifest as the game (so
* data/combat.json, ship.json, theme.json, game.json are all loaded and
* consistent), but the scene list is ONLY CombatScene — no menu, no
* galaxy, no save. This is the standalone range where combat is tuned
* before it ships in the real game (data/combat.json holds every number).
*/
export async function bootCombat() {
const data = await ConfigLoader.load();
config.init(data);
console.info('orbit — combat sandbox: config loaded', Object.keys(data).join(', '));
await awaitFonts();
const gameConfig = createGameConfig();
gameConfig.scene = [CombatScene];
const game = new Phaser.Game(gameConfig);
window.game = game;
window.config = config;
console.info(
'orbit — combat sandbox armed · WASD fly · SPACE fire · R reset · P pause · ' +
'tune data/combat.json · window.__COMBAT__ = { reset, spawnEnemy, player, kills }',
);
}