preload sprite phaser 1

preload sprite phaser

function preload() {
	gameState.spritename = this.load.image('name of sprite', 'link to image')
}

Here is what the above code is Doing:
1. We’re creating a variable called gameState.
2. We’re setting gameState to be an object.
3. We’re adding a property to gameState called spritename.
4. We’re setting the value of gameState.spritename to be the image we loaded.

Similar Posts