Phaser Starter Snippets


Notice: Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see Debugging in WordPress for more information. (This message was added in version 3.9.0.) in /home/wcc1969/public_html/phasergames.com/wp-includes/functions.php on line 6085

Notice: Function wpdb::prepare was called incorrectly. The query does not contain the correct number of placeholders (0) for the number of arguments passed (1). Please see Debugging in WordPress for more information. (This message was added in version 4.8.3.) in /home/wcc1969/public_html/phasergames.com/wp-includes/functions.php on line 6085

Warning: Undefined variable $output in /home/wcc1969/public_html/phasergames.com/wp-content/plugins/wc_snippets/snippets.php on line 77
Blank State
Description:this is a blank state template with the the essential functions
Example:var StateMain={ preload:function() { }, create:function() { }, update:function() { } }

switch states
Description:changes a state. For example if you game is over you can call game.state.start("StateGameOver");
Example:game.state.start("StateMain");

Start for desktop
Description:This is the main file needed to start a phaser game
Example:var game; window.onload = function() { game=new Phaser.Game(480,640,Phaser.AUTO,"ph_game"); game.state.add("StateMain",StateMain); game.state.start("StateMain"); }

Start for desktop/mobile
Description:start file need to start a phaser game with support for mobile
Example:This code has been updated. Details Here

Basic Html
Description:starter html file for Phaser
Example:

full screen meta tag
Description:meta tag to put html in full screen for mobile
Example:

Sample Init State
Description:Use this sample to make your own init state. Init states set up the bare bones code for launch and prepare for loading states
Example:

Sample Load State
Description:load states allow you preload everything before the game starts
Example: