lib/lotu/actor.rb in lotu-0.1.3 vs lib/lotu/actor.rb in lotu-0.1.4

- old
+ new

@@ -1,8 +1,8 @@ module Lotu class Actor - attr_accessor :parent, :x, :y + attr_accessor :parent, :x, :y, :systems def initialize(opts={}) default_opts = { :x => 0, :y => 0, @@ -18,10 +18,12 @@ # Add extra functionality self.extend Drawable self.extend Controllable self.extend Eventful self.extend Collidable + + @systems = {} end # Easy access to delta-time def dt $window.dt @@ -30,8 +32,19 @@ # Remove ourselves from the update queue def die @parent.update_queue.delete(self) end - def update;end + def activate_system(klass, opts={}) + @systems[klass] = klass.new(self, opts) + end + + def update + @systems.each_pair do |klass, system| + system.update + end + end + + def draw;end + end end