class DamageGraphics

Public Class Methods

new(object_pool) click to toggle source
Calls superclass method Component::new
# File lib/entities/components/damage_graphics.rb, line 2
def initialize(object_pool)
  super
  @image = images.sample
  @angle = rand(0..360)
end

Public Instance Methods

draw(viewport) click to toggle source
# File lib/entities/components/damage_graphics.rb, line 8
def draw(viewport)
  @image.draw_rot(x, y, 0, @angle)
end

Private Instance Methods

images() click to toggle source
# File lib/entities/components/damage_graphics.rb, line 14
def images
  @@images ||= (1..4).map do |i|
    Gosu::Image.new($window,
      Utils.media_path("damage#{i}.png"), false)
  end
end