Vanilla JS + Canvas, zero dependencies, offline-first PWA. Gameplay: - 11 weapons x8 levels + 11 evolutions (chest-based), incl. timed mines - 13 passives, crit system with directional hit-sparks & hit-stop - 10 characters w/ unique mods + unlock conditions, gold cosmetic skins - 3 biomes (Neon Graveyard / Frozen Hollow / Magma Rift) each with own spawn tables, boss plans and music flavor; Endless mode + surges; 4 difficulty grades; breakable crystal-lamp props - Elite random affixes (Swift/Sturdy/Volatile), 4 bosses, win flow - Achievements (23) w/ gold rewards, run history, daily seeded challenge Tech: - Cinematic canvas main-menu scene, game-feel FX suite (trails, muzzle, status tints, low-HP pulse), viewport culling + particle pooling - WebAudio synth SFX + generative per-biome soundtrack - Gamepad support, remappable keys, touch joystick, fullscreen - i18n VI/EN, localStorage saves w/ export-import codes - Cloudflare Workers leaderboard scaffold (KV) w/ signed submits - Headless integrity test-suite (node test/integrity.js)
34 lines
1003 B
JavaScript
34 lines
1003 B
JavaScript
'use strict';
|
|
/* ============================================================
|
|
NEON SURVIVORS — main.js : bootstrap
|
|
============================================================ */
|
|
|
|
(function boot() {
|
|
Store.load();
|
|
|
|
const canvas = document.getElementById('game');
|
|
window.GAME = new Game(canvas);
|
|
UI.init(GAME);
|
|
GAME.applySettings();
|
|
|
|
// leave the splash
|
|
setTimeout(() => {
|
|
UI.showScreen('scr-menu');
|
|
}, 450);
|
|
|
|
// unlock WebAudio on first user gesture
|
|
const kick = () => { Snd.init(); };
|
|
window.addEventListener('pointerdown', kick);
|
|
window.addEventListener('keydown', kick);
|
|
|
|
// PWA service worker (https only; plain http still runs without SW)
|
|
if ('serviceWorker' in navigator && /^https:/.test(location.protocol)) {
|
|
window.addEventListener('load', () => {
|
|
navigator.serviceWorker.register('sw.js').catch(() => {});
|
|
});
|
|
}
|
|
|
|
// block context menu / double-tap zoom on mobile
|
|
window.addEventListener('contextmenu', e => e.preventDefault());
|
|
})();
|