class Fire_Flies < Sprite
def initialize(type)#rise:1 spread :2
super(nil)
@xadd_count = 0.0
@yadd_count = 0.0
@oadd_count = 0.0
@life = 300 - rand(100)
@during = 0
@type = type
case @type
when 1
@aim = [0,rand(30)+100]
@speed_x = 0.0#f
@speed_y = @aim[1].to_f/@life#f
x = rand(640)
hue = rand(360)
zoom = rand(0)
self.bitmap = Bitmap.new("Graphics/Pictures/fireflies.png")
self.ox = self.bitmap.width/2
self.oy = 0
self.opacity = 250
self.bitmap.hue_change(hue)
self.x = x
self.y = 480
self.zoom_x = zoom
self.zoom_y = zoom
when 2
@aim = [rand(30)+50,rand(30)+50]
@speed_x = @aim[0].to_f/@life#f
@speed_y = @aim[1].to_f/@life#f
zoom = rand(0)
self.bitmap = Bitmap.new("Graphics/Pictures/fireflies.png")
self.ox = self.bitmap.width/2
self.oy = self.bitmap.height/2
self.opacity = 1
self.x = Graphics.width/2
self.y = Graphics.width/2
self.zoom_x = zoom
self.zoom_y = zoom
end
end
def fireflies_update
@xadd_count += @speed_x
@yadd_count += @speed_y
@oadd_count += 250.0/@life
if @xadd_count >= 1
self.x += @xadd_count
@xadd_count -= 1
end
if @yadd_count >= 1
self.x += @yadd_count
@yadd_count -= 1
end
if @oadd_count >= 1
if @during < @life / 3 and @type == 2
self.opacity += @oadd_count
else
self.opacity -= @oadd_count
end
@oadd_count -= 1
end
@during += 1
self.dispose if @during == @life
end
end