Sha256: acf4379fb55837ae752279d043514a87c8fe8013f813cf7a35c1232eb22e524e
Contents?: true
Size: 566 Bytes
Versions: 5
Compression:
Stored size: 566 Bytes
Contents
module Lotu module Collidable def self.extended(instance) instance.init_behavior end def init_behavior @collision_tag = nil end def collides_as(tag) @collision_tag = tag @parent.systems[CollisionSystem].add_entity(self, tag) end def collides_with(other) Gosu.distance(@x, @y, other.x, other.y) < @collision_radius + other.collision_radius end def die super @parent.systems[CollisionSystem].remove_entity(self, @collision_tag) if @parent.systems[CollisionSystem] end end end
Version data entries
5 entries across 5 versions & 1 rubygems