class DragonSkeleton::Tilemap::Cell

A single cell in a tilemap.

A cell is an Array with the following values which are also available as attributes:

If the Tilemap has a tileset, setting the tile attribute will also update the other attributes according to the values returned by the tileset.

Public Class Methods

property_index(name) click to toggle source

Returns the index of the given property.

# File lib/dragon_skeleton/tilemap/cell.rb, line 34
def self.property_index(name)
  @property_indexes[name]
end

Public Instance Methods

assign(values) click to toggle source

Assigns the given values to the cell.

Example:

cell.assign(path: 'sprites/box.png', r: 255, g: 0, b: 0)
# File lib/dragon_skeleton/tilemap/cell.rb, line 71
def assign(values)
  values.each do |name, value|
    index = Cell.property_index(name)
    next unless index

    self[index] = value
  end
end