mirror of
https://github.com/wassname/phaser.git
synced 2026-06-27 16:10:15 +08:00
New polygon collision object examples and Body scale fixes.
This commit is contained in:
@@ -73,6 +73,7 @@ Significant API changes:
|
||||
* Body.screenX and screenY moved to getters, no longer calculated every frame.
|
||||
* ArcadePhysics now has setBounds and setBoundsToWorld, and you can specify which walls are created or not (left, right, up, down)
|
||||
* Removed: Debug.renderSpriteTouching, Debug.renderLocalTransformInfo, Debug.renderWorldTransformInfo, Debug.renderSpriteCollision and Debug.dumpLinkedList.
|
||||
* Body.setSize has been removed. Please use Body.setCircle, setRectangle or setPolygon instead.
|
||||
|
||||
|
||||
New features:
|
||||
|
||||
+1546
-1172
File diff suppressed because it is too large
Load Diff
Vendored
+11
-11
File diff suppressed because one or more lines are too long
@@ -118,6 +118,14 @@
|
||||
"file": "bounding+box.js",
|
||||
"title": "bounding box"
|
||||
},
|
||||
{
|
||||
"file": "circle+body.js",
|
||||
"title": "circle body"
|
||||
},
|
||||
{
|
||||
"file": "circle+vs+polygon.js",
|
||||
"title": "circle vs polygon"
|
||||
},
|
||||
{
|
||||
"file": "group+vs+group.js",
|
||||
"title": "group vs group"
|
||||
@@ -134,10 +142,18 @@
|
||||
"file": "offset+bounding+box.js",
|
||||
"title": "offset bounding box"
|
||||
},
|
||||
{
|
||||
"file": "polygon+body.js",
|
||||
"title": "polygon body"
|
||||
},
|
||||
{
|
||||
"file": "process+callback.js",
|
||||
"title": "process callback"
|
||||
},
|
||||
{
|
||||
"file": "rotated+bounding+box.js",
|
||||
"title": "rotated bounding box"
|
||||
},
|
||||
{
|
||||
"file": "sprite+vs+group.js",
|
||||
"title": "sprite vs group"
|
||||
@@ -276,6 +292,10 @@
|
||||
"file": "circle.js",
|
||||
"title": "circle"
|
||||
},
|
||||
{
|
||||
"file": "line+intersection.js",
|
||||
"title": "line intersection"
|
||||
},
|
||||
{
|
||||
"file": "line.js",
|
||||
"title": "line"
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,125 @@
|
||||
Simple plain text exporter for demo purposes
|
||||
|
||||
See http://www.grantlee.org/apidox/for_themers.html for more information
|
||||
|
||||
Custom values (from the <bodies> section)
|
||||
Grav: 9.81
|
||||
|
||||
List of all bodies:
|
||||
|
||||
|
||||
Name: exocet_spaceman
|
||||
Custom values (from the <bodies> section):
|
||||
Identifier: 0
|
||||
FixedRotation: NO
|
||||
|
||||
AnchorPointRel: { 0.000,1.000 }
|
||||
AnchorPointAbs: { 0.000,175.000 }
|
||||
Size: { 153.000,175.000 }
|
||||
|
||||
List of all fixtures:
|
||||
|
||||
----------------------------------------------------------
|
||||
fixtureType: POLYGON
|
||||
|
||||
Box2D special values (only available if box2d is active):
|
||||
filter_groupIndex:
|
||||
filter_categoryBits:
|
||||
filter_maskBits:
|
||||
|
||||
Custom values (from the <fixtures> section):
|
||||
density: 2
|
||||
friction: 0
|
||||
restitution: 0
|
||||
isSensor: NO
|
||||
|
||||
|
||||
Hull polygon:
|
||||
(34, -172) , (75, -172) , (87, -145) , (121, -52) , (105, -16) , (55, -3) , (9, -19) , (1, -57) , (24, -145)
|
||||
|
||||
Convex sub polygons:
|
||||
|
||||
(75, -172) , (87, -145) , (121, -52) , (105, -16) , (55, -3) , (1, -57) , (24, -145) , (34, -172)
|
||||
(1, -57) , (55, -3) , (9, -19)
|
||||
|
||||
|
||||
|
||||
|
||||
Name: parsec
|
||||
Custom values (from the <bodies> section):
|
||||
Identifier: 0
|
||||
FixedRotation: NO
|
||||
|
||||
AnchorPointRel: { 0.000,1.000 }
|
||||
AnchorPointAbs: { 0.000,80.000 }
|
||||
Size: { 302.000,80.000 }
|
||||
|
||||
List of all fixtures:
|
||||
|
||||
----------------------------------------------------------
|
||||
fixtureType: POLYGON
|
||||
|
||||
Box2D special values (only available if box2d is active):
|
||||
filter_groupIndex:
|
||||
filter_categoryBits:
|
||||
filter_maskBits:
|
||||
|
||||
Custom values (from the <fixtures> section):
|
||||
density: 2
|
||||
friction: 0
|
||||
restitution: 0
|
||||
isSensor: NO
|
||||
|
||||
|
||||
Hull polygon:
|
||||
(56, -1) , (10, -5) , (1, -13) , (0, -34) , (55, -60) , (122, -78) , (165, -80) , (214, -74) , (285, -71) , (296, -44) , (298, -12) , (292, -5) , (168, -3)
|
||||
|
||||
Convex sub polygons:
|
||||
|
||||
(296, -44) , (298, -12) , (292, -5) , (168, -3) , (214, -74) , (285, -71)
|
||||
(0, -34) , (55, -60) , (122, -78) , (165, -80) , (168, -3) , (56, -1) , (10, -5) , (1, -13)
|
||||
(214, -74) , (168, -3) , (165, -80)
|
||||
|
||||
|
||||
|
||||
|
||||
Name: wasp
|
||||
Custom values (from the <bodies> section):
|
||||
Identifier: 0
|
||||
FixedRotation: NO
|
||||
|
||||
AnchorPointRel: { 0.000,1.000 }
|
||||
AnchorPointAbs: { 0.000,91.000 }
|
||||
Size: { 175.000,91.000 }
|
||||
|
||||
List of all fixtures:
|
||||
|
||||
----------------------------------------------------------
|
||||
fixtureType: POLYGON
|
||||
|
||||
Box2D special values (only available if box2d is active):
|
||||
filter_groupIndex:
|
||||
filter_categoryBits:
|
||||
filter_maskBits:
|
||||
|
||||
Custom values (from the <fixtures> section):
|
||||
density: 2
|
||||
friction: 0
|
||||
restitution: 0
|
||||
isSensor: NO
|
||||
|
||||
|
||||
Hull polygon:
|
||||
(62, -89) , (89, -85) , (173, -42) , (171, -32) , (116, -31) , (106, -2) , (93, -1) , (91, -22) , (52, -17) , (39, 0) , (28, -5) , (31, -25) , (21, -37) , (5, -41) , (0, -62) , (17, -68) , (18, -85) , (38, -90)
|
||||
|
||||
Convex sub polygons:
|
||||
|
||||
(17, -68) , (21, -37) , (5, -41) , (0, -62)
|
||||
(38, -90) , (62, -89) , (89, -85) , (173, -42) , (116, -31) , (21, -37) , (17, -68) , (18, -85)
|
||||
(91, -22) , (116, -31) , (106, -2) , (93, -1)
|
||||
(31, -25) , (52, -17) , (39, 0) , (28, -5)
|
||||
(21, -37) , (116, -31) , (91, -22) , (52, -17) , (31, -25)
|
||||
(116, -31) , (173, -42) , (171, -32)
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 482 B |
Binary file not shown.
|
After Width: | Height: | Size: 433 B |
Binary file not shown.
|
After Width: | Height: | Size: 395 B |
Binary file not shown.
|
After Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 16 KiB |
@@ -40,7 +40,7 @@ function update() {
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderPolygon(sprite.body.polygons, 'rgb(255,0,0)');
|
||||
game.debug.renderPolygon(sprite2.body.polygons, 'rgb(255,0,0)');
|
||||
game.debug.renderPhysicsBody(sprite.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
|
||||
}
|
||||
|
||||
@@ -17,9 +17,8 @@ function create() {
|
||||
sprite1 = game.add.sprite(150, 300, 'atari');
|
||||
sprite1.name = 'atari';
|
||||
|
||||
// This adjusts the collision body size to be 104 x 104.
|
||||
// See the offset bounding box for another example.
|
||||
sprite1.body.setSize(104, 104, 0, 0);
|
||||
// Here you can visually see the two bounding boxes the sprites are using for collision.
|
||||
|
||||
sprite1.body.immovable = true;
|
||||
|
||||
sprite2 = game.add.sprite(700, 320, 'mushroom');
|
||||
@@ -30,7 +29,6 @@ function create() {
|
||||
|
||||
function update() {
|
||||
|
||||
// object1, object2, collideCallback, processCallback, callbackContext
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
@@ -45,7 +43,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);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('wizball', 'assets/sprites/wizball.png');
|
||||
game.load.image('mushroom', 'assets/sprites/mushroom2.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
sprite1 = game.add.sprite(130, 250, 'wizball');
|
||||
|
||||
// Here we've replaced the sprites body with a circle instead of a rectangle
|
||||
// The value is the radius of the body in pixels
|
||||
|
||||
sprite1.body.setCircle(46);
|
||||
sprite1.body.immovable = true;
|
||||
|
||||
sprite2 = game.add.sprite(700, 210, 'mushroom');
|
||||
sprite2.name = 'mushroom';
|
||||
sprite2.body.velocity.x = -100;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
|
||||
function collisionHandler (obj1, obj2) {
|
||||
|
||||
game.stage.backgroundColor = '#992d2d';
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderBodyInfo(sprite2, 32, 32);
|
||||
|
||||
game.debug.renderPhysicsBody(sprite1.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('parsec', 'assets/sprites/parsec.png');
|
||||
game.load.image('wizball', 'assets/sprites/wizball.png');
|
||||
game.load.image('spaceman', 'assets/sprites/exocet_spaceman.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
var sprite3;
|
||||
var sprite4;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
game.physics.gravity.y = 100;
|
||||
|
||||
sprite1 = game.add.sprite(80, 200);
|
||||
sprite1.body.setPolygon(0,0, 60,0, 100,40, 60,80, 0,80);
|
||||
sprite1.body.translate(0, 144);
|
||||
sprite1.body.immovable = true;
|
||||
sprite1.body.allowGravity = false;
|
||||
|
||||
sprite2 = game.add.sprite(450, 300, 'parsec');
|
||||
sprite2.body.setPolygon(56, -1 , 10, -5 , 1, -13 , 0, -34 , 55, -60 , 122, -78 , 165, -80 , 214, -74 , 285, -71 , 296, -44 , 298, -12 , 292, -5 , 168, -3);
|
||||
sprite2.body.translate(0, 80);
|
||||
sprite2.body.immovable = true;
|
||||
sprite2.body.allowGravity = false;
|
||||
|
||||
sprite3 = game.add.sprite(230, 400, 'spaceman');
|
||||
sprite3.body.setPolygon(34, -172 , 75, -172 , 87, -145 , 121, -52 , 105, -16 , 55, -3 , 9, -19 , 1, -57 , 24, -145);
|
||||
sprite3.body.translate(0, 175);
|
||||
sprite3.body.immovable = true;
|
||||
sprite3.body.allowGravity = false;
|
||||
|
||||
sprite4 = game.add.sprite(380, 100, 'wizball');
|
||||
sprite4.body.setCircle(46);
|
||||
sprite4.body.collideWorldBounds = true;
|
||||
sprite4.body.friction = 0;
|
||||
sprite4.body.bounce.setTo(0.9, 0.9);
|
||||
sprite4.body.velocity.setTo(100, 100);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.collideArray(sprite4, [ sprite1, sprite2, sprite3 ]);
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderBodyInfo(sprite4, 32, 32);
|
||||
|
||||
game.debug.renderPhysicsBody(sprite1.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
game.debug.renderPhysicsBody(sprite3.body);
|
||||
game.debug.renderPhysicsBody(sprite4.body);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
|
||||
function preload() {
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ function create() {
|
||||
sprite1.name = 'atari';
|
||||
|
||||
// In this example the new collision box is much larger than the original sprite
|
||||
sprite1.body.setSize(400, 50, -100, 20);
|
||||
sprite1.body.setRectangle(400, 50, -100, 20);
|
||||
sprite1.body.immovable = true;
|
||||
|
||||
sprite2 = game.add.sprite(700, 210, 'mushroom');
|
||||
@@ -30,7 +30,6 @@ function create() {
|
||||
|
||||
function update() {
|
||||
|
||||
// object1, object2, collideCallback, processCallback, callbackContext
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
@@ -45,7 +44,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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('parsec', 'assets/sprites/parsec.png');
|
||||
game.load.image('spaceman', 'assets/sprites/exocet_spaceman.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
// Here we've replaced the sprites body with a polygon.
|
||||
// The point data was generated by tracing the PNGs in Physics Editor: http://www.codeandweb.com/physicseditor
|
||||
|
||||
sprite1 = game.add.sprite(550, 250, 'parsec');
|
||||
sprite1.body.setPolygon(56, -1 , 10, -5 , 1, -13 , 0, -34 , 55, -60 , 122, -78 , 165, -80 , 214, -74 , 285, -71 , 296, -44 , 298, -12 , 292, -5 , 168, -3);
|
||||
sprite1.body.translate(0, 80);
|
||||
sprite1.body.velocity.x = -100;
|
||||
|
||||
sprite2 = game.add.sprite(0, 200, 'spaceman');
|
||||
sprite2.body.setPolygon(34, -172 , 75, -172 , 87, -145 , 121, -52 , 105, -16 , 55, -3 , 9, -19 , 1, -57 , 24, -145);
|
||||
sprite2.body.translate(0, 175);
|
||||
sprite2.body.velocity.x = 100;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
|
||||
function collisionHandler (obj1, obj2) {
|
||||
|
||||
game.stage.backgroundColor = '#992d2d';
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderPhysicsBody(sprite1.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('atari', 'assets/sprites/atari130xe.png');
|
||||
game.load.image('mushroom', 'assets/sprites/mushroom2.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
sprite1 = game.add.sprite(130, 200, 'atari');
|
||||
sprite1.name = 'atari';
|
||||
|
||||
// Here we're rotated both the sprite and the physics body
|
||||
|
||||
sprite1.rotation = 0.6;
|
||||
sprite1.body.polygon.rotate(0.6);
|
||||
sprite1.body.immovable = true;
|
||||
|
||||
sprite2 = game.add.sprite(700, 210, 'mushroom');
|
||||
sprite2.name = 'mushroom';
|
||||
sprite2.body.velocity.x = -100;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
|
||||
function collisionHandler (obj1, obj2) {
|
||||
|
||||
game.stage.backgroundColor = '#992d2d';
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderBodyInfo(sprite1, 32, 32);
|
||||
|
||||
game.debug.renderPhysicsBody(sprite1.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
|
||||
}
|
||||
@@ -22,7 +22,7 @@ function create() {
|
||||
// This adjusts the collision body size.
|
||||
// 220x10 is the new width/height.
|
||||
// See the offset bounding box for another example.
|
||||
sprite1.body.setSize(220, 10, 0, 0);
|
||||
sprite1.body.setRectangle(220, 10, 0, 0);
|
||||
|
||||
sprite2 = game.add.sprite(400, 450, 'mushroom');
|
||||
sprite2.name = 'mushroom';
|
||||
@@ -32,7 +32,6 @@ function create() {
|
||||
|
||||
function update() {
|
||||
|
||||
// object1, object2, collideCallback, processCallback, callbackContext
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
@@ -45,10 +44,7 @@ function collisionHandler (obj1, obj2) {
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderSpriteInfo(sprite1, 32, 32);
|
||||
game.debug.renderSpriteCollision(sprite1, 400, 32);
|
||||
|
||||
game.debug.renderSpriteBody(sprite1);
|
||||
game.debug.renderSpriteBody(sprite2);
|
||||
game.debug.renderPhysicsBody(sprite1.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
|
||||
}
|
||||
|
||||
@@ -29,16 +29,10 @@ function create() {
|
||||
// Basically this sets EVERY SINGLE tile to fully collide on all faces
|
||||
map.setCollisionByExclusion([7, 32, 35, 36, 47]);
|
||||
|
||||
layer.debug = true;
|
||||
// layer.debug = true;
|
||||
|
||||
layer.resizeWorld();
|
||||
|
||||
sprite = game.add.sprite(450, 80, 'phaser');
|
||||
sprite.anchor.setTo(0.5, 0.5);
|
||||
|
||||
game.camera.follow(sprite);
|
||||
// game.camera.deadzone = new Phaser.Rectangle(160, 160, layer.renderWidth-320, layer.renderHeight-320);
|
||||
|
||||
cursors = game.input.keyboard.createCursorKeys();
|
||||
|
||||
emitter = game.add.emitter(0, 0, 200);
|
||||
@@ -49,15 +43,18 @@ function create() {
|
||||
emitter.gravity = 150;
|
||||
emitter.bounce.setTo(0.5, 0.5);
|
||||
|
||||
game.input.onDown.add(particleBurst, this);
|
||||
sprite = game.add.sprite(200, 70, 'phaser');
|
||||
sprite.anchor.setTo(0.5, 0.5);
|
||||
|
||||
game.camera.follow(sprite);
|
||||
|
||||
}
|
||||
|
||||
function particleBurst() {
|
||||
|
||||
emitter.x = game.input.worldX;
|
||||
emitter.y = game.input.worldY;
|
||||
emitter.start(true, 4000, null, 10);
|
||||
emitter.x = sprite.x;
|
||||
emitter.y = sprite.y;
|
||||
emitter.start(true, 2000, null, 1);
|
||||
|
||||
}
|
||||
|
||||
@@ -72,21 +69,25 @@ function update() {
|
||||
if (cursors.up.isDown)
|
||||
{
|
||||
sprite.body.velocity.y = -150;
|
||||
particleBurst();
|
||||
}
|
||||
else if (cursors.down.isDown)
|
||||
{
|
||||
sprite.body.velocity.y = 150;
|
||||
particleBurst();
|
||||
}
|
||||
|
||||
if (cursors.left.isDown)
|
||||
{
|
||||
sprite.body.velocity.x = -150;
|
||||
sprite.scale.x = -1;
|
||||
particleBurst();
|
||||
}
|
||||
else if (cursors.right.isDown)
|
||||
{
|
||||
sprite.body.velocity.x = 150;
|
||||
sprite.scale.x = 1;
|
||||
particleBurst();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ function update() {
|
||||
|
||||
// sprite.body.velocity.x = 0;
|
||||
// sprite.body.velocity.y = 0;
|
||||
// sprite.body.angularVelocity = 0;
|
||||
sprite.body.angularVelocity = 0;
|
||||
|
||||
// sprite.body.acceleration.x = 0;
|
||||
// sprite.body.angularAcceleration = 0;
|
||||
|
||||
@@ -29,7 +29,7 @@ function create() {
|
||||
// Basically this sets EVERY SINGLE tile to fully collide on all faces
|
||||
map.setCollisionByExclusion([7, 32, 35, 36, 47]);
|
||||
|
||||
layer.debug = true;
|
||||
// layer.debug = true;
|
||||
|
||||
layer.resizeWorld();
|
||||
|
||||
@@ -43,13 +43,10 @@ function create() {
|
||||
emitter.gravity = 150;
|
||||
emitter.bounce.setTo(0.5, 0.5);
|
||||
|
||||
sprite = game.add.sprite(450, 80, 'phaser');
|
||||
sprite = game.add.sprite(200, 70, 'phaser');
|
||||
sprite.anchor.setTo(0.5, 0.5);
|
||||
|
||||
game.camera.follow(sprite);
|
||||
// game.camera.deadzone = new Phaser.Rectangle(160, 160, layer.renderWidth-320, layer.renderHeight-320);
|
||||
|
||||
// game.input.onDown.add(particleBurst, this);
|
||||
|
||||
}
|
||||
|
||||
@@ -57,9 +54,6 @@ function particleBurst() {
|
||||
|
||||
emitter.x = sprite.x;
|
||||
emitter.y = sprite.y;
|
||||
// emitter.x = game.input.worldX;
|
||||
// emitter.y = game.input.worldY;
|
||||
// emitter.start(true, 4000, null, 10);
|
||||
emitter.start(true, 2000, null, 1);
|
||||
|
||||
}
|
||||
|
||||
@@ -370,6 +370,12 @@ Phaser.Sprite = function (game, x, y, key, frame) {
|
||||
*/
|
||||
this.cropEnabled = false;
|
||||
|
||||
/**
|
||||
* @property {boolean} debug - Handy flag to use with Game.enableStep
|
||||
* @default
|
||||
*/
|
||||
this.debug = false;
|
||||
|
||||
this.updateCache();
|
||||
this.updateBounds();
|
||||
|
||||
@@ -600,12 +606,6 @@ Phaser.Sprite.prototype.updateBounds = function() {
|
||||
this.renderable = this._cache.cameraVisible;
|
||||
}
|
||||
|
||||
// Update our physics bounds
|
||||
if (this.body)
|
||||
{
|
||||
this.body.updateScale(this._cache.scaleX, this._cache.scaleY);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -926,6 +926,7 @@ Phaser.Sprite.prototype.reset = function(x, y, health) {
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.world.setTo(x, y);
|
||||
this.position.x = this.x;
|
||||
this.position.y = this.y;
|
||||
this.alive = true;
|
||||
|
||||
@@ -173,10 +173,11 @@ Phaser.Physics.Arcade.POLYGON = 2;
|
||||
Phaser.Physics.Arcade.prototype = {
|
||||
|
||||
/**
|
||||
* Checks the given Physics.Body against the Physics Bounds, if any are set and separates them, setting the blocked flags on the Body as it does so.
|
||||
* Checks the given Physics.Body against the Physics Bounds, if any are set, and separates them, setting the blocked flags on the Body as it does so.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade#checkBounds
|
||||
* @param {Phaser.Physics.Arcade.Body} The Body object to be checked.
|
||||
* @return {boolean} True if the body hit the bounds, otherwise false.
|
||||
*/
|
||||
checkBounds: function (body) {
|
||||
|
||||
@@ -189,6 +190,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
|
||||
var test = SAT.testPolygonPolygon;
|
||||
var part = body.polygon;
|
||||
var rebounded = false;
|
||||
|
||||
if (body.type === Phaser.Physics.Arcade.CIRCLE)
|
||||
{
|
||||
@@ -200,13 +202,17 @@ Phaser.Physics.Arcade.prototype = {
|
||||
{
|
||||
body.blocked.left = true;
|
||||
part.pos.add(this._response.overlapV);
|
||||
console.log('World checkBounds Left', this._response.overlapV);
|
||||
body.blocked.x = Math.floor(body.x);
|
||||
body.blocked.y = Math.floor(body.y);
|
||||
rebounded = true;
|
||||
}
|
||||
else if (this.worldRight && test(this.worldPolys[1], part, this._response))
|
||||
{
|
||||
body.blocked.right = true;
|
||||
part.pos.add(this._response.overlapV);
|
||||
console.log('World checkBounds Right', this._response.overlapV);
|
||||
body.blocked.x = Math.floor(body.x);
|
||||
body.blocked.y = Math.floor(body.y);
|
||||
rebounded = true;
|
||||
}
|
||||
|
||||
this._response.clear();
|
||||
@@ -215,13 +221,24 @@ Phaser.Physics.Arcade.prototype = {
|
||||
{
|
||||
body.blocked.up = true;
|
||||
part.pos.add(this._response.overlapV);
|
||||
console.log('World checkBounds Up', this._response.overlapV);
|
||||
body.blocked.x = Math.floor(body.x);
|
||||
body.blocked.y = Math.floor(body.y);
|
||||
rebounded = true;
|
||||
}
|
||||
else if (this.worldBottom && test(this.worldPolys[3], part, this._response))
|
||||
{
|
||||
body.blocked.down = true;
|
||||
part.pos.add(this._response.overlapV);
|
||||
console.log('World checkBounds Down', this._response.overlapV);
|
||||
body.blocked.x = Math.floor(body.x);
|
||||
body.blocked.y = Math.floor(body.y);
|
||||
rebounded = true;
|
||||
}
|
||||
|
||||
return rebounded;
|
||||
|
||||
if (body.sprite.debug)
|
||||
{
|
||||
console.log('checkBounds finished', body.blocked);
|
||||
}
|
||||
|
||||
},
|
||||
@@ -382,8 +399,8 @@ Phaser.Physics.Arcade.prototype = {
|
||||
|
||||
if (body.sprite.debug)
|
||||
{
|
||||
// console.log('updateMotion: acx', body.acceleration.x, 'acy', body.acceleration.y, 'gravx', this._gravityX, 'gravy', this._gravityY, 'elapsed', this.game.time.physicsElapsed);
|
||||
console.log('updateMotion: rotation', body.rotation, 'vd', this._velocityDelta, 'drag', this._drag, 'acceleration', body.angularAcceleration);
|
||||
console.log('updateMotion: acx', body.acceleration.x, 'acy', body.acceleration.y, 'gravx', this._gravityX, 'gravy', this._gravityY, 'elapsed', this.game.time.physicsElapsed);
|
||||
// console.log('updateMotion: rotation', body.rotation, 'vd', this._velocityDelta, 'drag', this._drag, 'acceleration', body.angularAcceleration);
|
||||
}
|
||||
|
||||
this._p.setTo((body.acceleration.x + this._gravityX) * this.game.time.physicsElapsed, (body.acceleration.y + this._gravityY) * this.game.time.physicsElapsed);
|
||||
@@ -948,7 +965,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// console.log('*** separateTile', tile);
|
||||
// console.log('intersection', this._intersection);
|
||||
|
||||
tile.tile.debug = true;
|
||||
// tile.tile.debug = true;
|
||||
|
||||
// They overlap. Any custom callbacks?
|
||||
if (tile.tile.callback || tile.layer.callbacks[tile.tile.index])
|
||||
@@ -1079,6 +1096,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
body.left -= body.overlapX;
|
||||
body.right -= body.overlapX;
|
||||
body.blocked.x = Math.floor(body.x);
|
||||
body.blocked.y = Math.floor(body.y);
|
||||
body.blocked.left = true;
|
||||
body.touching.left = true;
|
||||
body.touching.none = false;
|
||||
@@ -1089,6 +1107,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
body.left -= body.overlapX;
|
||||
body.right -= body.overlapX;
|
||||
body.blocked.x = Math.floor(body.x);
|
||||
body.blocked.y = Math.floor(body.y);
|
||||
body.blocked.right = true;
|
||||
body.touching.right = true;
|
||||
body.touching.none = false;
|
||||
@@ -1099,6 +1118,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
body.y -= body.overlapY;
|
||||
body.top -= body.overlapY;
|
||||
body.bottom -= body.overlapY;
|
||||
body.blocked.x = Math.floor(body.x);
|
||||
body.blocked.y = Math.floor(body.y);
|
||||
body.blocked.up = true;
|
||||
body.touching.up = true;
|
||||
@@ -1110,6 +1130,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
body.y -= body.overlapY;
|
||||
body.top -= body.overlapY;
|
||||
body.bottom -= body.overlapY;
|
||||
body.blocked.x = Math.floor(body.x);
|
||||
body.blocked.y = Math.floor(body.y);
|
||||
body.blocked.down = true;
|
||||
body.touching.down = true;
|
||||
|
||||
+91
-54
@@ -390,50 +390,82 @@ Phaser.Physics.Arcade.Body.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets this Body to use a convex polygon for all collision. The points are specified in a counter-clockwise direction and must create a convex polygon.
|
||||
* It will be centered on the parent Sprite.
|
||||
* Sets this Body to use a convex polygon for collision.
|
||||
* The points are specified in a counter-clockwise direction and must create a convex polygon.
|
||||
* Use Body.translate and/or Body.offset to re-position the polygon from the Sprite origin.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade#setPolygon
|
||||
* @param {array<SAT.Vector>} points - An array of vectors representing the points in the polygon, in counter-clockwise order.
|
||||
* @param {number} [translateX=0] - The x amount the rectangle will be translated by from the Sprites center.
|
||||
* @param {number} [translateY=0] - The y amount the rectangle will be translated by from the Sprites center.
|
||||
* @param {array<SAT.Vector>|Array<Number>|SAT.Vector...|Number...} points - This can be an array of Vectors that form the polygon,
|
||||
* a flat array of numbers that will be interpreted as [x,y, x,y, ...], or the arguments passed can be
|
||||
* all the points of the polygon e.g. `setPolygon(new SAT.Vector(), new SAT.Vector(), ...)`, or the
|
||||
* arguments passed can be flat x,y values e.g. `setPolygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.
|
||||
*/
|
||||
setPolygon: function (points, translateX, translateY) {
|
||||
|
||||
if (typeof translateX === 'undefined') { translateX = 0; }
|
||||
if (typeof translateY === 'undefined') { translateY = 0; }
|
||||
setPolygon: function (points) {
|
||||
|
||||
this.type = Phaser.Physics.Arcade.POLYGON;
|
||||
this.shape = null;
|
||||
|
||||
if (!(points instanceof Array))
|
||||
{
|
||||
points = Array.prototype.slice.call(arguments);
|
||||
}
|
||||
|
||||
if (typeof points[0] === 'number')
|
||||
{
|
||||
var p = [];
|
||||
|
||||
for (var i = 0, len = points.length; i < len; i += 2)
|
||||
{
|
||||
p.push(new SAT.Vector(points[i], points[i + 1]));
|
||||
}
|
||||
|
||||
points = p;
|
||||
}
|
||||
|
||||
this.polygon = new SAT.Polygon(new SAT.Vector(this.sprite.center.x, this.sprite.center.y), points);
|
||||
this.polygon.translate(translateX, translateY);
|
||||
|
||||
this.offset.setTo(0, 0);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Used for translating rectangle and polygon bodies from the Sprite parent. Doesn't apply to Circles.
|
||||
* See also the Body.offset property.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade#translate
|
||||
* @param {number} x - The x amount the polygon or rectangle will be translated by from the Sprite.
|
||||
* @param {number} y - The y amount the polygon or rectangle will be translated by from the Sprite.
|
||||
*/
|
||||
translate: function (x, y) {
|
||||
|
||||
if (this.polygon)
|
||||
{
|
||||
this.polygon.translate(x, y);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Internal method.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade#updateScale
|
||||
* @private
|
||||
*/
|
||||
updateScale: function (scaleX, scaleY) {
|
||||
updateScale: function () {
|
||||
|
||||
if (scaleX != this._sx || scaleY != this._sy)
|
||||
if (this.polygon)
|
||||
{
|
||||
if (this.polygon)
|
||||
{
|
||||
this.polygon.scale(scaleX / this._sx, scaleY / this._sy);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.shape.r *= Math.max(scaleX, scaleY);
|
||||
}
|
||||
|
||||
this._sx = scaleX;
|
||||
this._sy = scaleY;
|
||||
this.polygon.scale(this.sprite.scale.x / this._sx, this.sprite.scale.y / this._sy);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.shape.r *= Math.max(this.sprite.scale.x, this.sprite.scale.y);
|
||||
}
|
||||
|
||||
this._sx = this.sprite.scale.x;
|
||||
this._sy = this.sprite.scale.y;
|
||||
|
||||
console.log('updateScale', this.sprite.scale.x, this.sprite.scale.y);
|
||||
|
||||
},
|
||||
|
||||
@@ -449,19 +481,21 @@ Phaser.Physics.Arcade.Body.prototype = {
|
||||
this.preY = this.y;
|
||||
this.preRotation = this.sprite.angle;
|
||||
|
||||
// this.x = this.sprite.world.x + this.offset.x;
|
||||
// this.y = this.sprite.world.y + this.offset.y;
|
||||
|
||||
this.x = (this.sprite.world.x - (this.sprite.anchor.x * this.sprite.width)) + this.offset.x;
|
||||
this.y = (this.sprite.world.y - (this.sprite.anchor.y * this.sprite.height)) + this.offset.y;
|
||||
this.rotation = this.preRotation;
|
||||
|
||||
if (this.sprite.scale.x !== this._sx || this.sprite.scale.y !== this._sy)
|
||||
{
|
||||
this.updateScale();
|
||||
}
|
||||
|
||||
if (this.sprite.debug)
|
||||
{
|
||||
// console.log('Body preUpdate x:', this.x, 'y:', this.y, 'left:', this.left, 'right:', this.right, 'WAS', this.preX, this.preY);
|
||||
// console.log('Body preUpdate blocked:', this.blocked, this.blockFlags);
|
||||
// console.log('Body preUpdate velocity:', this.velocity.x, this.velocity.y);
|
||||
console.log('Body preUpdate rotation:', this.rotation, this.preRotation);
|
||||
console.log('Body preUpdate x:', this.x, 'y:', this.y, 'left:', this.left, 'right:', this.right, 'WAS', this.preX, this.preY);
|
||||
console.log('Body preUpdate blocked:', this.blocked, this.blockFlags);
|
||||
console.log('Body preUpdate velocity:', this.velocity.x, this.velocity.y);
|
||||
// console.log('Body preUpdate rotation:', this.rotation, this.preRotation);
|
||||
}
|
||||
|
||||
this.checkBlocked();
|
||||
@@ -487,7 +521,10 @@ if (this.sprite.debug)
|
||||
}
|
||||
}
|
||||
|
||||
this.game.physics.checkBounds(this);
|
||||
if (this.game.physics.checkBounds(this))
|
||||
{
|
||||
this.reboundCheck(true, true, true);
|
||||
}
|
||||
|
||||
this.applyFriction();
|
||||
|
||||
@@ -514,16 +551,16 @@ if (this.sprite.debug)
|
||||
|
||||
checkBlocked: function () {
|
||||
|
||||
if (this.blocked.left || this.blocked.right && (Math.floor(this.x) !== this.blocked.x || Math.floor(this.y) !== this.blocked.y))
|
||||
if ((this.blocked.left || this.blocked.right) && (Math.floor(this.x) !== this.blocked.x || Math.floor(this.y) !== this.blocked.y))
|
||||
{
|
||||
// console.log('resetBlocked unlocked left + right');
|
||||
// console.log('resetBlocked unlocked left + right', Math.floor(this.x), this.blocked.x);
|
||||
this.blocked.left = false;
|
||||
this.blocked.right = false;
|
||||
}
|
||||
|
||||
if (this.blocked.up || this.blocked.down && (this.x !== this.blocked.x || this.y !== this.blocked.y))
|
||||
if ((this.blocked.up || this.blocked.down) && (Math.floor(this.x) !== this.blocked.x || Math.floor(this.y) !== this.blocked.y))
|
||||
{
|
||||
// console.log('resetBlocked unlocked up + down');
|
||||
// console.log('resetBlocked unlocked up + down', Math.floor(this.y), this.blocked.y, 'x', Math.floor(this.x), this.blocked.x);
|
||||
this.blocked.up = false;
|
||||
this.blocked.down = false;
|
||||
}
|
||||
@@ -608,8 +645,8 @@ if (this.sprite.debug)
|
||||
|
||||
if (this.sprite.debug)
|
||||
{
|
||||
// console.log('reboundCheck start', this.velocity.x, this.velocity.y);
|
||||
// console.log('reBound blocked state', this.blocked);
|
||||
console.log('reboundCheck start', this.velocity.x, this.velocity.y);
|
||||
console.log('reBound blocked state', this.blocked);
|
||||
}
|
||||
|
||||
if (x)
|
||||
@@ -621,7 +658,7 @@ if (this.sprite.debug)
|
||||
|
||||
if (this.sprite.debug)
|
||||
{
|
||||
// console.log('X rebound applied');
|
||||
console.log('X rebound applied');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -635,14 +672,14 @@ if (this.sprite.debug)
|
||||
|
||||
if (this.sprite.debug)
|
||||
{
|
||||
// console.log('reboundCheck X zeroed');
|
||||
console.log('reboundCheck X zeroed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.sprite.debug)
|
||||
{
|
||||
// console.log('reboundCheck X', this.velocity.x, 'gravity', gx);
|
||||
console.log('reboundCheck X', this.velocity.x, 'gravity', gx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -655,7 +692,7 @@ if (this.sprite.debug)
|
||||
|
||||
if (this.sprite.debug)
|
||||
{
|
||||
// console.log('Y rebound applied');
|
||||
console.log('Y rebound applied');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -669,14 +706,14 @@ if (this.sprite.debug)
|
||||
|
||||
if (this.sprite.debug)
|
||||
{
|
||||
// console.log('reboundCheck Y zeroed');
|
||||
console.log('reboundCheck Y zeroed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.sprite.debug)
|
||||
{
|
||||
// console.log('reboundCheck Y', this.velocity.y, 'gravity', gy);
|
||||
console.log('reboundCheck Y', this.velocity.y, 'gravity', gy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -887,7 +924,7 @@ if (this.sprite.debug)
|
||||
*/
|
||||
overlap: function (body, response) {
|
||||
|
||||
if (this.type === Phaser.Physics.Arcade.RECT && body.type === Phaser.Physics.Arcade.RECT)
|
||||
if ((this.type === Phaser.Physics.Arcade.RECT || this.type === Phaser.Physics.Arcade.POLYGON) && (body.type === Phaser.Physics.Arcade.RECT || body.type === Phaser.Physics.Arcade.POLYGON))
|
||||
{
|
||||
return SAT.testPolygonPolygon(this.polygon, body.polygon, response);
|
||||
}
|
||||
@@ -895,11 +932,11 @@ if (this.sprite.debug)
|
||||
{
|
||||
return SAT.testCircleCircle(this.shape, body.shape, response);
|
||||
}
|
||||
else if (this.type === Phaser.Physics.Arcade.RECT && body.type === Phaser.Physics.Arcade.CIRCLE)
|
||||
else if ((this.type === Phaser.Physics.Arcade.RECT || this.type === Phaser.Physics.Arcade.POLYGON) && body.type === Phaser.Physics.Arcade.CIRCLE)
|
||||
{
|
||||
return SAT.testPolygonCircle(this.polygon, body.shape, response);
|
||||
}
|
||||
else if (this.type === Phaser.Physics.Arcade.CIRCLE && body.type === Phaser.Physics.Arcade.RECT)
|
||||
else if (this.type === Phaser.Physics.Arcade.CIRCLE && (body.type === Phaser.Physics.Arcade.RECT || body.type === Phaser.Physics.Arcade.POLYGON))
|
||||
{
|
||||
return SAT.testCirclePolygon(this.shape, body.polygon, response);
|
||||
}
|
||||
@@ -1279,21 +1316,18 @@ if (this.sprite.debug)
|
||||
|
||||
if (this.deltaX() !== 0 || this.deltaY() !== 0)
|
||||
{
|
||||
// this.sprite.worldTransform[2] = this.sprite.x = (this.x - this.offset.x);
|
||||
// this.sprite.worldTransform[5] = this.sprite.y = (this.y - this.offset.y);
|
||||
|
||||
this.sprite.worldTransform[2] = this.sprite.x = (this.x + (this.sprite.anchor.x * this.sprite.width) - this.offset.x);
|
||||
this.sprite.worldTransform[5] = this.sprite.y = (this.y + (this.sprite.anchor.y * this.sprite.height) - this.offset.y);
|
||||
|
||||
// this.x = (this.sprite.world.x - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
// this.y = (this.sprite.world.y - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
}
|
||||
|
||||
if (this.allowRotation && this.deltaZ() !== 0)
|
||||
{
|
||||
// this.sprite.rotation = this.rotation;
|
||||
this.sprite.angle += this.deltaZ();
|
||||
// this.sprite.angle = this.angle;
|
||||
}
|
||||
|
||||
if (this.sprite.scale.x !== this._sx || this.sprite.scale.y !== this._sy)
|
||||
{
|
||||
this.updateScale();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1322,6 +1356,9 @@ if (this.sprite.debug)
|
||||
this.friction = 0.1;
|
||||
this.checkCollision = { none: false, any: true, up: true, down: true, left: true, right: true };
|
||||
this.blocked = { x: 0, y: 0, up: false, down: false, left: false, right: false };
|
||||
this.x = (this.sprite.world.x - (this.sprite.anchor.x * this.sprite.width)) + this.offset.x;
|
||||
this.y = (this.sprite.world.y - (this.sprite.anchor.y * this.sprite.height)) + this.offset.y;
|
||||
this.updateBounds();
|
||||
|
||||
},
|
||||
|
||||
|
||||
@@ -868,6 +868,7 @@ Phaser.Utils.Debug.prototype = {
|
||||
|
||||
for (var i = 1; i < points.length; i++)
|
||||
{
|
||||
this.context.fillStyle = 'rgb(255,' + (i * 40) + ',0)';
|
||||
this.context.fillRect(x + points[i].x - 2, y + points[i].y - 2, 5, 5);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user