GameObjectCreator#sprite()

sprite(x, y, key, frame) → {Phaser.Sprite}

Create a new Sprite with specific position and sprite sheet key.

Parameters
Name Type Argument Description
x number

X position of the new sprite.

y number

Y position of the new sprite.

key string | Phaser.RenderTexture | PIXI.Texture

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.

frame string | number <optional>

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.

Returns

the newly created sprite object.

Source code: gameobjects/GameObjectCreator.js (Line 52)
doc_phaser
2017-02-14 10:48:34
Comments
Leave a Comment

Please login to continue.