class DXOpal::Sprite::CollisionArea::Point
Public Class Methods
new(sprite, x, y)
click to toggle source
Calls superclass method
# File lib/dxopal/sprite/collision_area.rb, line 89 def initialize(sprite, x, y) @sprite, @x, @y = sprite, x, y super() end
Public Instance Methods
absolute_pos()
click to toggle source
Return [x, y]
# File lib/dxopal/sprite/collision_area.rb, line 117 def absolute_pos absolute1([@x, @y]) end
collides?(other)
click to toggle source
# File lib/dxopal/sprite/collision_area.rb, line 96 def collides?(other) case other.type when :Point self.absolute_pos == other.absolute_pos when :Circle x, y = *transback1(self.absolute_pos, other.sprite) cx, cy = *other.absolute_norot_pos `Opal.DXOpal.CCk.check_point_circle(x, y, cx, cy, #{other.r})` when :Rect x, y = *transback1(self.absolute_pos, other.sprite) ((x1, y1), (x2, y2)) = *other.absolute_norot_poss `Opal.DXOpal.CCk.check_point_straight_rect(x, y, x1, y1, x2, y2)` when :Triangle x, y = *absolute_pos (x1, y1), (x2, y2), (x3, y3) = *other.absolute_poss `Opal.DXOpal.CCk.check_point_triangle(x, y, x1, y1, x2, y2, x3, y3)` else raise end end
type()
click to toggle source
# File lib/dxopal/sprite/collision_area.rb, line 94 def type; :Point; end