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

Project1

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

[RMVX发布] 聪聪的多人烛光系统(献给苏联君的礼物)

[复制链接]

Lv4.逐梦者 (版主)

聪仔

梦石
0
星屑
6182
在线时间
3077 小时
注册时间
2013-12-26
帖子
3145
跳转到指定楼层
1
发表于 2016-5-11 15:45:01 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 正太君 于 2016-5-11 15:57 编辑

常规办法蒙一张镂空的光斑图只能处理简单的单人烛光效果,若是多人烛光效果就没法实现了呢...
于是苏联君,聪聪给你献上礼物了,希望你会喜欢,
【使用方法】
【事件脚本】输入:
  $game_system.candle_ch_new = [0,x,y,z...]
  0表示主角,x,y,z...表示事件编号,所有涉及的角色和事件周围会有烛光效果...
【事件脚本】输入:
  $game_system.candle_ch_new = []
  取消烛光效果显示,但环境仍然黑暗...
【事件脚本】输入:
  $game_system.candle_ch_new = nil
  取消烛光效果显示,且环境亮度还原...


上效果图...



上范例...
Project3.rar (250.08 KB, 下载次数: 177)

上脚本...
RUBY 代码复制
  1. #==============================================================================
  2. # ■ 聪聪的多人烛光系统
  3. #------------------------------------------------------------------------------
  4. #   使用方法:
  5. #
  6. #    【事件脚本】输入:
  7. #    $game_system.candle_ch_new = [0,x,y,z...]
  8. #    0表示主角,x,y,z...表示事件编号,所有涉及的角色和事件周围会有烛光效果...
  9. #
  10. #    【事件脚本】输入:
  11. #    $game_system.candle_ch_new = []
  12. #    取消烛光效果显示,但环境仍然黑暗...
  13. #
  14. #    【事件脚本】输入:
  15. #    $game_system.candle_ch_new = nil
  16. #    取消烛光效果显示,且环境亮度还原...
  17. #
  18. #------------------------------------------------------------------------------
  19. #  
  20. #    转载请保留脚本来源:本脚本来自rpg.blue
  21. #                                                        作者:聪聪(正太君)
  22. #                                                                2016-05-11
  23. #==============================================================================
  24. class Candle
  25.   # 设置暗处不透明度(0-255)...
  26.   OPACITY = 128
  27.   # 设置昏暗度(0-255)...
  28.   DARK = 200
  29.   #--------------------------------------------------------------------------
  30.   # ● # 生成黑暗背景和烛光
  31.   #--------------------------------------------------------------------------
  32.   def candlelight
  33.     @black_rect = Sprite.new
  34.     @black_rect.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  35.     @black_rect.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(DARK, DARK, DARK))
  36.     @black_rect.blend_type = 2
  37.     @black_rect.opacity = OPACITY
  38.     @candle_rect = Sprite.new
  39.     @candle_rect.bitmap = Cache.picture("Light0")
  40.     @candle_rect.visible = false
  41.     @candle_rect.ox = @candle_rect.bitmap.width / 2
  42.     @candle_rect.oy = @candle_rect.bitmap.height / 2
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 设置有烛光的角色
  46.   #--------------------------------------------------------------------------
  47.   def set_candles(candle_ch)
  48.     return if candle_ch == nil
  49.     chs = candle_ch
  50.     @game_lighterlist = [] if @game_lighterlist.nil?
  51.     @game_lighterlist << $game_player if chs.include?(0)
  52.     chs.each {|i| @game_lighterlist << $game_map.events[i] if i != 0}
  53.     # 移除重复的角色
  54.     @game_lighterlist.uniq!
  55.     # 开启烛光功能
  56.     candlelight
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● 初始化烛光
  60.   #--------------------------------------------------------------------------
  61.   def initialize_candle(ch)
  62.     lsx = @candle_rect.x = ch.screen_x - @candle_rect.ox
  63.     lsy = @candle_rect.y = ch.screen_y - @candle_rect.oy - 16
  64.     @black_rect.bitmap.blt(lsx, lsy, @candle_rect.bitmap, @black_rect.bitmap.rect)
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ● 更新烛光
  68.   #--------------------------------------------------------------------------
  69.   def update_candle
  70.     if $game_system.candle_ch == $game_system.candle_ch_new and @black_rect
  71.       @black_rect.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(DARK, DARK, DARK))
  72.       @game_lighterlist.each {|i| initialize_candle(i)}
  73.     else
  74.       dispose_candle
  75.     end
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # ● 释放烛光
  79.   #--------------------------------------------------------------------------
  80.   def dispose_candle
  81.     @black_rect.dispose if @black_rect
  82.     @candle_rect.dispose if @candle_rect
  83.     @game_lighterlist.clear if @game_lighterlist
  84.   end  
  85. end
  86.  
  87. class Scene_Map < Scene_Base
  88.   attr_reader   :candle
  89.   #--------------------------------------------------------------------------
  90.   # ● 开始后处理
  91.   #--------------------------------------------------------------------------
  92.   def post_start
  93.     @candle = Candle.new
  94.     @candle.set_candles($game_system.candle_ch)
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● 更新画面
  98.   #--------------------------------------------------------------------------
  99.   alias :o_update :update
  100.   def update
  101.     o_update
  102.     if $game_system.candle_ch != $game_system.candle_ch_new
  103.       @candle.dispose_candle
  104.       $game_system.candle_ch = $game_system.candle_ch_new
  105.       @candle = Candle.new
  106.       @candle.set_candles($game_system.candle_ch)
  107.     end
  108.     @candle.update_candle
  109.   end
  110. end
  111.  
  112. class Game_System
  113. attr_accessor :candle_ch
  114. attr_accessor :candle_ch_new
  115. end

评分

参与人数 4星屑 +643 收起 理由
NOLO + 10 感谢分享
天使喝可乐 + 66 塞糖
zaiy2863 + 47 今天的糖都给你
Password + 520 聪聪又变帅了w

查看全部评分

聪聪全国第三帅...
他们都叫我【人赢聪】
我的RM能力雷达图:

Lv3.寻梦者

梦石
0
星屑
2391
在线时间
54 小时
注册时间
2011-11-23
帖子
4
2
发表于 2016-6-7 23:01:34 | 只看该作者
无敌啊。。。。。。。。。。。。。。。。。。。。。。。。
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
369
在线时间
144 小时
注册时间
2013-6-11
帖子
83
3
发表于 2016-12-3 19:34:22 | 只看该作者
感谢分享
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-5 07:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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