Class: RETMX::Map

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

Overview

The tilewidth and tileheight properties determine the general grid size of the map. The individual tiles may have different sizes. Larger tiles will extend at the top and right (anchored to the bottom left).

Defined Under Namespace

Classes: Layer, ObjectGroup, TileSet

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc) ⇒ Map

Returns a new instance of Map.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/retmx.rb', line 81

def initialize(doc)
  @version = doc.attributes['version']
  @orientation = doc.attributes['orientation']
  @width = doc.attributes['width'].to_i
  @height = doc.attributes['height'].to_i
  @tilewidth = doc.attributes['tilewidth'].to_i
  @tileheight = doc.attributes['tileheight'].to_i
  
  @tilesets = {}
  @layers = {}
  @objectgroups = {}
  @xml = doc

  build(doc)
end

Instance Attribute Details

#heightObject (readonly)

The map height in tiles.



59
60
61
# File 'lib/retmx.rb', line 59

def height
  @height
end

#layersObject (readonly)

Layers on map



68
69
70
# File 'lib/retmx.rb', line 68

def layers
  @layers
end

#objectgroupsObject (readonly)

Objects groups on map



74
75
76
# File 'lib/retmx.rb', line 74

def objectgroups
  @objectgroups
end

#orientationObject (readonly)

Map orientation. Tiled supports “orthogonal” and “isometric” at the moment.



53
54
55
# File 'lib/retmx.rb', line 53

def orientation
  @orientation
end

#propertyObject (readonly)

Properties on map



77
78
79
# File 'lib/retmx.rb', line 77

def property
  @property
end

#tileheightObject (readonly)

The height of a tile.



65
66
67
# File 'lib/retmx.rb', line 65

def tileheight
  @tileheight
end

#tilesetsObject (readonly)

Tileset on map



71
72
73
# File 'lib/retmx.rb', line 71

def tilesets
  @tilesets
end

#tilewidthObject (readonly)

The width of a tile.



62
63
64
# File 'lib/retmx.rb', line 62

def tilewidth
  @tilewidth
end

#versionObject (readonly)

The TMX format version, generally 1.0



50
51
52
# File 'lib/retmx.rb', line 50

def version
  @version
end

#widthObject (readonly)

The map width in tiles.



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

def width
  @width
end

#xmlObject (readonly)

REXML internal



80
81
82
# File 'lib/retmx.rb', line 80

def xml
  @xml
end