Sha256: 3159b9203e81aebe6b0e09c04068361255f4e7e417f57c4d17335a741dce26f6
Contents?: true
Size: 485 Bytes
Versions: 23
Compression:
Stored size: 485 Bytes
Contents
class BoundingBox attr_reader :left, :bottom, :width, :height, :right, :top def initialize(left, bottom, width, height) @left = left @bottom = bottom @width = width @height = height @right = @left + @width @top = @bottom + @height end def collide?(x, y) x >= left && x <= right && y >= bottom && y <= top end def intersects?(box) self.right > box.left && self.bottom < box.top && self.left < box.right && self.top > box.bottom end end
Version data entries
23 entries across 23 versions & 1 rubygems
Version | Path |
---|---|
make_it_so-0.0.7 | templates/gosu/lib/bounding_box.rb |
make_it_so-0.0.6 | templates/gosu/lib/bounding_box.rb |
make_it_so-0.0.5 | templates/gosu/lib/bounding_box.rb |