.. include:: ../_header.rst TileSprite ---------- The `Tile Sprite `_ is a built-in Phaser_ object type: `Phaser.GameObjects.TileSprite `_. This type allows creating objects with repeating textures, like background elements. A `Tile Sprite`_ is created in code using the `tileSprite factory `_. This is how the |SceneCompiler|_ generates the code of a `Tile Sprite`_: .. code:: // x = 0, y = 600, width = 600, height = 800, texture = "rocks_1" const rocks = this.add.tileSprite(0, 600, 800, 225, "rocks_1"); To create a `Tile Sprite`_ object in the scene, you can drop a `TileSprite built-in block `_ on the scene. .. image:: ../images/scene-editor-tile-sprite-block-09252020.webp :alt: Create default TileSprite object. Or `convert an Image or Sprite into a Tile Sprite `_. Tile Sprite properties ~~~~~~~~~~~~~~~~~~~~~~ The `Tile Sprite`_ type shares properties with other object types: * `Variable properties `_ * `Lists properties `_ * `Transform properties `_ * `Origin properties `_ * `Size properties `_ * `Flip properties `_ * `Visible property `_ * `Alpha properties `_ * `Texture property `_ But also it has particular properties: .. image:: ../images/scene-editor-tile-sprite-props-04152020.webp :alt: Tile sprite object. * The `width `_ and `height `_ size properties. If the size of the object is bigger than the original texture, then the object is rendered repeating the texture. You can change these properties in the |InspectorView|_ or using the `Resize manipulator tool `_: press the ``Z`` key or select **Tools** |-| **Resize Tool** in the context menu. * The `tilePositionX `_ and `tilePositionY `_ properties. It changes the offset of the original texture rendering. You can modify it in the |InspectorView|_. * The `tileScaleX `_ and `tileScaleY `_ properties. It changes the scale of the original texture rendering (not the scale of the object). You can modify it in the |InspectorView|_.