本帖最后由 taroxd 于 2014-7-22 20:12 编辑  
冲啊小笼包 发表于 2014-7-22 20:00 ![]()  
不是。我设置了某个事件发光,但是主角移动,事件没动,但是光影却跟着主角走了=.=烛光那是。 
 
我就是想 ...  
 
第162行开始是设置图片的位置 
 
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 
 
 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  
 
  
 
说实话,我没有范例以及素材什么的,因此不知道为什么会产生这样的状况。 
 
你看一下你是使用哪一种类型的灯光?你可以自己改改坐标的算法试试看。 
 
effect.event.screen_x 代表当前事件在画面上的x坐标。 
$game_map.display_x 代表地图卷动的x值。x * 32 即为地图卷动的横坐标。 
 
也许在计算的时候,不考虑 $game_map.display_x 就可以了?因为要让光影只和事件在画面上的位置有关嘛。总之你改改看吧。 |