Sha256: e7f8a7819398bac4c4903d12689ce119b7b31b371ffcc50ad09b5b0a3557bc49

Contents?: true

Size: 808 Bytes

Versions: 1

Compression:

Stored size: 808 Bytes

Contents

module Lotu
  class Actor
    attr_accessor :parent, :x, :y, :systems

    include SystemUser

    def initialize(opts={})
      default_opts = {
        :x => 0,
        :y => 0
      }
      @opts = default_opts.merge!(opts)
      @x = @opts[:x]
      @y = @opts[:y]
      @parent = $window
      @parent.update_queue << self

      # 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
    end

    # Remove ourselves from the update queue
    def die
      @parent.update_queue.delete(self)
    end

    def update
      @systems.each_pair do |klass, system|
        system.update
      end
    end

    def draw;end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lotu-0.1.9 lib/lotu/actor.rb