Skip to content

Instantly share code, notes, and snippets.

View aaronhampton's full-sized avatar

Aaron Hampton aaronhampton

  • Dover, DE
View GitHub Profile
@aaronhampton
aaronhampton / gist:bfa4f52bdf786697d011
Created October 30, 2014 01:15
Enable physics on a Phaser Graphics Circle
// First, add your sprite and enable physics on it
sprite = game.add.sprite(game.world.centerX, game.world.centerY);
game.physics.p2.enable(this.sprite);
// Create a shape
var circObj = new Phaser.Circle(0, 0, 25);
// Set the body size of your sprite
sprite.body.setCircle(circObj._radius, 0, 0);
// Draw the graphics
var ring = game.add.graphics();
ring.lineStyle(2, 0x000000, 0.25);