Last active
August 29, 2015 14:15
-
-
Save corpsefilth/8fc21d2150edc40a2fd1 to your computer and use it in GitHub Desktop.
What is a state? Phaser State sample structure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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