You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* The rectangular area from the texture that will be rendered.
122
-
* @property {Phaser.Rectangle} textureRegion
123
-
*/
124
-
// this.textureRegion = new Phaser.Rectangle(this.texture.frame.x, this.texture.frame.y, this.texture.frame.width, this.texture.frame.height);
65
+
this.loadTexture(key,frame);
125
66
126
67
this.position.x=x;
127
68
this.position.y=y;
@@ -142,17 +83,13 @@ Phaser.Image = function (game, x, y, key, frame) {
142
83
this.autoCull=false;
143
84
144
85
/**
145
-
* A Sprite that is fixed to the camera ignores the position of any ancestors in the display list and uses its x/y coordinates as offsets from the top left of the camera.
86
+
* A Sprite that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera.
87
+
* Note that if this Image is a child of a display object that has changed its position then the offset will be calculated from that.
146
88
* @property {boolean} fixedToCamera - Fixes this Sprite to the Camera.
147
89
* @default
148
90
*/
149
91
this.fixedToCamera=false;
150
92
151
-
/**
152
-
* @property {Phaser.Point} cameraOffset - If this Sprite is fixed to the camera then use this Point to specify how far away from the Camera x/y it's rendered.
@@ -307,31 +239,19 @@ Phaser.Image.prototype.loadTexture = function (key, frame) {
307
239
};
308
240
309
241
/**
310
-
* Moves the sprite so its center is located on the given x and y coordinates.
311
-
* Doesn't change the anchor point of the sprite.
312
-
*
313
-
* @method Phaser.Image#centerOn
242
+
* Crop allows you to crop the texture used to display this Image. Cropping takes place from the top-left of the Image and can be modified in real-time.
243
+
*
244
+
* @method Phaser.Image#crop
314
245
* @memberof Phaser.Image
315
-
* @param {number} x - The x coordinate (in world space) to position the Sprite at.
316
-
* @param {number} y - The y coordinate (in world space) to position the Sprite at.
this.cameraOffset.x = x + (this.cameraOffset.x - this.center.x);
323
-
this.cameraOffset.y = y + (this.cameraOffset.y - this.center.y);
324
-
}
325
-
else
326
-
{
327
-
this.x = x + (this.x - this.center.x);
328
-
this.y = y + (this.y - this.center.y);
329
-
}
246
+
* @param {number} frame - If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
* Indicates the rotation of the Sprite, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.
471
391
* Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90.
472
-
* If you wish to work in radians instead of degrees use the property Sprite.rotation instead.
473
-
* @name Phaser.Image#angle
474
-
* @property {number} angle - Gets or sets the Sprites angle of rotation in degrees.
392
+
* If you wish to work in radians instead of degrees use the property Sprite.rotation instead. Working in radians is also computationally faster.
393
+
*
394
+
* @method Phaser.Image#angle
395
+
* @memberof Phaser.Image
396
+
* @param {number} [value] - If given it will set the Images angle to this value. Value should be given in degrees.
397
+
* @return {number} The angle of this Image in degrees.
0 commit comments