class DXOpal::Sprite::CollisionArea::Triangle
Public Class Methods
new(sprite, x1, y1, x2, y2, x3, y3)
click to toggle source
Calls superclass method
# File lib/dxopal/sprite/collision_area.rb, line 261 def initialize(sprite, x1, y1, x2, y2, x3, y3) @sprite = sprite @poss = [[x1, y1], [x2, y2], [x3, y3]] super() end
Public Instance Methods
absolute_poss()
click to toggle source
# File lib/dxopal/sprite/collision_area.rb, line 282 def absolute_poss absolute(@poss) end
collides?(other)
click to toggle source
# File lib/dxopal/sprite/collision_area.rb, line 269 def collides?(other) case other.type when :Point, :Circle, :Rect other.collides?(self) when :Triangle (ox1, oy1), (ox2, oy2), (ox3, oy3) = *self.absolute_poss (dx1, dy1), (dx2, dy2), (dx3, dy3) = *other.absolute_poss `Opal.DXOpal.CCk.check_triangle_triangle(ox1, oy1, ox2, oy2, ox3, oy3, dx1, dy1, dx2, dy2, dx3, dy3)` else raise end end
type()
click to toggle source
# File lib/dxopal/sprite/collision_area.rb, line 267 def type; :Triangle; end