class Scene_Title
MAX_FLY = 90 # Firfly的数目(图大的话,数字就要小,不然卡)
alias :iisnow_start :start
def start
iisnow_start
create_firefly
@command_window.z = 102 # 使得窗口在光点上面
end
def create_firefly
@fly_sprite = []
MAX_FLY.times{@fly_sprite << Firefly.new}
@fly_sprite.each{|s| s.z = 101} # 比上的设置值小,比100大即可
end
def update
super
@fly_sprite.each{|s| s.update }
end
alias :iisnow_terminate :terminate
def terminate
iisnow_terminate
dispose_firefly
end
def dispose_firefly
@fly_sprite.each{|s| s.dispose}
end
end
class Firefly < Sprite
def initialize(viewport = nil)
super(viewport)
self.bitmap = Cache.title2("Firefly")
reset_setting
end
def reset_setting
zoom = (50 + rand(100)) / 100.1
self.zoom_x = zoom
self.zoom_y = zoom
self.x = rand(544)
self.y = rand(416 + self.bitmap.height)
self.opacity = 0
self.angle = rand(360)
self.blend_type = 1
@speed_x = 0
@speed_y = [[rand(4), 4].min, 1].max
@speed_a = rand(3)
end
def dispose
super
self.bitmap.dispose
end
def update
super
self.x += @speed_x
self.y -= @speed_y
self.angle += @speed_a
self.opacity += 5
reset_setting if self.y < 0
end
end