class Weather_change #==============生成初始值================= def start if $Weather_change_num == nil $stop_weather = 0 $Weather_change_num = 0 end case rand(2) when 0 @trajectory_x = rand(744) when 1 @trajectory_x = -rand(200) end @trajectory_y = -rand(416) end #===============生成图像================ def Generating_image(type) case type # 雪 when 1 $weather_arr = [] $weather_x = [] $weather_y = [] for a in 0..100 start $weather_arr[a] = Sprite.new $weather_arr[a].bitmap = Bitmap.new("Graphics/weather/雪花.png") $weather_arr[a].x = @trajectory_x $weather_arr[a].y = @trajectory_y $weather_x[a] = @trajectory_x $weather_y[a] = @trajectory_y end # 雨1 when 2 # 雨2 when 3 # 雾 when 4 # 风 when 5 # 暴风 when 6 # 冰雹 when 7 end end #==============要生成的天气类型============== def Weather_type(type) case type #================================= # 普通天气 #================================= # 小雪 when 0 start Generating_image(1) $game_switches[38] = true # 中雪 when 1 # 大雪 when 2 # 小雨 when 3 # 中雨(天灰) when 4 # 大雨(天黑) when 5 # 大雨(打雷+天黑) when 6 # 空打雷 when 7 # 雾 when 8 # 小风 when 9 # 大风 when 10 #================================= # 灾难性天气 #================================= # 暴风 when 11 # 冰雹 when 12 # 霜冻 when 13 # 台风 when 14 # 雷电 when 15 # 地震 when 16 # 沙尘暴 when 17 # 停止天气 when 100 end end #==================运动轨迹=================== # 往右下运动 def path_particle_1(type) case type when 1 x = 2 y = 4 when 2 end for a in 0..100 $weather_x[a] += x $weather_y[a] += y end end # 往左下运动 def path_particle_2 end # 水平向左 def path_particle_3 end # 水平向右 def path_particle_4 end # 竖直向下 def path_particle_5 end # 往右下摆动 def path_particle_6 end # 往左下摆动 def path_particle_7 end #==================要循环的天气================= def light_snow while $stop_weather < 1 path_particle_1(1) for a in 0..100 $weather_arr[a].x = $weather_x[a] $weather_arr[a].y = $weather_y[a] end 1.times { Fiber.yield } Graphics.update end end end
class Weather_change
#==============生成初始值=================
def start
if $Weather_change_num == nil
$stop_weather = 0
$Weather_change_num = 0
end
case rand(2)
when 0
@trajectory_x = rand(744)
when 1
@trajectory_x = -rand(200)
end
@trajectory_y = -rand(416)
end
#===============生成图像================
def Generating_image(type)
case type
# 雪
when 1
$weather_arr = []
$weather_x = []
$weather_y = []
for a in 0..100
start
$weather_arr[a] = Sprite.new
$weather_arr[a].bitmap = Bitmap.new("Graphics/weather/雪花.png")
$weather_arr[a].x = @trajectory_x
$weather_arr[a].y = @trajectory_y
$weather_x[a] = @trajectory_x
$weather_y[a] = @trajectory_y
end
# 雨1
when 2
# 雨2
when 3
# 雾
when 4
# 风
when 5
# 暴风
when 6
# 冰雹
when 7
end
end
#==============要生成的天气类型==============
def Weather_type(type)
case type
#=================================
# 普通天气
#=================================
# 小雪
when 0
start
Generating_image(1)
$game_switches[38] = true
# 中雪
when 1
# 大雪
when 2
# 小雨
when 3
# 中雨(天灰)
when 4
# 大雨(天黑)
when 5
# 大雨(打雷+天黑)
when 6
# 空打雷
when 7
# 雾
when 8
# 小风
when 9
# 大风
when 10
#=================================
# 灾难性天气
#=================================
# 暴风
when 11
# 冰雹
when 12
# 霜冻
when 13
# 台风
when 14
# 雷电
when 15
# 地震
when 16
# 沙尘暴
when 17
# 停止天气
when 100
end
end
#==================运动轨迹===================
# 往右下运动
def path_particle_1(type)
case type
when 1
x = 2
y = 4
when 2
end
for a in 0..100
$weather_x[a] += x
$weather_y[a] += y
end
end
# 往左下运动
def path_particle_2
end
# 水平向左
def path_particle_3
end
# 水平向右
def path_particle_4
end
# 竖直向下
def path_particle_5
end
# 往右下摆动
def path_particle_6
end
# 往左下摆动
def path_particle_7
end
#==================要循环的天气=================
def light_snow
while $stop_weather < 1
path_particle_1(1)
for a in 0..100
$weather_arr[a].x = $weather_x[a]
$weather_arr[a].y = $weather_y[a]
end
1.times { Fiber.yield }
Graphics.update
end
end
end
|