class Collider
class Collider
Attributes
height[R]
width[R]
x[R]
y[R]
Public Class Methods
new(x, y, width, height)
click to toggle source
# File lib/entities/collider.rb, line 5 def initialize(x, y, width, height) @x = x @y = y @width = width @height = height end
Public Instance Methods
collides?(b)
click to toggle source
# File lib/entities/collider.rb, line 17 def collides?(b) (@x + @width * 8) >= (b.x + 3) && (x + 2 <= (b.x + b.width * 8)) && ((y + height * 8) >= b.y + 3) && (y + 2 <= (b.y + b.height * 8)) end
update(x, y)
click to toggle source
# File lib/entities/collider.rb, line 12 def update(x, y) @x = x @y = y end