Class: Asteroids::ShipGraphics
- Defined in:
- lib/asteroids/ship/ship_graphics.rb
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(game_object) ⇒ ShipGraphics
constructor
A new instance of ShipGraphics.
Methods inherited from Component
Constructor Details
#initialize(game_object) ⇒ ShipGraphics
Returns a new instance of ShipGraphics.
4 5 6 7 8 |
# File 'lib/asteroids/ship/ship_graphics.rb', line 4 def initialize(game_object) super(game_object) @image = Gosu::Image.load_tiles($window, Utils.get_image_path("ship.png"), 90, 90, true) end |
Instance Method Details
#draw ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/asteroids/ship/ship_graphics.rb', line 10 def draw if object.thrust @image[0].draw_rot(object.x, object.y, 1, object.angle) else @image[1].draw_rot(object.x, object.y, 1, object.angle) end end |