Phase A: stability and performance
A1 Pooled particle system - New ParticleManager owns 9 reusable Phaser emitters created once per scene (jump, explosion, powerup, puff, sparks, flame, wind, spring, speedline) - BootScene generates reusable white textures (px_square/soft/streak/ring) - GameScene burst helpers + EffectsManager flow effects now delegate to the pool instead of allocating rectangles + tweens every frame - Quality auto-detect (low on mobile/small screens) cuts particle counts A2 Fix high-speed landing tunneling - Cap downward velocity at PHYSICS.maxFallSpeed (boosts unaffected) - platformCollisionFilter now uses a swept deltaY one-way check so a fast fall can never be wrongly rejected or passed through A3 Safe storage - New utils/storage.js wraps localStorage with in-memory fallback so private mode / quota errors cannot crash the game; all access routed through it A4-A6 Lifecycle and robustness - Global error / unhandledrejection guard recovers to the menu - GameScene auto-pauses on tab hidden and cleans up the cross-scene listener on shutdown; fps pacing + disableContextMenu in game config - Moving platforms use a proper dynamic body instead of destroy()+new Body Verified in-browser: menu + game load with zero console errors, all emitters active, normal bouncing works, fall speed capped.
This commit is contained in:
@@ -2,6 +2,7 @@ import { Scene } from 'phaser';
|
||||
import { sound } from '../managers/SoundManager.js';
|
||||
import { AchievementsManager } from '../managers/AchievementsManager.js';
|
||||
import { createButton } from '../utils/ui.js';
|
||||
import { storage, KEYS } from '../utils/storage.js';
|
||||
|
||||
export class MenuScene extends Scene {
|
||||
constructor() {
|
||||
@@ -111,7 +112,7 @@ export class MenuScene extends Scene {
|
||||
{ rank: 1, addr: '0xMonad...Dev', score: 99999 },
|
||||
{ rank: 2, addr: '0xAlice...xyz', score: 87500 },
|
||||
{ rank: 3, addr: '0xBob...abc', score: 74200 },
|
||||
{ rank: 4, addr: '0xYou', score: parseInt(localStorage.getItem('naddie_best_score') || '0', 10) },
|
||||
{ rank: 4, addr: '0xYou', score: storage.getInt(KEYS.best, 0) },
|
||||
];
|
||||
mock.forEach((entry, i) => {
|
||||
const y = height * 0.32 + i * 55;
|
||||
@@ -132,7 +133,7 @@ export class MenuScene extends Scene {
|
||||
showAchievements() {
|
||||
const { width, height } = this.scale;
|
||||
const all = AchievementsManager.getAll();
|
||||
const unlocked = JSON.parse(localStorage.getItem('naddie_achievements_v1') || '{}');
|
||||
const unlocked = storage.getJSON(KEYS.achievements, {}) || {};
|
||||
|
||||
const elements = [];
|
||||
const overlay = this.add.rectangle(width / 2, height / 2, width, height, 0x000000, 0.75).setDepth(100);
|
||||
|
||||
Reference in New Issue
Block a user