赞 | 0 |
VIP | 0 |
好人卡 | 4 |
积分 | 1 |
经验 | 4836 |
最后登录 | 2022-10-29 |
在线时间 | 345 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 140
- 在线时间
- 345 小时
- 注册时间
- 2009-5-15
- 帖子
- 111
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 dujian15 于 2012-12-14 11:35 编辑
脚本初学者,目前在研究脚本移植。
献上灯光脚本一个,这个脚本的功能是。
在地图中定义一个事件,在事件中填加相应的注释,这个事件便可以发光。
可以通过开关关闭光源。
但目前还存在几个问题,最好请大神重新修正发布。
1.光源对焦不准,需要在游戏中自行调整。
2.代码为LIGHT的光源还有bug
如果需要使用这个光源脚本,需要在picture文下夹下建议一个LE.png的图片,图片即是光晕的造型。
奉上两张效果图
工程限于网速原因,回家再上传。
- #==============================================================================
- # ■ 灯光脚本 for VA 版本1.0.0
- # 12.14.2012
- #------------------------------------------------------------------------------
- # 脚本修改: dujian15
- # 脚本制作: Kylock (For XP 版本 by Near Fantastica)
- #==============================================================================
- # ■ 灯光脚本 for VX 版本1.1.1
- # 5.21.2008
- #------------------------------------------------------------------------------
- # 脚本制作: Kylock (For XP 版本 by Near Fantastica)
- #==============================================================================
- # 如果您想要启用脚本,请在需要灯光效果的事件添加一个注释.
- # 打开开关将禁用灯光效果,启用效果前会检查开关,如果已经添加注释但是开关开启,那么将会停止效果.
- # 译者的话:因为发现脚本有一些问题,所以是有改动过的,如果改的不对,请M我QQ或者留言.谢谢
- #
- #==============================================================================
- # ● 更新日志
- #------------------------------------------------------------------------------
- # 1.0 - 建立最初版本
- # 1.1 - 添加了新的效果: LIGHT2, TORCH, TORCH2
- # - 更改了混合模式(使其看起来更好)
- # - 对FIRE效果增加了红色
- # 1.1.1 -非官方更新
- # -解决了效果FIRE 与 TORCH 效果当开关打开时没有消失的问题
- # -简便了开关判断
- #==============================================================================
- # ● 支持的效果(您可以添加的注释)
- #------------------------------------------------------------------------------
- # GROUND - 中等稳定的白光.
- # FIRE - 伴有轻微的闪烁的红色.
- # LIGHT - 小型稳定的白光.
- # LIGHT2 -大型稳定的白光.
- # TORCH - 伴有强烈闪烁的大型稳定的红光.
- # TORCH2 - 伴有中等烁的大型稳定的红光.
- #==============================================================================
-
- $lsig = 1 #开关号
-
-
- class Spriteset_Map
- alias les_spriteset_map_initalize initialize
- alias les_spriteset_map_dispose dispose
- alias les_spriteset_map_update update
- def initialize
- @light_effects = []
- setup_lights
- les_spriteset_map_initalize
- update
- end
- def dispose
- les_spriteset_map_dispose
- for effect in @light_effects
- effect.light.dispose
- end
- @light_effects = []
- end
- def update
- les_spriteset_map_update
- update_light_effects
- end
- def setup_lights
- for event in $game_map.events.values
- next if event.list == nil
- for i in 0...event.list.size
- if event.list[i].code == 108 and event.list[i].parameters == ["GROUND"]
- type = "GROUND"
- light_effects = Light_Effect.new(event,type)
- light_effects.light.zoom_x = 2
- light_effects.light.zoom_y = 2
- light_effects.light.opacity = 100
- @light_effects.push(light_effects)
- end
- if event.list[i].code == 108 and event.list[i].parameters == ["FIRE"]
- type = "FIRE"
- light_effects = Light_Effect.new(event,type)
- light_effects.light.zoom_x = 300 / 100.0
- light_effects.light.zoom_y = 300 / 100.0
- light_effects.light.opacity = 100
- @light_effects.push(light_effects)
- end
- if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT"]
- type = "LIGHT"
- light_effects = Light_Effect.new(event,type)
- light_effects.light.zoom_x = 1
- light_effects.light.zoom_y = 1
- light_effects.light.opacity = 150
- @light_effects.push(light_effects)
- end
- if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT2"]
- type = "LIGHT2"
- light_effects = Light_Effect.new(event,type)
- light_effects.light.zoom_x = 6
- light_effects.light.zoom_y = 6
- light_effects.light.opacity = 150
- @light_effects.push(light_effects)
- end
- if event.list[i].code == 108 and event.list[i].parameters == ["TORCH"]
- type = "TORCH"
- light_effects = Light_Effect.new(event,type)
- light_effects.light.zoom_x = 6
- light_effects.light.zoom_y = 6
- light_effects.light.opacity = 150
- @light_effects.push(light_effects)
- end
- if event.list[i].code == 108 and event.list[i].parameters == ["TORCH2"]
- type = "TORCH2"
- light_effects = Light_Effect.new(event,type)
- light_effects.light.zoom_x = 6
- light_effects.light.zoom_y = 6
- light_effects.light.opacity = 150
- @light_effects.push(light_effects)
- end
- end
- end
- for effect in @light_effects
- case effect.type
- when "GROUND"
- effect.light.x = (effect.event.screen_x * 8 - 400 - $game_map.display_x) / 8 - 8
- effect.light.y = (effect.event.screen_y * 8 - 400 - $game_map.display_y) / 8 - 36
- effect.light.blend_type = 1
- when "FIRE"
- effect.light.x = (effect.event.screen_x * 8 - 600 - $game_map.display_x) / 8 + rand(6) - 3 - 16
- effect.light.y = (effect.event.screen_y * 8 - 600 - $game_map.display_y) / 8 + rand(6) - 3 - 48
- effect.light.tone = Tone.new(255,-100,-255, 0)
- effect.light.blend_type = 1
- when "LIGHT"
- effect.light.x = (effect.event.screen_x * 8 - 400 - $game_map.display_x) / 8
- effect.light.y = (effect.event.screen_y * 8 - 400 - $game_map.display_y) / 8
- effect.light.blend_type = 1
- when "LIGHT2"
- effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
- effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
- effect.light.blend_type = 1
- when "TORCH"
- effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
- effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
- effect.light.tone = Tone.new(255,-100,-255, 0)
- effect.light.blend_type = 1
- when "TORCH2"
- effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
- effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
- effect.light.tone = Tone.new(255,-100,-255, 0)
- effect.light.blend_type = 1
- end
- end
- end
- def update_light_effects
- if $game_switches[$lsig]
- for effect in @light_effects
- effect.light.visible = false
- end
- else
- for effect in @light_effects
- effect.light.visible = true
- end
- end
- for effect in @light_effects
- case effect.type
- when "GROUND"
- effect.light.x = (effect.event.screen_x * 8 - 400 - $game_map.display_x) / 8 - 8
- effect.light.y = (effect.event.screen_y * 8 - 400 - $game_map.display_y) / 8 - 36
- when "FIRE"
- effect.light.x = (effect.event.screen_x * 8 - 600 - $game_map.display_x) / 8 + rand(6) - 3 - 16
- effect.light.y = (effect.event.screen_y * 8 - 600 - $game_map.display_y) / 8 + rand(6) - 3 - 48
- effect.light.opacity = rand(10) + 90
- when "LIGHT"
- effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
- effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
- when "LIGHT2"
- effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
- effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
- when "TORCH"
- effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20 + rand(20) - 10
- effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8 + rand(20) - 10
- effect.light.opacity = rand(30) + 70
- when "TORCH2"
- effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
- effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
- effect.light.opacity = rand(10) + 90
- end
- end
- end
- end
- class Light_Effect
- attr_accessor :light
- attr_accessor :event
- attr_accessor :type
- def initialize(event, type)
- [url=home.php?mod=space&uid=22469]@light[/url] = Sprite.new
- @light.bitmap = Cache.picture("le.png")
- @light.visible = true
- @light.z = 1000
- @event = event
- @type = type
- end
- end
复制代码 |
评分
-
查看全部评分
|