
require 'gosu'
class Explosion
  attr_accessor :x, :y, :expindex, :animation

  def initialize(window,x,y,animation)
   
    @x =x
    @y =y
    @expindex =0
    @animation = animation
    @starttime = Gosu::milliseconds
    
  end
  
  def increaseindex 
    if(Gosu::milliseconds - @starttime) > 33 then
      @expindex +=1
      @starttime = Gosu::milliseconds
    end
    
    @expindex
    
  end
 
  def draw
      img = @animation[@expindex]; #max 5
    
      img.draw_rot( @x+10, @y+10, 1, 1,center_x = 0.5, center_y = 0.5, factor_x = 1, factor_y = 1, color = 0xffffffff, mode = :default)
  end
  
end