Class: Asteroids::AsteroidGraphics
- Defined in:
- lib/asteroids/asteroid/asteroid_graphics.rb
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(game_object) ⇒ AsteroidGraphics
constructor
A new instance of AsteroidGraphics.
Methods inherited from Component
Constructor Details
#initialize(game_object) ⇒ AsteroidGraphics
Returns a new instance of AsteroidGraphics.
4 5 6 7 8 9 10 11 12 |
# File 'lib/asteroids/asteroid/asteroid_graphics.rb', line 4 def initialize(game_object) super(game_object) @image = Gosu::Image.new($window, Utils.get_image_path("asteroid.png"), true) @image_medium = Gosu::Image.new($window, Utils.get_image_path("asteroid_medium.png"), true) @image_small = Gosu::Image.new($window, Utils.get_image_path("asteroid_small.png"), true) end |
Instance Method Details
#draw ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/asteroids/asteroid/asteroid_graphics.rb', line 14 def draw case object.radius when 45 @image.draw_rot(object.x, object.y, 1, object.angle) when 30 @image_medium.draw_rot(object.x, object.y, 1, object.angle) when 17.5 @image_small.draw_rot(object.x, object.y, 1, object.angle) end end |