Sha256: e889725c56c29ebe9b92995424a31a9ab11f65c2ff253ec185a3dce3a6d8ac49
Contents?: true
Size: 598 Bytes
Versions: 13
Compression:
Stored size: 598 Bytes
Contents
# TODO optimize # class Moveables def initialize elements = [] @elements = elements end delegate :each, :to => :@elements def register moveable @elements << moveable end def registered? moveable @elements.include? moveable end def remove shape @elements.delete_if { |element| element.shape == shape } end def draw @elements.each &:draw end def move @elements.each &:move end def targeting @elements.select { |m| m.respond_to? :target }.each do |gun| gun.target *@elements.select { |m| m.kind_of? Enemy } end end end
Version data entries
13 entries across 13 versions & 1 rubygems