fixedToCamera now works across all display objects. When enabled it will fix at its current x/y coordinate, but can be changed via cameraOffset.

fixedToCamrea now works for Groups as well :) You can fix a Group to the camera and it will influence its children.
Also fixed the issue with World.preUpdate/postUpdate not being called and various small documentation issues.
This commit is contained in:
photonstorm
2014-02-15 01:27:42 +00:00
parent e5a4620b87
commit e5e643b103
13 changed files with 717 additions and 97 deletions
+26
View File
@@ -675,6 +675,32 @@ Phaser.Physics.Body.prototype = {
},
/**
* Reads the physics data from a physics data file stored in the Game.Cache.
* It will add the shape data to this Body, as well as set the density (mass), friction and bounce (restitution) values.
*
* @method Phaser.Physics.Body#loadPolygon
* @param {string} key - The key of the Physics Data file as stored in Game.Cache.
* @param {string} object - The key of the object within the Physics data file that you wish to load the shape data from.
* @param {object} options - An object containing the build options:
* @param {boolean} [options.optimalDecomp=false] - Set to true if you need optimal decomposition. Warning: very slow for polygons with more than 10 vertices.
* @param {boolean} [options.skipSimpleCheck=false] - Set to true if you already know that the path is not intersecting itself.
* @param {boolean|number} [options.removeCollinearPoints=false] - Set to a number (angle threshold value) to remove collinear points, or false to keep all points.
* @return {boolean} True on success, else false.
*/
loadData: function (key, object, options) {
var data = game.cache.getPhysicsData(key, object);
if (data && data.shape)
{
this.mass = data.density;
// set friction + bounce here
this.loadPolygon(key, object);
}
},
/**
* Convert p2 physics value to pixel scale.
*