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

Project1

 找回密码
 注册会员
搜索

求助,这个灯光脚本是vx移植过来的出问题了

查看数: 2862 | 评论数: 2 | 收藏 2
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2013-10-12 11:41

正文摘要:

本帖最后由 没是的人 于 2013-10-12 16:59 编辑 这个脚本出问题了,在vx用的好好的 拿到rgss3了以后估计是精灵类方面的问题 切换场景以后灯光的位置居然不变 但是打开菜单以后再关掉显示就正常了 本脚本使用方法 ...

回复

没是的人 发表于 2013-10-12 16:58:33
喵呜喵5 发表于 2013-10-12 13:17
记得自己把173行论坛添加的删掉

谢谢,谢谢,谢谢,大好人啊,太感动了

点评

@迷糊的安安  发表于 2013-10-12 17:00
喵呜喵5 发表于 2013-10-12 13:17:08

  1.   $lsig = 12           #开关号


  2. class Spriteset_Map
  3.   alias les_spriteset_map_initalize initialize
  4.   alias les_spriteset_map_dispose dispose
  5.   alias les_spriteset_map_update update
  6.   alias m5_spriteset_map_refresh_characters refresh_characters
  7.   def initialize   
  8.     creat_light
  9.     les_spriteset_map_initalize
  10.     update        
  11.   end  
  12.   def dispose
  13.     les_spriteset_map_dispose
  14.     dispose_light
  15.   end  
  16.   def creat_light
  17.     @light_effects = []
  18.     setup_lights   
  19.   end  
  20.   def dispose_light
  21.     for effect in @light_effects
  22.       effect.light.dispose
  23.     end
  24.     @light_effects = []
  25.   end  
  26.   def update   
  27.     les_spriteset_map_update
  28.     update_light_effects
  29.   end
  30.   def refresh_characters
  31.     m5_spriteset_map_refresh_characters
  32.     refresh_light
  33.   end
  34.   def refresh_light
  35.     dispose_light
  36.     creat_light
  37.     update
  38.   end
  39.   
  40.   def setup_lights
  41.     for event in $game_map.events.values
  42.       next if event.list == nil
  43.       for i in 0...event.list.size
  44.         if event.list[i].code == 108 and event.list[i].parameters == ["GROUND"]
  45.           type = "GROUND"
  46.           light_effects = Light_Effect.new(event,type)
  47.           light_effects.light.zoom_x = 2
  48.           light_effects.light.zoom_y = 2
  49.           light_effects.light.opacity = 100
  50.           @light_effects.push(light_effects)
  51.         end
  52.         if event.list[i].code == 108 and event.list[i].parameters == ["FIRE"]
  53.           type = "FIRE"
  54.           light_effects = Light_Effect.new(event,type)
  55.           light_effects.light.zoom_x = 300 / 100.0
  56.           light_effects.light.zoom_y = 300 / 100.0
  57.           light_effects.light.opacity = 100
  58.           @light_effects.push(light_effects)
  59.         end
  60.         if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT"]
  61.           type = "LIGHT"
  62.           light_effects = Light_Effect.new(event,type)
  63.           light_effects.light.zoom_x = 1
  64.           light_effects.light.zoom_y = 1
  65.           light_effects.light.opacity = 150
  66.           @light_effects.push(light_effects)
  67.         end
  68.         if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT2"]
  69.           type = "LIGHT2"
  70.           light_effects = Light_Effect.new(event,type)
  71.           light_effects.light.zoom_x = 6
  72.           light_effects.light.zoom_y = 6
  73.           light_effects.light.opacity = 150
  74.           @light_effects.push(light_effects)
  75.         end
  76.         if event.list[i].code == 108 and event.list[i].parameters == ["TORCH"]
  77.           type = "TORCH"
  78.           light_effects = Light_Effect.new(event,type)
  79.           light_effects.light.zoom_x = 6
  80.           light_effects.light.zoom_y = 6
  81.           light_effects.light.opacity = 150
  82.           @light_effects.push(light_effects)
  83.         end
  84.         if event.list[i].code == 108 and event.list[i].parameters == ["TORCH2"]
  85.           type = "TORCH2"
  86.           light_effects = Light_Effect.new(event,type)
  87.           light_effects.light.zoom_x = 6
  88.           light_effects.light.zoom_y = 6
  89.           light_effects.light.opacity = 150
  90.           @light_effects.push(light_effects)
  91.         end
  92.       end
  93.     end
  94.     for effect in @light_effects
  95.       case effect.type
  96.       when "GROUND"
  97.         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
  98.         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
  99.         effect.light.blend_type = 1
  100.       when "FIRE"
  101.         effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
  102.         effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
  103.         effect.light.tone = Tone.new(255,-100,-255,   0)
  104.         effect.light.blend_type = 1
  105.       when "LIGHT"
  106.         effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
  107.         effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
  108.         effect.light.blend_type = 1
  109.       when "LIGHT2"
  110.         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  111.         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  112.         effect.light.blend_type = 1
  113.       when "TORCH"
  114.         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  115.         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  116.         effect.light.tone = Tone.new(255,-100,-255,   0)
  117.         effect.light.blend_type = 1
  118.       when "TORCH2"
  119.         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  120.         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  121.         effect.light.tone = Tone.new(255,-100,-255,   0)
  122.         effect.light.blend_type = 1
  123.       end
  124.     end
  125.   end
  126.   def update_light_effects
  127.     if $game_switches[$lsig]
  128.       for effect in @light_effects
  129.         effect.light.visible = false
  130.       end
  131.     else
  132.       for effect in @light_effects

  133.         effect.light.visible = true
  134.       end
  135.     end
  136.     for effect in @light_effects
  137.       case effect.type
  138.       when "GROUND"
  139.         effect.light.x = (effect.event.screen_x * 8 - 400 - $game_map.display_x) / 8 - 8
  140.         effect.light.y = (effect.event.screen_y * 8 - 400 - $game_map.display_y) / 8 - 36
  141.       when "FIRE"
  142.         effect.light.x = (effect.event.screen_x * 8 - 600 - $game_map.display_x) / 8 + rand(6) - 3 - 16
  143.         effect.light.y = (effect.event.screen_y * 8 - 600 - $game_map.display_y) / 8 + rand(6) - 3 - 48
  144.         effect.light.opacity = rand(10) + 90
  145.       when "LIGHT"
  146.         effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
  147.         effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
  148.       when "LIGHT2"
  149.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 32
  150.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8 - 32
  151.       when "TORCH"
  152.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20 + rand(20) - 10
  153.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8 + rand(20) - 10
  154.         effect.light.opacity = rand(30) + 70
  155.       when "TORCH2"
  156.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
  157.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
  158.         effect.light.opacity = rand(10) + 90
  159.       end
  160.     end
  161.   end
  162. end

  163. class Light_Effect
  164.   attr_accessor :light
  165.   attr_accessor :event
  166.   attr_accessor :type
  167.   def initialize(event, type)
  168.     [url=home.php?mod=space&uid=22469]@light[/url] = Sprite.new
  169.     @light.bitmap = Cache.picture("le.png")
  170.     @light.visible = true
  171.     @light.z = 1
  172.     @event = event
  173.     @type = type
  174.   end  
  175. end
复制代码
记得自己把173行论坛添加的[url]删掉

评分

参与人数 3星屑 +60 梦石 +1 收起 理由
熊喵酱 + 30 好感動~
Sion + 1 太感动了
没是的人 + 30

查看全部评分

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

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

GMT+8, 2024-11-17 03:04

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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