Class: IsoSprite

.Isometric. IsoSprite

Create a new IsoSprite object. IsoSprites are extended versions of standard Sprites that are suitable for axonometric positioning.

IsoSprites are simply Sprites that have three new position properties (isoX, isoY and isoZ) and ask the instance of Phaser.Plugin.Isometric.Projector what their position should be in a 2D scene whenever these properties are changed. The IsoSprites retain their 2D position property to prevent any problems and allow you to interact with them as you would a normal Sprite. The upside of this simplicity is that things should behave predictably for those already used to Phaser.

new IsoSprite(game, x, y, z, key, frame)

Parameters:
Name Type Description
game Phaser.Game

A reference to the currently running game.

x number

The x coordinate (in 3D space) to position the IsoSprite at.

y number

The y coordinate (in 3D space) to position the IsoSprite at.

z number

The z coordinate (in 3D space) to position the IsoSprite at.

key string | Phaser.RenderTexture | Phaser.BitmapData | PIXI.Texture

This is the image or texture used by the IsoSprite 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

If this IsoSprite 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.

Source:

Extends

  • Phaser.Sprite

Members

<readonly> depth

The non-unit distance of the IsoSprite from the 'front' of the scene. Used to correctly depth sort a group of IsoSprites.

Properties:
Name Type Description
depth number

A calculated value used for depth sorting.

Source:

<readonly> isoBounds

A Cube object representing the derived boundsof the IsoSprite.

Properties:
Name Type Description
isoBounds Point3

The derived 3D bounds of the IsoSprite.

Source:

<readonly> isoPosition

A Point3 object representing the axonometric position of the IsoSprite.

Properties:
Name Type Description
isoPosition Point3

The axonometric position of the IsoSprite.

Source:

isoX

The axonometric position of the IsoSprite on the x axis. Increasing the x coordinate will move the object down and to the right on the screen.

Properties:
Name Type Description
isoX number

The axonometric position of the IsoSprite on the x axis.

Source:

isoY

The axonometric position of the IsoSprite on the y axis. Increasing the y coordinate will move the object down and to the left on the screen.

Properties:
Name Type Description
isoY number

The axonometric position of the IsoSprite on the y axis.

Source:

isoZ

The axonometric position of the IsoSprite on the z axis. Increasing the z coordinate will move the object directly upwards on the screen.

Properties:
Name Type Description
isoZ number

The axonometric position of the IsoSprite on the z axis.

Source:

snap

Properties:
Name Type Description
snap number

Snap this IsoSprite's position to the specified value; handy for keeping pixel art snapped to whole pixels.

Default Value:
  • 0
Source:

<readonly> type

Properties:
Name Type Description
type number

The const type of this object.

Source:

Methods

postUpdate()

Internal function called by the World postUpdate cycle.

Source: