Class: Bestguigui::Tiled::ObjectLayer
- Inherits:
-
Object
- Object
- Bestguigui::Tiled::ObjectLayer
- Defined in:
- lib/bestguigui/tiled.rb
Overview
Couche d'objets (spawns, zones, marqueurs...) — les propriétés custom définies dans Tiled sont sur chaque Object.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#objects ⇒ Object
readonly
Returns the value of attribute objects.
Instance Method Summary collapse
-
#initialize(data) ⇒ ObjectLayer
constructor
A new instance of ObjectLayer.
- #objects_of_type(type) ⇒ Object
Constructor Details
#initialize(data) ⇒ ObjectLayer
Returns a new instance of ObjectLayer.
116 117 118 119 |
# File 'lib/bestguigui/tiled.rb', line 116 def initialize(data) @name = data["name"] @objects = (data["objects"] || []).map { |object_data| Object.new(object_data) } end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
114 115 116 |
# File 'lib/bestguigui/tiled.rb', line 114 def name @name end |
#objects ⇒ Object (readonly)
Returns the value of attribute objects.
114 115 116 |
# File 'lib/bestguigui/tiled.rb', line 114 def objects @objects end |
Instance Method Details
#objects_of_type(type) ⇒ Object
121 122 123 |
# File 'lib/bestguigui/tiled.rb', line 121 def objects_of_type(type) @objects.select { |object| object.type == type } end |