for i in 1..500
sprite = Sprite.new(viewport)
sprite.visible = false
sprite.opacity = 0
@sprites.push(sprite)
@current_pose.push(0)
@info.push(rand(50))
@countarray.push(rand(15))
end
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
for sprite in @sprites
sprite.dispose
end
@rain_bitmap.dispose
@storm_bitmap.dispose
@snow_bitmap.dispose
@hail_bitmap.dispose
@petal_bitmap.dispose
@blood_rain_bitmap.dispose
@oil_rain_bitmap.dispose
@golden_rain_bitmap.dispose
@golden_storm_bitmap.dispose
@acid_rain_bitmap.dispose
@acid_storm_bitmap.dispose
@sepia_rain_bitmap.dispose
@sepia_storm_bitmap.dispose
@blood_storm_bitmap.dispose
@bloodblizz_bitmap.dispose
@meteor_bitmap.dispose
@flame_meteor_bitmap.dispose
@waterbomb_bitmap.dispose
@icybomb_bitmap.dispose
@flarebomb_bitmap.dispose
for image in @autumn_leaf_bitmaps
image.dispose
end
for image in @green_leaf_bitmaps
image.dispose
end
for image in @yellow_leaf_bitmaps
image.dispose
end
for image in @redmaple_leaf_bitmaps
image.dispose
end
for image in @rose_bitmaps
image.dispose
end
for image in @feather_bitmaps
image.dispose
end
for image in @sparkle_bitmaps
image.dispose
end
for image in @starburst_bitmaps
image.dispose
end
for image in @monostarburst_bitmaps
image.dispose
end
for image in @user_bitmaps
image.dispose
end
$WEATHER_UPDATE = true
end
#--------------------------------------------------------------------------
# * Set weather type
# type : new weather type
#--------------------------------------------------------------------------
def type=(type)
return if @type == type
@type = type
case @type
when 1 # rain
bitmap = @rain_bitmap
when 2 # storm
bitmap = @storm_bitmap
when 3 # snow
bitmap = @snow_bitmap
when 4 # hail
bitmap = @hail_bitmap
when 5 # rain w/ thunder and lightning
bitmap = @rain_bitmap
@thunder = true
when 6 # falling autumn leaves
bitmap = @autumn_leaf_bitmaps[0]
when 7 # blowing autumn leaves
bitmap = @autumn_leaf_bitmaps[0]
when 8 # swirling autumn leaves
bitmap = @autumn_leaf_bitmaps[0]
when 9 # falling green leaves
bitmap = @green_leaf_bitmaps[0]
when 10 # sakura petals
bitmap = @petal_bitmap
when 11 # rose petals
bitmap = @rose_bitmaps[0]
when 12 # feathers
bitmap = @feather_bitmaps[0]
when 13 # blood rain
bitmap = @blood_rain_bitmap
when 14 # sparkles
bitmap = @sparkle_bitmaps[0]
when 15 # user-defined
bitmap = @user_bitmaps[rand(@user_bitmaps.size)]
when 16 # blowing snow
bitmap = @snow_bitmap
when 17 # meteors
bitmap = @meteor_bitmap
when 18 # falling ash
bitmap = @ash_bitmaps[rand(@ash_bitmaps.size)]
when 19 # bubbles
bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
when 21 # sparkles up
bitmap = @sparkle_bitmaps[0]
when 22 # blowing green leaves
bitmap = @green_leaf_bitmaps[0]
when 23 # swirling green leaves
bitmap = @green_leaf_bitmaps[0]
when 24 # falling yellow leaves
bitmap = @yellow_leaf_bitmaps[0]
when 25 # blowing yellow leaves
bitmap = @yellow_leaf_bitmaps[0]
when 26 # swirling yellow leaves
bitmap = @yellow_leaf_bitmaps[0]
when 27 # oil rain
bitmap = @oil_rain_bitmap
when 28 # golden rain
bitmap = @golden_rain_bitmap
when 29 # flame meteors
bitmap = @flame_meteor_bitmap
when 30 # starburst
bitmap = @starburst_bitmaps[0]
when 31 # uprising starburst
bitmap = @starburst_bitmaps[0]
when 32 # starburst rain
bitmap = @starburst_bitmaps[0]
when 33 # mono-starburst
bitmap = @monostarburst_bitmaps[0]
when 34 # uprising mono-starburst
bitmap = @monostarburst_bitmaps[0]
when 35 # mono-starburst rain
bitmap = @monostarburst_bitmaps[0]
when 36 # Golden rain w\ thunder and ligthning
bitmap = @golden_rain_bitmap
@golden_thunder = true
when 37 # Golden storm
bitmap = @golden_storm_bitmap
when 38 # Oil storm
bitmap = @oil_storm_bitmap
when 39 # # Acid rain
bitmap = @acid_rain_bitmap
when 40 # Acid rain w\thunder and lightning
bitmap = @acid_rain_bitmap
@acid_thunder = true
when 41 # Acid storm
bitmap = @acid_storm_bitmap
when 42 # Sepia rain
bitmap = @sepia_rain_bitmap
when 43 # Sepia rain w\ thunder and lightning
bitmap = @sepia_rain_bitmap
@sepia_thunder = true
when 44 # Sepia storm
bitmap = @sepia_storm_bitmap
when 45 # Realistic storm
bitmap = @storm_bitmap
@real_storm = true
when 46 # Blood rain w\ thunder and lightning
bitmap = @blood_rain_bitmap
@crimson_thunder = true
when 47 # Blood storm
bitmap = @blood_storm_bitmap
when 48 # Blood blizzard
bitmap = @bloodblizz_bitmap
when 49 # Falling red maple leaves
bitmap = @redmaple_leaf_bitmaps[0]
when 50 # Blowing red maple leaves
bitmap = @redmaple_leaf_bitmaps[0]
when 51 # Swirling red maple leaves
bitmap = @redmaple_leaf_bitmaps[0]
when 52
bitmap = @waterbomb_bitmaps
when 53
bitmap = @icybomb_bitmaps
when 54
bitmap = @flarebomb_bitmaps
else
bitmap = nil
end
if @type != 5
@thunder = false
end
if @type != 36
@golden_thunder = false
end
if @type != 40
@acid_thunder = false
end
if @type != 43
@sepia_thunder = false
end
if @type != 45
@real_storm = false
end
if @type != 46
@crimson_thunder = false
end
for i in [email protected]
sprite = @sprites[i]
sprite.visible = (i <= @power)
if @type == 19
sprite.bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
elsif @type == 20
sprite.bitmap = @bubble2_bitmaps[rand(@bubble2_bitmaps.size)]
elsif @type == 3
r = rand(@snow_bitmaps.size)
@info[i] = r
sprite.bitmap = @snow_bitmaps[r]
else
sprite.bitmap = bitmap
end
end
end
#--------------------------------------------------------------------------
# * Set starting point X coordinate
# ox : starting point X coordinate
#--------------------------------------------------------------------------
def ox=(ox)
return if @ox == ox;
@ox = ox
for sprite in @sprites
sprite.ox = @ox
end
end
#--------------------------------------------------------------------------
# * Set starting point Y coordinate
# oy : starting point Y coordinate
#--------------------------------------------------------------------------
def oy=(oy)
return if @oy == oy;
@oy = oy
for sprite in @sprites
sprite.oy = @oy
end
end
#--------------------------------------------------------------------------
# * Set maximum number of sprites
# max : maximum number of sprites
#--------------------------------------------------------------------------
def power=(power)
@power = power
for i in 1..40
sprite = @sprites[i]
sprite.visible = (i <= @power) if sprite != nil
if @type == 19
sprite.bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
elsif @type == 20
sprite.bitmap = @bubble2_bitmaps[rand(@bubble2_bitmaps.size)]
elsif @type == 3
r = rand(@snow_bitmaps.size)
@info[i] = r
sprite.bitmap = @snow_bitmaps[r]
end
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
return if @type == 0
for i in 1..@power
sprite = @sprites[i]
if @type == 1 or @type == 5 or @type == 13 or @type == 27 or @type == 28 or @type == 36 or @type == 39 or @type == 40 or @type == 42 or @type == 43 or @type == 46 #rain
if sprite.opacity <= 150
if @current_pose[i] == 0
sprite.y += @rain_bitmap.height
sprite.x -= @rain_bitmap.width
if @type == 1 or @type == 5
sprite.bitmap = @rain_splash
else
sprite.bitmap = @blood_rain_splash
end
if @type == 27
sprite.bitmap = @oil_rain_splash
end
if @type == 28
sprite.bitmap = @golden_rain_splash
end
if @type == 36
sprite.bitmap = @golden_rain_splash
end
if @type == 39
sprite.bitmap = @acid_rain_splash
end
if @type == 40
sprite.bitmap = @acid_rain_splash
end
if @type == 42
sprite.bitmap = @sepia_rain_splash
end
if @type == 43
sprite.bitmap = @sepia_rain_splash
end
if @type == 46
sprite.bitmap = @blood_rain_splash
end
@current_pose[i] = 1
end
else
if @current_pose[i] == 1
if @type == 1 or @type == 5
sprite.bitmap = @rain_bitmap
else
sprite.bitmap = @blood_rain_bitmap
end
if @type == 27
sprite.bitmap = @oil_rain_bitmap
end
if @type == 28
sprite.bitmap = @golden_rain_bitmap
end
if @type == 36
sprite.bitmap = @golden_rain_bitmap
end
if @type == 39
sprite.bitmap = @acid_rain_bitmap
end
if @type == 40
sprite.bitmap = @acid_rain_bitmap
end
if @type == 42
sprite.bitmap = @sepia_rain_bitmap
end
if @type == 43
sprite.bitmap = @sepia_rain_bitmap
end
if @type == 46
sprite.bitmap = @blood_rain_bitmap
end
@current_pose[i] = 0
end
sprite.x -= 2
sprite.y += 16
if @thunder and (rand(8000 - @power) == 0)
$game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
Audio.se_play("Audio/SE/Thunder1")
end
if @golden_thunder and (rand(8000 - @power) == 0)
$game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
Audio.se_play("Audio/SE/Thunder1")
end
if @acid_thunder and (rand(5000 - @power) == 0)
$game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
Audio.se_play("Audio/SE/Thunder1")
end
if @sepia_thunder and (rand(8000 - @power) == 0)
$game_map.screen.start_flash(Color.new(169, 152, 142, 255), 5)
Audio.se_play("Audio/SE/Thunder1")
end
if @sepia_thunder and (rand(8000 - @power) == 0)
$game_map.screen.start_flash(Color.new(169, 152, 142, 255), 5)
Audio.se_play("Audio/SE/Thunder1")
end
if @crimson_thunder and (rand(8000 - @power) == 0)
$game_map.screen.start_flash(Color.new(141, 9, 9, 255), 5)
Audio.se_play("Audio/SE/Thunder1")
end
end
sprite.opacity -= 8
end
if @type == 2 or @type == 37 or @type == 38 or @type == 41 or @type == 44 or @type == 45 or @type == 47 # storm
sprite.x -= 8
sprite.y += 16
sprite.opacity -= 12
end
if @real_storm and (rand(5000 - @power) == 0)
$game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
$game_map.screen.start_shake(9, 4, 5)
Audio.se_play("Audio/SE/Thunder9")
end
if @type == 3 # snow
case @info[i]
when 0 # smallest flake, fall the slowest
sprite.y += 1
when 1
sprite.y += 3
when 2
sprite.y += 5
when 3
sprite.y += 7
end
sprite.opacity -= 3
end
if @type == 4 # hail
sprite.x -= 1
sprite.y += 18
sprite.opacity -= 15
end
if @type == 6 # falling autumn leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
end
sprite.x -= 1
sprite.y += 1
end
if @type == 7 # blowing autumn leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
end
sprite.x -= 10
sprite.y += (rand(4) - 2)
end
if @type == 8 # swirling autumn leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
end
if @info[i] != 0
if @info[i] >= 1 and @info[i] <= 10
sprite.x -= 3
sprite.y -= 1
elsif @info[i] >= 11 and @info[i] <= 16
sprite.x -= 1
sprite.y -= 2
elsif @info[i] >= 17 and @info[i] <= 20
sprite.y -= 3
elsif @info[i] >= 21 and @info[i] <= 30
sprite.y -= 2
sprite.x += 1
elsif @info[i] >= 31 and @info[i] <= 36
sprite.y -= 1
sprite.x += 3
elsif @info[i] >= 37 and @info[i] <= 40
sprite.x += 5
elsif @info[i] >= 41 and @info[i] <= 46
sprite.y += 1
sprite.x += 3
elsif @info[i] >= 47 and @info[i] <= 58
sprite.y += 2
sprite.x += 1
elsif @info[i] >= 59 and @info[i] <= 64
sprite.y += 3
elsif @info[i] >= 65 and @info[i] <= 70
sprite.x -= 1
sprite.y += 2
elsif @info[i] >= 71 and @info[i] <= 81
sprite.x -= 3
sprite.y += 1
elsif @info[i] >= 82 and @info[i] <= 87
sprite.x -= 5
end
@info[i] = (@info[i] + 1) % 88
else
if rand(200) == 0
@info[i] = 1
end
sprite.x -= 5
sprite.y += 1
end
end
if @type == 49 # falling red maple leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @redmaple_leaf_bitmaps.size
end
sprite.x -= 1
sprite.y += 1
end
if @type == 50 # blowing red maple leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @redmaple_leaf_bitmaps.size
end
sprite.x -= 10
sprite.y += (rand(4) - 2)
end
if @type == 51 # swirling red maple leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @redmaple_leaf_bitmaps.size
end
if @info[i] != 0
if @info[i] >= 1 and @info[i] <= 10
sprite.x -= 3
sprite.y -= 1
elsif @info[i] >= 11 and @info[i] <= 16
sprite.x -= 1
sprite.y -= 2
elsif @info[i] >= 17 and @info[i] <= 20
sprite.y -= 3
elsif @info[i] >= 21 and @info[i] <= 30
sprite.y -= 2
sprite.x += 1
elsif @info[i] >= 31 and @info[i] <= 36
sprite.y -= 1
sprite.x += 3
elsif @info[i] >= 37 and @info[i] <= 40
sprite.x += 5
elsif @info[i] >= 41 and @info[i] <= 46
sprite.y += 1
sprite.x += 3
elsif @info[i] >= 47 and @info[i] <= 58
sprite.y += 2
sprite.x += 1
elsif @info[i] >= 59 and @info[i] <= 64
sprite.y += 3
elsif @info[i] >= 65 and @info[i] <= 70
sprite.x -= 1
sprite.y += 2
elsif @info[i] >= 71 and @info[i] <= 81
sprite.x -= 3
sprite.y += 1
elsif @info[i] >= 82 and @info[i] <= 87
sprite.x -= 5
end
@info[i] = (@info[i] + 1) % 88
else
if rand(200) == 0
@info[i] = 1
end
sprite.x -= 5
sprite.y += 1
end
end
if @type == 9 # falling green leaves
if @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @green_leaf_bitmaps.size
sprite.bitmap = @green_leaf_bitmaps[@current_pose[i]]
@countarray[i] = rand(15)
end
@countarray[i] = (@countarray[i] + 1) % 15
sprite.y += 1
end
if @type == 10 # sakura petals
if @info[i] < 25
sprite.x -= 1
else
sprite.x += 1
end
@info[i] = (@info[i] + 1) % 50
sprite.y += 1
end
if @type == 11 # rose petals
@count = rand(20)
if @count == 0
sprite.bitmap = @rose_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @rose_bitmaps.size
end
if @info[i] % 2 == 0
if @info[i] < 10
sprite.x -= 1
elsif
sprite.x += 1
end
end
sprite.y += 1
end
if @type == 12 # feathers
if @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @feather_bitmaps.size
sprite.bitmap = @feather_bitmaps[@current_pose[i]]
end
@countarray[i] = (@countarray[i] + 1) % 15
if rand(100) == 0
sprite.x -= 1
end
if rand(100) == 0
sprite.y -= 1
end
if @info[i] < 50
if rand(2) == 0
sprite.x -= 1
else
sprite.y -= 1
end
else
if rand(2) == 0
sprite.x += 1
else
sprite.y += 1
end
end
@info[i] = (@info[i] + 1) % 100
end
if @type == 30 # starburst
if @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @starburst_bitmaps.size
sprite.bitmap = @starburst_bitmaps[@current_pose[i]]
end
@countarray[i] = (@countarray[i] + 1) % 15
sprite.y += 1
sprite.opacity -= 1
end
if @type == 31 # starburst up
if @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @starburst_bitmaps.size
sprite.bitmap = @starburst_bitmaps[@current_pose[i]]
end
@countarray[i] = (@countarray[i] + 1) % 15
sprite.y -= 1
sprite.opacity -= 1
end
if @type == 32 # starburst up
if @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @starburst_bitmaps.size
sprite.bitmap = @starburst_bitmaps[@current_pose[i]]
end
@countarray[i] = (@countarray[i] + 1) % 15
sprite.x -= 2
sprite.y += 8
sprite.opacity -= 1
end
if @type == 33 # mono-starburst
if @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @monostarburst_bitmaps.size
sprite.bitmap = @monostarburst_bitmaps[@current_pose[i]]
end
@countarray[i] = (@countarray[i] + 1) % 15
sprite.y += 1
sprite.opacity -= 1
end
if @type == 34 # mono-starburst up
if @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @monostarburst_bitmaps.size
sprite.bitmap = @monostarburst_bitmaps[@current_pose[i]]
end
@countarray[i] = (@countarray[i] + 1) % 15
sprite.y -= 1
sprite.opacity -= 1
end
if @type == 35 # mono-starburst rain
if @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @monostarburst_bitmaps.size
sprite.bitmap = @monostarburst_bitmaps[@current_pose[i]]
end
@countarray[i] = (@countarray[i] + 1) % 15
sprite.x -= 2
sprite.y += 8
sprite.opacity -= 1
end
if @type == 29 # meteors
if @countarray[i] > 0
if rand(20) == 0
sprite.bitmap = @flame_impact_bitmap
@countarray[i] = -5
else
sprite.x -= 6
sprite.y += 10
end
else
@countarray[i] += 1
if @countarray[i] == 0
sprite.bitmap = @flame_meteor_bitmap
sprite.opacity = 0
@count_array = 1
end
end
end
if @type == 18 # ash
sprite.y += 2
case @countarray[i] % 3
when 0
sprite.x -= 1
when 1
sprite.x += 1
end
end
if @type == 14 # sparkles
if @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @sparkle_bitmaps.size
sprite.bitmap = @sparkle_bitmaps[@current_pose[i]]
end
@countarray[i] = (@countarray[i] + 1) % 15
sprite.y += 1
sprite.opacity -= 1
end
if @type == 15 # user-defined
if $WEATHER_UPDATE
update_user_defined
$WEATHER_UPDATE = false
end
if $WEATHER_ANIMATED and @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @user_bitmaps.size
sprite.bitmap = @user_bitmaps[@current_pose[i]]
end
sprite.x += $WEATHER_X
sprite.y += $WEATHER_Y
sprite.opacity -= $WEATHER_FADE
end
if @type == 16 # blowing snow
sprite.x -= 10
sprite.y += 6
sprite.opacity -= 4
end
if @type == 48 # blood blizzard
sprite.x -= 10
sprite.y += 6
sprite.opacity -= 4
end
if @type == 52 # water bombs
if @countarray[i] > 0
if rand(20) == 0
sprite.bitmap = @waterbomb_impact_bitmap
@countarray[i] = -5
else
sprite.x -= 3
sprite.y += 5
end
else
@countarray[i] += 1
if @countarray[i] == 0
sprite.bitmap = @waterbomb_bitmap
sprite.opacity = 0
@count_array = 1
end
end
end
if @type == 53 # icy bombs
if @countarray[i] > 0
if rand(20) == 0
sprite.bitmap = @icybomb_impact_bitmap
@countarray[i] = -5
else
sprite.x -= 3
sprite.y += 5
end
else
@countarray[i] += 1
if @countarray[i] == 0
sprite.bitmap = @icybomb_bitmap
sprite.opacity = 0
@count_array = 1
end
end
end
if @type == 54 # flare bombs
if @countarray[i] > 0
if rand(20) == 0
sprite.bitmap = @flarebomb_impact_bitmap
@countarray[i] = -5
else
sprite.x -= 3
sprite.y += 5
end
else
@countarray[i] += 1
if @countarray[i] == 0
sprite.bitmap = @flarebomb_bitmap
sprite.opacity = 0
@count_array = 1
end
end
end
if @type == 17 # meteors
if @countarray[i] > 0
if rand(20) == 0
sprite.bitmap = @impact_bitmap
@countarray[i] = -5
else
sprite.x -= 6
sprite.y += 10
end
else
@countarray[i] += 1
if @countarray[i] == 0
sprite.bitmap = @meteor_bitmap
sprite.opacity = 0
@count_array = 1
end
end
end
if @type == 18 # ash
sprite.y += 2
case @countarray[i] % 3
when 0
sprite.x -= 1
when 1
sprite.x += 1
end
end
if @type == 19 or @type == 20 # bubbles
switch = rand(75) + rand(75) + 1
if @info[i] < switch / 2
sprite.x -= 1
else
sprite.x += 1
end
@info[i] = (@info[i] + 1) % switch
sprite.y -= 1
if switch % 2 == 0
sprite.opacity -= 1
end
end
if @type == 21 # sparkles up
if @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @sparkle_bitmaps.size
sprite.bitmap = @sparkle_bitmaps[@current_pose[i]]
end
@countarray[i] = (@countarray[i] + 1) % 15
sprite.y -= 1
sprite.opacity -= 1
end
if @type == 24 # falling yellow leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @yellow_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @yellow_leaf_bitmaps.size
end
sprite.x -= 1
sprite.y += 1
end
if @type == 22 # blowing green leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @green_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @green_leaf_bitmaps.size
end
sprite.x -= 10
sprite.y += (rand(4) - 2)
end
if @type == 23 # swirling green leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @green_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @green_leaf_bitmaps.size
end
if @info[i] != 0
if @info[i] >= 1 and @info[i] <= 10
sprite.x -= 3
sprite.y -= 1
elsif @info[i] >= 11 and @info[i] <= 16
sprite.x -= 1
sprite.y -= 2
elsif @info[i] >= 17 and @info[i] <= 20
sprite.y -= 3
elsif @info[i] >= 21 and @info[i] <= 30
sprite.y -= 2
sprite.x += 1
elsif @info[i] >= 31 and @info[i] <= 36
sprite.y -= 1
sprite.x += 3
elsif @info[i] >= 37 and @info[i] <= 40
sprite.x += 5
elsif @info[i] >= 41 and @info[i] <= 46
sprite.y += 1
sprite.x += 3
elsif @info[i] >= 47 and @info[i] <= 58
sprite.y += 2
sprite.x += 1
elsif @info[i] >= 59 and @info[i] <= 64
sprite.y += 3
elsif @info[i] >= 65 and @info[i] <= 70
sprite.x -= 1
sprite.y += 2
elsif @info[i] >= 71 and @info[i] <= 81
sprite.x -= 3
sprite.y += 1
elsif @info[i] >= 82 and @info[i] <= 87
sprite.x -= 5
end
@info[i] = (@info[i] + 1) % 88
else
if rand(200) == 0
@info[i] = 1
end
sprite.x -= 5
sprite.y += 1
end
end
if @type == 24 # falling yellow leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @yellow_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @yellow_leaf_bitmaps.size
end
sprite.x -= 1
sprite.y += 1
end
if @type == 25 # blowing yellow leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @yellow_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @yellow_leaf_bitmaps.size
end
sprite.x -= 10
sprite.y += (rand(4) - 2)
end
if @type == 26 # swirling yellow leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @yellow_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @yellow_leaf_bitmaps.size
end
if @info[i] != 0
if @info[i] >= 1 and @info[i] <= 10
sprite.x -= 3
sprite.y -= 1
elsif @info[i] >= 11 and @info[i] <= 16
sprite.x -= 1
sprite.y -= 2
elsif @info[i] >= 17 and @info[i] <= 20
sprite.y -= 3
elsif @info[i] >= 21 and @info[i] <= 30
sprite.y -= 2
sprite.x += 1
elsif @info[i] >= 31 and @info[i] <= 36
sprite.y -= 1
sprite.x += 3
elsif @info[i] >= 37 and @info[i] <= 40
sprite.x += 5
elsif @info[i] >= 41 and @info[i] <= 46
sprite.y += 1
sprite.x += 3
elsif @info[i] >= 47 and @info[i] <= 58
sprite.y += 2
sprite.x += 1
elsif @info[i] >= 59 and @info[i] <= 64
sprite.y += 3
elsif @info[i] >= 65 and @info[i] <= 70
sprite.x -= 1
sprite.y += 2
elsif @info[i] >= 71 and @info[i] <= 81
sprite.x -= 3
sprite.y += 1
elsif @info[i] >= 82 and @info[i] <= 87
sprite.x -= 5
end
@info[i] = (@info[i] + 1) % 88
else
if rand(200) == 0
@info[i] = 1
end
sprite.x -= 5
sprite.y += 1
end
end
x = sprite.x - @ox
y = sprite.y - @oy
if sprite.opacity < 64 or x < -50 or x > 750 or y < -300 or y > 500
sprite.x = rand(800) - 50 + @ox
sprite.y = rand(800) - 200 + @oy
sprite.opacity = 255
end
end
end
#-------------------------------------------------------------------------------
def make_bitmaps
color1 = Color.new(255, 255, 255, 255)
color2 = Color.new(255, 255, 255, 128)
@rain_bitmap = Bitmap.new(7, 56)
for i in 0..6
@rain_bitmap.fill_rect(6-i, i*8, 1, 8, color1)
end
@rain_splash = Bitmap.new(8, 5)
@rain_splash.fill_rect(1, 0, 6, 1, color2)
@rain_splash.fill_rect(1, 4, 6, 1, color2)
@rain_splash.fill_rect(0, 1, 1, 3, color2)
@rain_splash.fill_rect(7, 1, 1, 3, color2)
@rain_splash.set_pixel(1, 0, color1)
@rain_splash.set_pixel(0, 1, color1)
#-------------------------------------------------------------------------------
@storm_bitmap = Bitmap.new(34, 64)
for i in 0..31
@storm_bitmap.fill_rect(33-i, i*2, 1, 2, color2)
@storm_bitmap.fill_rect(32-i, i*2, 1, 2, color1)
@storm_bitmap.fill_rect(31-i, i*2, 1, 2, color2)
end
#-------------------------------------------------------------------------------
@snow_bitmap = Bitmap.new(6, 6)
@snow_bitmap.fill_rect(0, 1, 6, 4, color2)
@snow_bitmap.fill_rect(1, 0, 4, 6, color2)
@snow_bitmap.fill_rect(1, 2, 4, 2, color1)
@snow_bitmap.fill_rect(2, 1, 2, 4, color1)
@sprites = []
@snow_bitmaps = []
def update_user_defined
for image in @user_bitmaps
image.dispose
end
#user-defined bitmaps
for name in $WEATHER_IMAGES
@user_bitmaps.push(RPG::Cache.picture(name))
end
for sprite in @sprites
sprite.bitmap = @user_bitmaps[rand(@user_bitmaps.size)]
end
end
end
class Scene_Map
def change_weather
@spriteset.change_weather
end
end
class Spriteset_Map
attr_accessor :change_weather
end
这个是标题画面下雨的脚本
#===============================================================================
# ● 标题天气效果
# 作者:喵呜喵5
#-------------------------------------------------------------------------------
# 时间:2017年8月6日
#===============================================================================
class Scene_Title
def create_foreground
viewport = @sprite1.viewport
unless viewport
viewport = @m5weather_viewport = Viewport.new
@sprite1.viewport = @sprite2.viewport = viewport
end
@weather = Spriteset_Weather.new(viewport)
@weather.type = :rain
@weather.power = 10
@weather.ox = Graphics.width/2
@weather.oy = Graphics.height/2
@weather.update
end
def update
super
@weather.update
end
def dispose_foreground
@weather.dispose
@weather_viewport.dispose if @weather_viewport
end
end 作者: 0newing 时间: 2018-5-6 11:21 本帖最后由 0newing 于 2018-5-6 13:06 编辑