Class: DXRuby::Tiled::PolygonObject
- Defined in:
- lib/dxruby_tiled/object.rb
Instance Attribute Summary
Attributes inherited from TMEObject
#id, #name, #properties, #type
Class Method Summary collapse
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(x, y, vertexs, options) ⇒ PolygonObject
constructor
A new instance of PolygonObject.
Constructor Details
#initialize(x, y, vertexs, options) ⇒ PolygonObject
Returns a new instance of PolygonObject.
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/dxruby_tiled/object.rb', line 102 def initialize(x, y, vertexs, ) super x, y, collision = [] (vertexs.size - 2).times do |i| collision.push([vertexs[0 ][:x], vertexs[0 ][:y], vertexs[i + 1][:x], vertexs[i + 1][:y], vertexs[i + 2][:x], vertexs[i + 2][:y]]) end self.collision = collision end |
Class Method Details
.create_from_hash(hash) ⇒ Object
98 99 100 |
# File 'lib/dxruby_tiled/object.rb', line 98 def self.create_from_hash(hash) self.new(hash[:x], hash[:y], hash[:polygon], hash) end |
Instance Method Details
#draw ⇒ Object
113 |
# File 'lib/dxruby_tiled/object.rb', line 113 def draw; end |