New polygon collision object examples and Body scale fixes.

This commit is contained in:
photonstorm
2014-01-31 10:34:18 +00:00
parent 45b6d5a741
commit 27fc447928
28 changed files with 2080 additions and 1295 deletions
+3 -4
View File
@@ -20,7 +20,7 @@ function create() {
// This adjusts the collision body size to be a 100x50 box.
// 50, 25 is the X and Y offset of the newly sized box.
sprite1.body.setSize(100, 50, 50, 25);
sprite1.body.setRectangle(100, 50, 50, 25);
sprite1.body.immovable = true;
sprite2 = game.add.sprite(700, 220, 'mushroom');
@@ -31,7 +31,6 @@ function create() {
function update() {
// object1, object2, collideCallback, processCallback, callbackContext
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
}
@@ -46,7 +45,7 @@ function render() {
game.debug.renderBodyInfo(sprite1, 32, 32);
game.debug.renderPolygon(sprite1.body.polygons, 'rgb(255,0,0)');
game.debug.renderPolygon(sprite2.body.polygons, 'rgb(255,0,0)');
game.debug.renderPhysicsBody(sprite1.body);
game.debug.renderPhysicsBody(sprite2.body);
}