Skip to content

Instantly share code, notes, and snippets.

@videlais

videlais/script.js Secret

Created Aug 28, 2015
Embed
What would you like to do?
Phaser Arcade Physics
var game = new Phaser.Game(
200, //The width in pixels
200, //The height in pixels
Phaser.AUTO, //The render system
"phaser", //The element
{
preload: preload, // The preload function
create: create, // The create function
update: update // The update function
}
);
// Create the variable outside of any one function scope
var sprite;
function preload() {}
function create() {
// Start the Arcade physics system
game.physics.startSystem(Phaser.Physics.ARCADE);
sprite = game.add.sprite(
50, // The x position
50, // The y position
'sprite' // The image cache-key
);
// Enable Arcade physics on 'sprite'
game.physics.arcade.enable(sprite);
}
function update() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.