mirror of
https://github.com/wassname/phaser.git
synced 2026-09-10 12:29:30 +08:00
Sorted out the bounds for when sprites are in trimmed texture atlases to stop the physics checks going insane. Also bundled in Advanced Physics lib, although not hooked up yet.
This commit is contained in:
+20
-1
@@ -14,6 +14,10 @@ Phaser.Animation.Frame = function (x, y, width, height, name, uuid) {
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.sourceSizeW = width;
|
||||
this.sourceSizeH = height;
|
||||
this.centerX = Math.floor(width / 2);
|
||||
this.centerY = Math.floor(height / 2);
|
||||
this.name = name;
|
||||
this.uuid = uuid;
|
||||
this.distance = Phaser.Math.distance(0, 0, width, height);
|
||||
@@ -51,6 +55,18 @@ Phaser.Animation.Frame.prototype = {
|
||||
*/
|
||||
height: 0,
|
||||
|
||||
/**
|
||||
* center X position within the image to cut from.
|
||||
* @type {number}
|
||||
*/
|
||||
centerX: 0,
|
||||
|
||||
/**
|
||||
* center Y position within the image to cut from.
|
||||
* @type {number}
|
||||
*/
|
||||
centerY: 0,
|
||||
|
||||
/**
|
||||
* The distance from the top left to the bottom-right of this Frame.
|
||||
* @type {number}
|
||||
@@ -136,11 +152,14 @@ Phaser.Animation.Frame.prototype = {
|
||||
|
||||
this.trimmed = trimmed;
|
||||
|
||||
if (trimmed) {
|
||||
if (trimmed)
|
||||
{
|
||||
this.width = actualWidth;
|
||||
this.height = actualHeight;
|
||||
this.sourceSizeW = actualWidth;
|
||||
this.sourceSizeH = actualHeight;
|
||||
this.centerX = Math.floor(actualWidth / 2);
|
||||
this.centerY = Math.floor(actualHeight / 2);
|
||||
this.spriteSourceSizeX = destX;
|
||||
this.spriteSourceSizeY = destY;
|
||||
this.spriteSourceSizeW = destWidth;
|
||||
|
||||
Reference in New Issue
Block a user