mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 05:03:37 +00:00
Moved position update to earlier (was too soon)
This commit is contained in:
parent
15ac5e736a
commit
b92e8e9a60
1 changed files with 6 additions and 6 deletions
|
@ -45,7 +45,7 @@ var Axes = require('../geometry/Axes');
|
|||
plugin: {},
|
||||
angle: 0,
|
||||
vertices: Vertices.fromPath('L 0 0 L 40 0 L 40 40 L 0 40'),
|
||||
centerOfMass: { x: 0, y: 0 },
|
||||
centerOfMass: { x: 0, y: 0 }, // custom Phaser property
|
||||
position: { x: 0, y: 0 },
|
||||
force: { x: 0, y: 0 },
|
||||
torque: 0,
|
||||
|
@ -108,6 +108,11 @@ var Axes = require('../geometry/Axes');
|
|||
_original: null
|
||||
};
|
||||
|
||||
if (!options.hasOwnProperty('position') && options.hasOwnProperty('vertices'))
|
||||
{
|
||||
options.position = Vertices.centre(options.vertices);
|
||||
}
|
||||
|
||||
var body = Common.extend(defaults, options);
|
||||
|
||||
_initProperties(body, options);
|
||||
|
@ -151,11 +156,6 @@ var Axes = require('../geometry/Axes');
|
|||
var _initProperties = function(body, options) {
|
||||
options = options || {};
|
||||
|
||||
if (!options.hasOwnProperty('position'))
|
||||
{
|
||||
body.position = Vertices.centre(body.vertices);
|
||||
}
|
||||
|
||||
// init required properties (order is important)
|
||||
Body.set(body, {
|
||||
bounds: body.bounds || Bounds.create(body.vertices),
|
||||
|
|
Loading…
Reference in a new issue