mirror of
https://github.com/wassname/phaser.git
synced 2026-07-04 17:20:31 +08:00
Testing new Image object.
This commit is contained in:
@@ -39,6 +39,25 @@ Phaser.GameObjectFactory.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a new Image at the given coordinates, using the cache key and frame if set.
|
||||
*
|
||||
* @method Phaser.GameObjectFactory#image
|
||||
* @param {number} x - X position of the image.
|
||||
* @param {number} y - Y position of the image.
|
||||
* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
|
||||
* @param {string|number} [frame] - If the sprite uses an image from a texture atlas or sprite sheet you can pass the frame here. Either a number for a frame ID or a string for a frame name.
|
||||
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
|
||||
* @returns {Phaser.Sprite} the newly created sprite object.
|
||||
*/
|
||||
image: function (x, y, key, frame, group) {
|
||||
|
||||
if (typeof group === 'undefined') { group = this.world; }
|
||||
|
||||
return group.add(new Phaser.Image(this.game, x, y, key, frame));
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a new Sprite with specific position and sprite sheet key.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user