class RTanque::Gui::Explosion

Constants

FRAMES

Public Class Methods

new(window, explosion) click to toggle source
# File lib/rtanque/gui/explosion.rb, line 8
def initialize(window, explosion)
  @window = window
  @explosion = explosion
  @position = [explosion.position.x, window.height - explosion.position.y]
  @explosion_images = FRAMES.map { |i| Gosu::Image.new(@window, Gui.resource_path("images/explosions/explosion2-#{i}.png")) }
end

Public Instance Methods

draw() click to toggle source
# File lib/rtanque/gui/explosion.rb, line 15
def draw
  frame.draw_rot(@position[0], @position[1], 5, ZOrder::EXPLOSION)
end
frame() click to toggle source
# File lib/rtanque/gui/explosion.rb, line 19
def frame
  @frames_length ||= @explosion_images.length - 1
  @explosion_images[(@explosion.percent_dead * @frames_length).floor]
end