Class: Lotu::Actor

Inherits:
Object
  • Object
show all
Extended by:
HasBehavior
Defined in:
lib/lotu/actor.rb

Direct Known Subclasses

Cursor

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Resourceful

#is_resourceful

Methods included from Drawable

#is_drawable

Methods included from Controllable

#is_controllable

Methods included from Eventful

#is_eventful

Constructor Details

#initialize(opts = {}) ⇒ Actor

Returns a new instance of Actor.



7
8
9
10
11
12
13
14
15
16
# File 'lib/lotu/actor.rb', line 7

def initialize(opts={})
  super()
  @x = opts[:x] || 0
  @y = opts[:y] || 0
  @parent = $window
  @parent.update_queue << self

  # Initialize the behaviors included in subclasses
  init_behavior
end

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



5
6
7
# File 'lib/lotu/actor.rb', line 5

def parent
  @parent
end

#xObject

Returns the value of attribute x.



5
6
7
# File 'lib/lotu/actor.rb', line 5

def x
  @x
end

#yObject

Returns the value of attribute y.



5
6
7
# File 'lib/lotu/actor.rb', line 5

def y
  @y
end

Instance Method Details

#dtObject



18
19
20
# File 'lib/lotu/actor.rb', line 18

def dt
  $window.dt
end

#init_behaviorObject

Meant to be overriden by behaviors



23
# File 'lib/lotu/actor.rb', line 23

def init_behavior;end

#updateObject



24
# File 'lib/lotu/actor.rb', line 24

def update;end