Class: RubyGame::StaticObject

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/ruby_game/static_object.rb

Direct Known Subclasses

MovingObject, Ruby

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, image_name) ⇒ StaticObject

Returns a new instance of StaticObject.



8
9
10
11
# File 'lib/ruby_game/static_object.rb', line 8

def initialize(x, y, image_name)
  @x, @y = x, y
  @image_name = image_name
end

Instance Attribute Details

#xObject

Returns the value of attribute x.



6
7
8
# File 'lib/ruby_game/static_object.rb', line 6

def x
  @x
end

#yObject

Returns the value of attribute y.



6
7
8
# File 'lib/ruby_game/static_object.rb', line 6

def y
  @y
end

Instance Method Details

#drawObject



17
18
19
# File 'lib/ruby_game/static_object.rb', line 17

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

#init_image(window) ⇒ Object



13
14
15
# File 'lib/ruby_game/static_object.rb', line 13

def init_image(window)
  @image = Gosu::Image.new(window, File.join(IMAGES_PATH, "#{@image_name}.png"), true)
end