class SK::TMX::MapLayer
Attributes
color[RW]
data[RW]
height[RW]
objects[RW]
properties[RW]
type[RW]
visible[RW]
width[RW]
Public Class Methods
new(json)
click to toggle source
# File lib/shirokuro/standard_components/tmx/tmx_map_layer.rb, line 7 def initialize json @name = json["name"] @opacity = json["opacity"].to_f @visible = json["visible"] @data = json["data"] @width = json["width"].to_i @height = json["height"].to_i @properties = json["properties"] @type = json["type"] @objects = [] if json["objects"] json["objects"].each do |obj| @objects << MapLayerObject.new(obj) end end @color = Gosu::Color.new(255, 255 * @opacity, 255 * @opacity, 255 * @opacity) end
Public Instance Methods
get(col, row)
click to toggle source
# File lib/shirokuro/standard_components/tmx/tmx_map_layer.rb, line 33 def get(col, row) @data[col + row * @width] - 1 end
is_collision_layer?()
click to toggle source
# File lib/shirokuro/standard_components/tmx/tmx_map_layer.rb, line 26 def is_collision_layer? if @properties != nil && @properties["collision"] == "true" return true end false end