设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1515|回复: 6
打印 上一主题 下一主题

请教一个 天气 问题

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
60
在线时间
1 小时
注册时间
2006-6-11
帖子
27
跳转到指定楼层
1
发表于 2007-7-16 03:57:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
在下雪天气里,雪花太,太,怎么才能把雪做
版务信息:本贴由楼主自主结贴~

Lv1.梦旅人

梦石
0
星屑
60
在线时间
1 小时
注册时间
2006-6-11
帖子
27
2
 楼主| 发表于 2007-7-16 03:57:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
在下雪天气里,雪花太,太,怎么才能把雪做
版务信息:本贴由楼主自主结贴~

Lv2.观梦者

梦石
0
星屑
431
在线时间
125 小时
注册时间
2006-11-2
帖子
1200
3
发表于 2007-7-16 05:12:07 | 只看该作者
  1. module RPG
  2.   class Weather
  3.     def initialize(viewport = nil)
  4.       @type = 0
  5.       @max = 0
  6.       @ox = 0
  7.       @oy = 0
  8.       color1 = Color.new(255, 255, 255, 255)
  9.       color2 = Color.new(255, 255, 255, 128)
  10.       @rain_bitmap = Bitmap.new(7, 56)
  11.       for i in 0..6
  12.         @rain_bitmap.fill_rect(6-i, i*8, 1, 8, color1)
  13.       end
  14.       @storm_bitmap = Bitmap.new(34, 64)
  15.       for i in 0..31
  16.         @storm_bitmap.fill_rect(33-i, i*2, 1, 2, color2)
  17.         @storm_bitmap.fill_rect(32-i, i*2, 1, 2, color1)
  18.         @storm_bitmap.fill_rect(31-i, i*2, 1, 2, color2)
  19.       end
  20.       @snow_bitmap = Bitmap.new(6, 6)
  21.       @snow_bitmap.fill_rect(0, 1, 6, 4, color2)
  22.       @snow_bitmap.fill_rect(1, 0, 4, 6, color2)
  23.       @snow_bitmap.fill_rect(1, 2, 4, 2, color1)
  24.       @snow_bitmap.fill_rect(2, 1, 2, 4, color1)
  25.       @sprites = []
  26.       for i in 1..400
  27.         sprite = Sprite.new(viewport)
  28.         sprite.z = 1000
  29.         sprite.visible = false
  30.         sprite.opacity = 0
  31.         @sprites.push(sprite)
  32.       end
  33.     end
  34.     def dispose
  35.       for sprite in @sprites
  36.         sprite.dispose
  37.       end
  38.       @rain_bitmap.dispose
  39.       @storm_bitmap.dispose
  40.       @snow_bitmap.dispose
  41.     end
  42.     def type=(type)
  43.       return if @type == type
  44.       @type = type
  45.       case @type
  46.       when 1
  47.         bitmap = @rain_bitmap
  48.       when 2
  49.         bitmap = @storm_bitmap
  50.       when 3
  51.         bitmap = @snow_bitmap
  52.       else
  53.         bitmap = nil
  54.       end
  55.       for i in 1..400
  56.         sprite = @sprites[i]
  57.         if sprite != nil
  58.           sprite.visible = (i <= @max)
  59.           sprite.bitmap = bitmap
  60.         end
  61.       end
  62.     end
  63.     def ox=(ox)
  64.       return if @ox == ox;
  65.       @ox = ox
  66.       for sprite in @sprites
  67.         sprite.ox = @ox
  68.       end
  69.     end
  70.     def oy=(oy)
  71.       return if @oy == oy;
  72.       @oy = oy
  73.       for sprite in @sprites
  74.         sprite.oy = @oy
  75.       end
  76.     end
  77.     def max=(max)
  78.       return if @max == max;
  79.       @max = [[max, 0].max, 400].min
  80.       for i in 1..400
  81.         sprite = @sprites[i]
  82.         if sprite != nil
  83.           sprite.visible = (i <= @max)
  84.         end
  85.       end
  86.     end
  87.     def update
  88.       return if @type == 0
  89.       for i in 1..@max
  90.         sprite = @sprites[i]
  91.         if sprite == nil
  92.           break
  93.         end
  94.         if @type == 1
  95.           sprite.x -= 2
  96.           sprite.y += 16
  97.           sprite.opacity -= 8
  98.         end
  99.         if @type == 2
  100.           sprite.x -= 8
  101.           sprite.y += 16
  102.           sprite.opacity -= 12
  103.         end
  104.         if @type == 3
  105.           sprite.x -= 2
  106.           sprite.y += 8
  107.           sprite.opacity -= 8
  108.         end
  109.         x = sprite.x - @ox
  110.         y = sprite.y - @oy
  111.         if sprite.opacity < 64 or x < -50 or x > 750 or y < -300 or y > 500
  112.           sprite.x = rand(800) - 50 + @ox
  113.           sprite.y = rand(800) - 200 + @oy
  114.           sprite.opacity = 255
  115.         end
  116.       end
  117.     end
  118.     attr_reader :type
  119.     attr_reader :max
  120.     attr_reader :ox
  121.     attr_reader :oy
  122.   end
  123. end
复制代码



之后 Game_Screen中 @weather_max_target = (power + 1) * 4.0
改成 @weather_max_target = (power + 1) * 400.0

好了 开始感受漫天的大雪吧。
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
和记忆一起封存着的ID...
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
1 小时
注册时间
2006-6-11
帖子
27
4
 楼主| 发表于 2007-7-16 07:00:25 | 只看该作者
{/dk}哥哥,我是代码苦手,可不可以给我一个直接可以用的,再详细地教教弟弟我{/ll}
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
431
在线时间
125 小时
注册时间
2006-11-2
帖子
1200
5
发表于 2007-7-16 15:04:41 | 只看该作者
前面一个放到main前面 后边就改一句话都不会么{/fd}
和记忆一起封存着的ID...
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

精灵族の天使

梦石
0
星屑
1707
在线时间
3039 小时
注册时间
2007-3-16
帖子
33731

开拓者贵宾

6
发表于 2007-7-16 16:18:06 | 只看该作者
漫天大雪……谢了,多谢老大指教!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
1 小时
注册时间
2006-6-11
帖子
27
7
 楼主| 发表于 2007-7-16 19:10:02 | 只看该作者
谢谢!{/wx}终于会了!{/qiang}
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-9-22 08:00

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表