Tilemap

The class governing tilemaps. Tilemaps are a specialized concept used in 2D game map displays, created internally from multiple sprites.

Superclass

Class Method

Tilemap.new([viewport])

Creates a Tilemap object. Specifies a viewport (Viewport) when necessary.

Methods

dispose

Frees the tilemap. If the tilemap has already been freed, does nothing.

disposed?

Returns TRUE if the tilemap has been freed.

update

Updates the autotile animation etc. As a general rule, this method is called once per frame.

Properties

bitmaps[index]

Refers to the bitmap (Bitmap) indicated by the index number (0 - 8) that is used as a tile set.

The correspondence between numbers and sets is illustrated in the table below.

0TileA1 1TileA2 2TileA3
3TileA4 4TileA5 5TileB
6TileC 7TileD 8TileE
map_data

Refers to map data (Table). Defines a 3-dimensional array measuring [ horizontal size * vertical size * 3 ].

flash_data

Refers to the flash data (Table) used when showing range of possible movement in simulation games etc. Defines a 2-dimensional array measuring [ horizontal size * vertical size ]. This array must be the same size as the map data. Each element uses 4 bits to represent a tile's flash color in RGB; for example, 0xf84 flashes in RGB(15,8,4).

flags (RGSS3)

Refers to the flags table (Table). Defines a 1-dimensional array containing elements corresponding to tile IDs.

viewport

Refers to the viewport (Viewport) associated with the tilemap.

visible

The tilemap's visibility. If TRUE, the tilemap is visible. The default is TRUE.

ox

The x-coordinate of the tilemap's starting point. Change this value to scroll the tilemap.

oy

The y-coordinate of the tilemap's starting point. Change this value to scroll the tilemap.

Notes

The z-coordinate of each sprite used to create a tilemap is fixed to a specific value.

  1. A tile that should be displayed under the character has a Z coordinate of 0.
  2. A tile that should be displayed over the character has a Z coordinate of 200.

Keep these rules in mind when setting the z-coordinates of any map characters.