Class: RGSS::TMX::Map
Instance Attribute Summary collapse
-
#back_color ⇒ Object
readonly
Returns the value of attribute back_color.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#orientation ⇒ Object
readonly
Returns the value of attribute orientation.
-
#render_order ⇒ Object
readonly
Returns the value of attribute render_order.
-
#side_length ⇒ Object
readonly
Returns the value of attribute side_length.
-
#stagger_axis ⇒ Object
readonly
Returns the value of attribute stagger_axis.
-
#tile_width ⇒ Object
readonly
Returns the value of attribute tile_width.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Attributes inherited from MapObject
Class Method Summary collapse
Instance Method Summary collapse
- #infinite? ⇒ Boolean
-
#initialize(node) ⇒ Map
constructor
A new instance of Map.
- #pixel_height ⇒ Object
- #pixel_width ⇒ Object
- #size ⇒ Object
- #tile_size ⇒ Object
Methods inherited from MapObject
Constructor Details
#initialize(node) ⇒ Map
Returns a new instance of Map.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/rgss/tilemap.rb', line 49 def initialize(node) super(node) @version = node[:version] @orientation = node[:orientation].to_sym @render_order = node[:renderorder].sub('-', '').to_sym @width = node[:width].to_i @height = node[:height].to_i @tile_width = node[:tilewidth].to_i @tile_height = node[:tileheight].to_i @side_length = node[:hexsidelength].to_i @stagger_axis = node[:staggeraxis].to_i @infinite = !!node[:infinite] @back_color = parse_color(node[:backgroundcolor]) @tilesets = node.locate('./tileset').map { |child| Tileset.new(child) } @layers = [] end |
Instance Attribute Details
#back_color ⇒ Object (readonly)
Returns the value of attribute back_color.
47 48 49 |
# File 'lib/rgss/tilemap.rb', line 47 def back_color @back_color end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
42 43 44 |
# File 'lib/rgss/tilemap.rb', line 42 def height @height end |
#orientation ⇒ Object (readonly)
Returns the value of attribute orientation.
39 40 41 |
# File 'lib/rgss/tilemap.rb', line 39 def orientation @orientation end |
#render_order ⇒ Object (readonly)
Returns the value of attribute render_order.
40 41 42 |
# File 'lib/rgss/tilemap.rb', line 40 def render_order @render_order end |
#side_length ⇒ Object (readonly)
Returns the value of attribute side_length.
45 46 47 |
# File 'lib/rgss/tilemap.rb', line 45 def side_length @side_length end |
#stagger_axis ⇒ Object (readonly)
Returns the value of attribute stagger_axis.
46 47 48 |
# File 'lib/rgss/tilemap.rb', line 46 def stagger_axis @stagger_axis end |
#tile_width ⇒ Object (readonly)
Returns the value of attribute tile_width.
43 44 45 |
# File 'lib/rgss/tilemap.rb', line 43 def tile_width @tile_width end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
38 39 40 |
# File 'lib/rgss/tilemap.rb', line 38 def version @version end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
41 42 43 |
# File 'lib/rgss/tilemap.rb', line 41 def width @width end |
Class Method Details
.load(path) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/rgss/tilemap.rb', line 31 def self.load(path) opts = Ox. opts[:symbolize_keys] = true doc = Ox.load_file(path, opts) new(doc.root) end |
.parse(xml) ⇒ Object
27 28 29 |
# File 'lib/rgss/tilemap.rb', line 27 def self.parse(xml) end |
Instance Method Details
#infinite? ⇒ Boolean
68 69 70 |
# File 'lib/rgss/tilemap.rb', line 68 def infinite? @infinite end |
#pixel_height ⇒ Object
84 85 86 |
# File 'lib/rgss/tilemap.rb', line 84 def pixel_height @height * @tile_height end |
#pixel_width ⇒ Object
80 81 82 |
# File 'lib/rgss/tilemap.rb', line 80 def pixel_width @width * @tile_width end |