Skip to content

Instantly share code, notes, and snippets.

@corpsefilth
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corpsefilth/8fc21d2150edc40a2fd1 to your computer and use it in GitHub Desktop.
Save corpsefilth/8fc21d2150edc40a2fd1 to your computer and use it in GitHub Desktop.
What is a state? Phaser State sample structure
// Create one state called 'sampleState'
var sampleState = {
// Define all the functions of the state
preload: function() {
// This function will be executed at the beginning
// That's where we load the game's assets
},
create: function() {
// This function is called after the preload function
// Here we set up the game, display sprites, etc.
},
update: function() {
// This function is called 60 times per second
// It contains the game's logic
},
// And maybe add some other functions
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment