Friday, December 4, 2015

javascript - which state to add main menu for simple browser game with phaser


In which state should I add the main menu, or should i make it into another separate state? My main confusion here is how I manipulate states properly. Im a phaser/gamedev noob and I dont know how to start a game from the main menu syntax and mechanics-specific.


My idea for a main menu would be a simple background picture with a start button. But then, how do i jump start the game when the start button is clicked?


just for details, Im showing you this :


var game = new Phaser.Game(800,600, Phaser.AUTO, 'phaser-demo', {preload: preload, create: create, update: update, render: render});

Answer



Unfortunately most of the tutorials you'll see will teach you some bad habits as far as state management goes. What you'll want to do here is avoid the object literal state declaration in favor of adding states from separate JS files in your index.html.


(Don't forget to include them as

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...