Class: Nimo::ImageRepresentation

Inherits:
ObjectRepresentation show all
Defined in:
lib/nimo/representations/image_representation.rb

Instance Attribute Summary

Attributes inherited from ObjectRepresentation

#game_object, #game_window

Instance Method Summary collapse

Methods inherited from ObjectRepresentation

#act_upon, #always, #initialize, #listen_to, #update, #with_observer

Methods included from InputListener

#any_key, #button_down, #process_inputs, #when_key

Methods included from EventListener

#listen_to, #notify

Constructor Details

This class inherits a constructor from Nimo::ObjectRepresentation

Instance Method Details

#drawObject



13
14
15
# File 'lib/nimo/representations/image_representation.rb', line 13

def draw
  @image.draw(@game_object.x, @game_object.y, 0)
end

#load(resources, params) ⇒ Object



6
7
8
9
10
11
# File 'lib/nimo/representations/image_representation.rb', line 6

def load(resources, params)
			raise "Must provide :image param for image loading" unless params.has_key?(:image)

  @image = resources.image(params[:image])
  @image = @image[params[:index]] if params.has_key?(:index)
end