Class: Tilemap

Inherits:
Object
  • Object
show all
Defined in:
lib/tilemap.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(viewport = nil) ⇒ Tilemap

Returns a new instance of Tilemap.



42
43
44
45
46
# File 'lib/tilemap.rb', line 42

def initialize(viewport = nil)
  raise "not implemented"
  
  @viewport = viewport
end

Instance Attribute Details

#autotilesBitmap

Refers to the Bitmap used as an autotile with an index number from 0 to 6.

Returns:



10
11
12
# File 'lib/tilemap.rb', line 10

def autotiles
  @autotiles
end

#flash_dataTable

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).

Returns:



24
25
26
# File 'lib/tilemap.rb', line 24

def flash_data
  @flash_data
end

#map_dataTable

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

Returns:

  • (Table)

    the map data in the form of a 3-dimensional array measuring [ horizontal size * vertical size * 3 ].



16
17
18
# File 'lib/tilemap.rb', line 16

def map_data
  @map_data
end

#oxObject

The X-coordinate of the tilemap’s starting point. Change this value to scroll the tilemap.



36
37
38
# File 'lib/tilemap.rb', line 36

def ox
  @ox
end

#oyObject

The Y-coordinate of the tilemap’s starting point. Change this value to scroll the tilemap.



40
41
42
# File 'lib/tilemap.rb', line 40

def oy
  @oy
end

#prioritiesBitmap

Reference to the priority Table. Defines a 1-dimensional array containing elements corresponding to tile IDs.

Returns:



29
30
31
# File 'lib/tilemap.rb', line 29

def priorities
  @priorities
end

#tilesetBitmap

Refers to the Bitmap used as a tileset.

Returns:



6
7
8
# File 'lib/tilemap.rb', line 6

def tileset
  @tileset
end

#visibleObject

The tilemap’s visibility. If TRUE, the tilemap is visible.



32
33
34
# File 'lib/tilemap.rb', line 32

def visible
  @visible
end

Instance Method Details

#disposedObject

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



49
50
51
52
53
# File 'lib/tilemap.rb', line 49

def disposed()
  raise "not implemented"
  
  @disposed = true
end

#disposed?Boolean

Returns TRUE if the tilemap has been freed.

Returns:

  • (Boolean)


56
57
58
# File 'lib/tilemap.rb', line 56

def disposed?()
  @disposed
end