image(x, y, key, frame) → {Phaser.Image}
Create a new Image object.
An Image is a light-weight object you can use to display anything that doesn't need physics or animation.
It can still rotate, scale, crop and receive input events. This makes it perfect for logos, backgrounds, simple buttons and other non-Sprite graphics.
Parameters
Name | Type | Argument | Description |
---|---|---|---|
x | number | X position of the image. | |
y | number | Y position of the image. | |
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 33)
Please login to continue.