Class: RubyGame::StaticObject
- Inherits:
-
Object
- Object
- RubyGame::StaticObject
- Extended by:
- Forwardable
- Defined in:
- lib/ruby_game/static_object.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #draw ⇒ Object
- #init_image(window) ⇒ Object
-
#initialize(x, y, image_name) ⇒ StaticObject
constructor
A new instance of StaticObject.
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
#x ⇒ Object
Returns the value of attribute x.
6 7 8 |
# File 'lib/ruby_game/static_object.rb', line 6 def x @x end |
#y ⇒ Object
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
#draw ⇒ Object
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 |