60 lines
2.4 KiB
JavaScript
60 lines
2.4 KiB
JavaScript
import Phaser from 'phaser';
|
|
import { GAME_WIDTH, GAME_HEIGHT, DEBUG, WORLD_SCALE } from './config.js';
|
|
import BootScene from './scenes/BootScene.js';
|
|
import PreloadScene from './scenes/PreloadScene.js';
|
|
import IntroScene from './scenes/IntroScene.js';
|
|
import MainMenuScene from './scenes/MainMenuScene.js';
|
|
import LevelSelectScene from './scenes/LevelSelectScene.js';
|
|
import PlayScene from './scenes/PlayScene.js';
|
|
import LevelScoreScene from './scenes/LevelScoreScene.js';
|
|
import LevelFailedScene from './scenes/LevelFailedScene.js';
|
|
|
|
window.__PHASER_GAME__ = new Phaser.Game({
|
|
type: Phaser.AUTO,
|
|
parent: 'game-container',
|
|
width: GAME_WIDTH,
|
|
height: GAME_HEIGHT,
|
|
backgroundColor: '#8fc7e8',
|
|
physics: {
|
|
default: 'matter',
|
|
matter: {
|
|
// Gravity is a constant absolute px/s^2 regardless of body size (it's
|
|
// mass-proportional force, so acceleration = force/mass is scale-
|
|
// independent) - has to scale with WORLD_SCALE or a 2x-bigger world
|
|
// falls proportionally slower (everything free-falls for longer to
|
|
// cover the now-doubled pixel distances).
|
|
// Dropped from the original 1 - pulled back from an initial 0.35 (a
|
|
// lot more airtime) to 0.675, roughly the midpoint, since 0.35 read as
|
|
// too floaty. For a given launch speed off a ramp, time-to-apex is
|
|
// v/g, so this is still ~1.5x more hang time than the original.
|
|
// Floatier overall (slower falling everywhere, not just off jumps) is
|
|
// the tradeoff - primary tuning knob for "how floaty," not physically
|
|
// derived.
|
|
gravity: { x: 0, y: 0.675 * WORLD_SCALE },
|
|
// Default is 2. The wheel wishbones are soft spring constraints with a
|
|
// short travel range - on a hard landing the low default let a wheel's
|
|
// per-tick correction overshoot past its anchor and settle mirrored on
|
|
// the wrong side (visually "jumping" higher on the chassis and
|
|
// sticking there). More iterations converge the spring solve closer to
|
|
// the true equilibrium each tick, which keeps the wheel from punching
|
|
// through in the first place.
|
|
constraintIterations: 10,
|
|
debug: DEBUG,
|
|
},
|
|
},
|
|
scale: {
|
|
mode: Phaser.Scale.FIT,
|
|
autoCenter: Phaser.Scale.CENTER_BOTH,
|
|
},
|
|
scene: [
|
|
BootScene,
|
|
PreloadScene,
|
|
IntroScene,
|
|
MainMenuScene,
|
|
LevelSelectScene,
|
|
PlayScene,
|
|
LevelScoreScene,
|
|
LevelFailedScene,
|
|
],
|
|
});
|