Class: Asteroids::ShipGraphics

Inherits:
Component show all
Defined in:
lib/asteroids/ship/ship_graphics.rb

Instance Method Summary collapse

Methods inherited from Component

#update

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

#drawObject



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