Skip to content

Commit b94c78c

Browse files
committed
Removed loads of old Debug methods and fixed up Debug.renderPhysicsBody so it iterates through and renders the shapes of a Body.
1 parent 8fcf5ee commit b94c78c

3 files changed

Lines changed: 63 additions & 281 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
3+
"diamond": [
4+
5+
{
6+
"density": 2, "friction": 0, "bounce": 0,
7+
"filter": { "categoryBits": 1, "maskBits": 65535 },
8+
"shape": [ 32, 13 , 17, 28 , 15, 28 , 0, 13 , 0, 7 , 7, 0 , 25, 0 , 32, 7 ]
9+
}
10+
]
11+
12+
}

examples/wip/p27.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload:
33

44
function preload() {
55

6-
game.load.image('box', 'assets/sprites/block.png');
6+
// game.load.image('box', 'assets/sprites/block.png');
7+
game.load.image('box', 'assets/sprites/diamond.png');
78

89
}
910

@@ -31,14 +32,16 @@ function create() {
3132
// box.body.setRectangle(64, 64, 95/2,95/2);
3233

3334
// Works
34-
box.body.clearShapes();
35+
// box.body.clearShapes();
3536
// box.body.addPolygon({}, [ [-1, 1], [-1, 0], [1, 0], [1, 1], [0.5, 0.5] ]);
3637

3738
// Works
3839
// box.body.setPolygon({}, [-1, 1], [-1, 0], [1, 0], [1, 1], [0.5, 0.5]);
3940

4041
// Works
41-
box.body.addPolygon({}, -100, 100, -100, 0, 100, 0, 100, 100, 50, 50);
42+
// box.body.addPolygon({}, -100, 100, -100, 0, 100, 0, 100, 100, 50, 50);
43+
44+
box.body.addPolygon({}, 32, 13 , 17, 28 , 15, 28 , 0, 13 , 0, 7 , 7, 0 , 25, 0 , 32, 7 );
4245

4346
// Works
4447
// box.body.setPolygon({}, -1, 1, -1, 0, 1, 0, 1, 1, 0.5, 0.5);
@@ -79,7 +82,7 @@ function update() {
7982

8083
function render() {
8184

82-
game.debug.renderShape(box.body, 0);
85+
game.debug.renderPhysicsBody(box.body, 0);
8386

8487
// game.debug.renderText(box.body., 32, 32);
8588
// game.debug.renderText('y: ' + box.body.velocity.y, 32, 64);

0 commit comments

Comments
 (0)