Skip to main content
Version: Phaser v4.0.0

TransformerTileSprite

A RenderNode that computes and stores the world-space transformation data required to render a TileSprite GameObject.

This class extends TransformerImage with one key difference: whereas TransformerImage derives the quad dimensions from the texture frame, TransformerTileSprite reads them directly from the GameObject's width and height properties. This is necessary because a TileSprite can have an arbitrary size that is independent of its underlying tile texture.

During its run call, the node builds a combined camera-and-sprite transform matrix (accounting for scroll factors, an optional parent matrix, rotation, scale, and flip), projects the GameObject's bounding quad into screen space, and optionally rounds the resulting vertices for crisp pixel-aligned rendering. The resulting quad coordinates are stored on this.quad for use by downstream render nodes (e.g. texturer and batcher nodes) in the same render pass.

Constructor

new TransformerTileSprite(manager, [config])

Parameters

nametypeoptionaldescription
managerPhaser.Renderer.WebGL.RenderNodes.RenderNodeManagerNoThe manager that owns this RenderNode.
configobjectYesThe configuration object for this RenderNode.

Scope: static

Extends

Phaser.Renderer.WebGL.RenderNodes.TransformerImage

Source: src/renderer/webgl/renderNodes/transformer/TransformerTileSprite.js#L10
Since: 4.0.0

Inherited Methods

From Phaser.Renderer.WebGL.RenderNodes.RenderNode:


Public Methods

run

<instance> run(drawingContext, gameObject, [texturerNode], [parentMatrix], [element])

Description:

Computes the screen-space quad for a TileSprite GameObject and stores it in this.quad for use by downstream render nodes.

The method reads the GameObject's own width and height (rather than frame dimensions), applies the display origin offset, handles horizontal and vertical flipping, then builds a combined transform matrix from the camera view, the optional parent matrix, and the sprite's own position, rotation, and scale. The resulting four corner coordinates are written into this.quad, and are pixel-rounded if vertex rounding is required for this GameObject and camera combination.

Parameters:

nametypeoptionaldescription
drawingContextPhaser.Renderer.WebGL.DrawingContextNoThe current drawing context.
gameObjectPhaser.GameObjects.GameObjectNoThe GameObject being rendered.
texturerNodePhaser.Renderer.WebGL.RenderNodes.RenderNodeYesThe texturer node used to texture the GameObject. This contains relevant data on the dimensions of the object. It is unused here.
parentMatrixPhaser.GameObjects.Components.TransformMatrixYesThis transform matrix is defined if the game object is nested.
elementobjectYesThe specific element within the game object. This is used for objects that consist of multiple quads. It is unused here.

Overrides: Phaser.Renderer.WebGL.RenderNodes.TransformerImage#run

Source: src/renderer/webgl/renderNodes/transformer/TransformerTileSprite.js#L50
Since: 4.0.0


Inherited Members

From Phaser.Renderer.WebGL.RenderNodes.RenderNode:

From Phaser.Renderer.WebGL.RenderNodes.TransformerImage: