Removed loads of old Debug methods and fixed up Debug.renderPhysicsBody so it iterates through and renders the shapes of a Body.

This commit is contained in:
photonstorm
2014-02-14 22:30:24 +00:00
parent 8fcf5ee415
commit b94c78cf61
3 changed files with 65 additions and 283 deletions
+12
View File
@@ -0,0 +1,12 @@
{
"diamond": [
{
"density": 2, "friction": 0, "bounce": 0,
"filter": { "categoryBits": 1, "maskBits": 65535 },
"shape": [ 32, 13 , 17, 28 , 15, 28 , 0, 13 , 0, 7 , 7, 0 , 25, 0 , 32, 7 ]
}
]
}
+7 -4
View File
@@ -3,7 +3,8 @@ var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload:
function preload() {
game.load.image('box', 'assets/sprites/block.png');
// game.load.image('box', 'assets/sprites/block.png');
game.load.image('box', 'assets/sprites/diamond.png');
}
@@ -31,14 +32,16 @@ function create() {
// box.body.setRectangle(64, 64, 95/2,95/2);
// Works
box.body.clearShapes();
// box.body.clearShapes();
// box.body.addPolygon({}, [ [-1, 1], [-1, 0], [1, 0], [1, 1], [0.5, 0.5] ]);
// Works
// box.body.setPolygon({}, [-1, 1], [-1, 0], [1, 0], [1, 1], [0.5, 0.5]);
// Works
box.body.addPolygon({}, -100, 100, -100, 0, 100, 0, 100, 100, 50, 50);
// box.body.addPolygon({}, -100, 100, -100, 0, 100, 0, 100, 100, 50, 50);
box.body.addPolygon({}, 32, 13 , 17, 28 , 15, 28 , 0, 13 , 0, 7 , 7, 0 , 25, 0 , 32, 7 );
// Works
// box.body.setPolygon({}, -1, 1, -1, 0, 1, 0, 1, 1, 0.5, 0.5);
@@ -79,7 +82,7 @@ function update() {
function render() {
game.debug.renderShape(box.body, 0);
game.debug.renderPhysicsBody(box.body, 0);
// game.debug.renderText(box.body., 32, 32);
// game.debug.renderText('y: ' + box.body.velocity.y, 32, 64);