TileMap
A grid of tiles from one tile set image, with solid tiles that block movement in a World2D.
Inherits Instance.
Made with Instance.new("TileMap").
Properties
| Name | Type | Notes |
|---|---|---|
CanCollide | boolean | Whether its solid tiles block World2D:Move. |
CanQuery | boolean | Whether raycasts and overlap queries find its solid tiles. |
CellSize | Vector2 | The size of one cell in the world. Zero means TileSize. |
Cells | string | Every cell as x,y,tile entries separated by semicolons, as places save them. |
Color | Color | Tints every tile. |
Columns | number | Tiles to a row of the tile set. Zero fits as many as the image is wide. |
Pixelated | boolean | Draws pixel art crisp when true, and smooths it when false. |
Position | Vector2 | Where the top left of cell 0, 0 is in the world. |
SolidTiles | string | The solid tile numbers separated by commas. |
TileSet | string | The tile set image, relative to the project, or an http URL. A URL needs the Http permission. |
TileSize | Vector2 | The size of one tile in the image, in pixels. |
Transparency | number | From 0, opaque, to 1, invisible. |
Visible | boolean | Whether it is drawn. Hidden tiles still collide. |
ZIndex | number | Higher draws on top of sprites and other maps. |
Methods
CellToWorld(cell: Vector2): Vector2: The top left corner of a cell in the world.Clear(): (): Empties every cell.Fill(from: Vector2, to: Vector2, tile: number): (): Puts a tile in every cell of a rectangle, corners included.GetCell(x: number, y: number): number: The tile in a cell, or -1 for an empty one.GetUsedCells(): {Vector2}: The cells that hold a tile.IsCellSolid(x: number, y: number): boolean: Whether a cell holds a solid tile.IsTileSolid(tile: number): boolean: Whether a tile number is solid.SetCell(x: number, y: number, tile: number): (): Puts a tile in a cell, or empties it with -1.SetTileSolid(tile: number, solid: boolean?): (): Marks a tile number solid, or not.WorldToCell(position: Vector2): Vector2: The cell holding a point in the world.
Inherited
From Instance: AddTag, AncestryChanged, Archivable, AttributeChanged, Changed, ChildAdded, ChildRemoved, ClassName, ClearAllChildren, Clone, DescendantAdded, DescendantRemoving, Destroy, Destroying, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, GetDescendants, GetFullName, GetPropertyChangedSignal, GetTags, HasTag, IsA, IsAncestorOf, IsDescendantOf, IsPropertyModified, Name, Parent, QueryDescendants, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild.