GameObjectFactory#image()

image(x, y, key, frame, group) → {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 Default Description
x number <optional>
0

The x coordinate of the Image. The coordinate is relative to any parent container this Image may be in.

y number <optional>
0

The y coordinate of the Image. The coordinate is relative to any parent container this Image may be in.

key string | Phaser.RenderTexture | Phaser.BitmapData | Phaser.Video | PIXI.Texture <optional>

The image used as a texture by this display object during rendering. If a string Phaser will get for an entry in the Image Cache. Or it can be an instance of a RenderTexture, BitmapData, Video or PIXI.Texture.

frame string | number <optional>

If a Texture Atlas or Sprite Sheet is used this allows you to specify the frame to be used. Use either an integer for a Frame ID or a string for a frame name.

group Phaser.Group <optional>

Optional Group to add the object to. If not specified it will be added to the World group.

Returns

The newly created Image object.

Source code: gameobjects/GameObjectFactory.js (Line 78)
doc_phaser
2017-02-14 10:48:43
Comments
Leave a Comment

Please login to continue.