赞 | 2 |
VIP | 109 |
好人卡 | 208 |
积分 | 4 |
经验 | 22037 |
最后登录 | 2024-11-11 |
在线时间 | 1198 小时 |
Lv2.观梦者 虚構歪曲
- 梦石
- 0
- 星屑
- 364
- 在线时间
- 1198 小时
- 注册时间
- 2010-12-18
- 帖子
- 3928
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 忧雪の伤 于 2011-6-26 10:45 编辑
预览:
范例:
Weather.rar
(204.69 KB, 下载次数: 1684)
(For XP)
脚本:- #==============================================================================
- # ** Weather
- #------------------------------------------------------------------------------
- # - Version(1.0.06.26).
- #==============================================================================
- class Weather
- #--------------------------------------------------------------------------
- MOD = Module.constants.include?('RGE') ? :Frame : :Graphics
- #--------------------------------------------------------------------------
- attr_reader('max')
- attr_accessor('fade')
- attr_accessor('speed')
- attr_accessor('direction')
- #--------------------------------------------------------------------------
- [:z, :color, :bitmap, :visible].each do |sym|
- ary = :sprites
- method = :define_method
- eval("#{method}('#{sym}='){|#{sym}|@#{ary}.each{|obj|obj.#{sym}=#{sym}}}")
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize(arg = 40)
- @max = arg
- @speed = 0
- @sprites = []
- @fade = false
- @direction = 0
- {:width => 640, :height => 480}.each do |sym, var|
- eval("@#{sym}=#{MOD}.methods.include?('#{sym}')?#{MOD}.#{sym} : #{var}")
- end
- @max.times { @sprites.push(Sprite.new) }
- @sprites.each {|sprite| sprite.x = rand(@width) }
- @sprites.each {|sprite| sprite.y = -rand(@height) }
- end
- #--------------------------------------------------------------------------
- # * Update
- #--------------------------------------------------------------------------
- def update
- fall
- revert
- end
- #--------------------------------------------------------------------------
- # * Dispose
- #--------------------------------------------------------------------------
- def dispose
- @sprites.each {|sprite| sprite.dispose }
- end
- #--------------------------------------------------------------------------
- # * Zoom
- #--------------------------------------------------------------------------
- def zoom=(zoom)
- @sprites.each {|sprite| sprite.zoom_x = sprite.zoom_y = zoom }
- end
- #--------------------------------------------------------------------------
- # * Fall
- #--------------------------------------------------------------------------
- def fall
- @sprites.each {|sprite| sprite.y = sprite.y + rand(@speed) + 1 }
- @sprites.each {|sprite| sprite.x = sprite.x + rand(2) * @direction }
- return unless @fade
- @sprites.each do |sprite|
- opacity = @width - 255
- sprite.opacity = sprite.y < opacity ? opacity - sprite.y : 0
- end
- end
- #--------------------------------------------------------------------------
- # * Revert
- #--------------------------------------------------------------------------
- def revert
- @sprites.each do |sprite|
- next if sprite.y < @height and sprite.x.between?(0, @width)
- x = rand(@width)
- y = -sprite.bitmap.rect.height
- sprite.x, sprite.y, sprite.opacity = x, y, 255
- end
- end
- end
复制代码 |
评分
-
查看全部评分
|