phaser-node-kit
Version:
Rapid Game Development with PhaserJS and Node for Modern Browsers
28 lines (19 loc) • 821 B
JavaScript
// PHASER IS IMPORTED AS AN EXTERNAL BUNDLE IN INDEX.HTML
Phaser.Device.whenReady(() => {
const bootState = require('./BootState')
const preloadState = require('./PreloadState')
const menuState = require('./MenuState')
const gameState = require('./GameState')
const game = new Phaser.Game(800, 600, Phaser.AUTO, 'game')
game.stage.backgroundColor = 0x000000
game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL
game.scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL
game.scale.setMinMax(800, 600)
game.scale.pageAlignVertically = true
game.scale.pageAlignHorizontally = true
game.state.add('Boot', bootState)
game.state.add('Preload', preloadState)
game.state.add('MainMenu', menuState)
game.state.add('Game', gameState)
game.state.start('Boot')
})