Class: DXRuby::Tiled::PolylineObject

Inherits:
TMEObject
  • Object
show all
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

Constructor Details

#initialize(x, y, vertexs, options) ⇒ PolylineObject

Returns a new instance of PolylineObject.



121
122
123
124
125
126
127
128
129
130
# File 'lib/dxruby_tiled/object.rb', line 121

def initialize(x, y, vertexs, options)
  super x, y, options
  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



117
118
119
# File 'lib/dxruby_tiled/object.rb', line 117

def self.create_from_hash(hash)
  self.new(hash[:x], hash[:y], hash[:polyline], hash)
end

Instance Method Details

#drawObject



132
# File 'lib/dxruby_tiled/object.rb', line 132

def draw; end