赞 | 1 |
VIP | 0 |
好人卡 | 0 |
积分 | 8 |
经验 | 35219 |
最后登录 | 2025-7-7 |
在线时间 | 924 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 783
- 在线时间
- 924 小时
- 注册时间
- 2006-6-26
- 帖子
- 1530
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 1243852 于 2012-8-29 17:17 编辑
- # 设置烛光种类数
- CANDLE_NUMBER = 2
- # 设置控制开关,不用的话设0
- CANDLE_SWITCH = 4
- #--------------------------------------------------------------------------
- # ● 开启或关闭烛光
- #--------------------------------------------------------------------------
- def candlelight(on=true)
- $candlelight_on = $game_switches[CANDLE_SWITCH] = on
- if on
- # 生成黑色画面
- $black_rect = Sprite.new
- $black_rect.bitmap = Bitmap.new(544, 416)
- $black_rect.bitmap.fill_rect(0, 0, 544, 416, Color.new(200, 200, 200))
- $black_rect.blend_type = 2
-
- # 黑色透明度,决定黑暗的程度
- $black_rect.opacity = 180
-
- # 生成烛光
- $candle_rect = Array.new(CANDLE_NUMBER+1).map{|sprite| sprite=Sprite.new}
- #===============================================================================]
- # 烛光在此设置
- #===============================================================================
- # 指定第一种烛光
- $candle_rect[1].bitmap = Cache.picture("write1")
-
- # 指定第二种烛光
- $candle_rect[2].bitmap = Cache.picture("write2")
- #===============================================================================
- #===============================================================================
- $candle_rect.each {|sprite|
- if sprite.bitmap
- sprite.visible = false
- sprite.ox, sprite.oy = sprite.bitmap.width/2, sprite.bitmap.height/2
- end}
- else
- # 释放黑色画面和所有烛光
- $black_rect.dispose
- $candle_rect.each {|sprite| sprite.dispose}
- $game_lighterlist.clear
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置有烛光的角色
- # candle_index : 烛光编号
- # object : 角色编号,可以为数字或是数字数组
- #--------------------------------------------------------------------------
- def candles(candle_index, object)
- $game_lighterlist ||= []
- $game_lighterlist[candle_index] ||= []
- if object.is_a?(Integer)
- $game_lighterlist[candle_index] << object
- elsif object.is_a?(Array)
- $game_lighterlist[candle_index] += object
- end
- # 移除重复的角色
- $game_lighterlist[candle_index].uniq!
- # 开启烛光功能
- candlelight unless $candlelight_on
- end
- #--------------------------------------------------------------------------
- # ● 初始化烛光
- #--------------------------------------------------------------------------
- def initialize_candle
- for k in 1...$candle_rect.size
- next unless $game_lighterlist[k]
- for j in $game_lighterlist[k]
- ch = j == 0 ? $game_player : $game_map.events[j]
- $candle_rect[k].x = ch.screen_x
- $candle_rect[k].y = ch.screen_y - 16
- lsx = $candle_rect[k].x - $candle_rect[k].bitmap.width / 2
- lsy = $candle_rect[k].y - $candle_rect[k].bitmap.height / 2
- $black_rect.bitmap.blt(lsx, lsy, $candle_rect[k].bitmap, $black_rect.bitmap.rect)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新烛光
- #--------------------------------------------------------------------------
- def update_candle
- if $game_lighterlist != []
- light = []
- $game_lighterlist.each{|i| light+=i if i}
- light.each do |i|
- ch = i == 0 ? $game_player : $game_map.events[i]
- unless ch.moving_judge?
- $black_rect.bitmap.fill_rect(0, 0, 544, 416, Color.new(200, 200, 200))
- initialize_candle
- end
- break
- end
- end
- end
- class Game_Character
- #--------------------------------------------------------------------------
- # ● 判断移动
- #--------------------------------------------------------------------------
- def moving_judge?
- return (!stopping? or (@pattern != @original_pattern))
- end
- end
- class Game_Map
- #--------------------------------------------------------------------------
- # ● 刷新烛光
- #--------------------------------------------------------------------------
- alias update_candle_system update
- def update
- if $candlelight_on
- update_candle
- $candlelight_on = false unless $game_switches[CANDLE_SWITCH]
- candlelight(false) unless $candlelight_on
- end
- update_candle_system
- end
- end
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # ● 生成烛光
- #--------------------------------------------------------------------------
- alias candle_system_start start
- def start
- candle_system_start
- candlelight if $candlelight_on
- initialize_candle if $candlelight_on
- end
- end
复制代码 这是VX的烛光系统,我试过用事件,放一张烛光图片进去,来做烛光系统,但效果超级不好。。亮度并不像真正的光亮,我想,还是要用脚本来合成的光,要好些吧。
VA烛光系统已经找到,不好意思,请版主删帖。 |
|