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

Project1

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

[已经解决] 求教OverlayMappingTest怎么用

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
54 小时
注册时间
2013-9-23
帖子
29
跳转到指定楼层
1
发表于 2013-11-9 15:22:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
脚本贴到工程里了文件也丢到文件夹了,,然后应该做什么,,,

点评

你能先把脚本贴出来么,百度为您找到相关结果约835个……  发表于 2013-11-9 15:29

Lv1.梦旅人

梦石
0
星屑
50
在线时间
54 小时
注册时间
2013-9-23
帖子
29
2
 楼主| 发表于 2013-11-9 15:52:07 | 只看该作者
那好吧。。。。。。。。。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
54 小时
注册时间
2013-9-23
帖子
29
3
 楼主| 发表于 2013-11-9 15:54:21 | 只看该作者
本帖最后由 76213585 于 2013-11-9 11:24 编辑

RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yami Script Ace - Overlay Mapping
  4. # -- Last Updated: 2011.12.29
  5. # -- Level: Easy
  6. # -- Requires: n/a
  7. # -- Credit: Hanzo Kimura for Original Script
  8. #
  9. #==============================================================================
  10.  
  11. $imported = {} if $imported.nil?
  12. $imported["YSA-OverlayMapping"] = true
  13.  
  14. #==============================================================================
  15. # ▼ Updates
  16. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  17. # 2011.12.29 - Bugfix for transfer.
  18. # 2011.12.10 - Started and Finished Script.
  19. #
  20. #==============================================================================
  21. # ▼ Introduction
  22. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23. # This script based on Hanzo Kimura's idea. This will automatically load map's
  24. # overlay by map ID, and a map can have more than one image per layer, so you
  25. # don't have to create two or more map just for day/night or when an event occur.
  26. #
  27. #==============================================================================
  28. # ▼ Instructions
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # Create a folder in Graphics and name it Overlay.
  31. # Put all of your overlay into Graphics/Overlay.
  32. # Your overlay file will have the name: "Filename Prefix" + Map-ID + "-" + Number
  33. # which "Filename Prefix" is the one you will config below
  34. # Map-ID is your map's ID
  35. # Number is 1, 2, 3, ... using for Overlay Variables.
  36. #
  37. # Example: Graphics/Overlay/ground2-1.png
  38. # Which means this will be ground layer, for map 2, variable = 1
  39. #
  40. # Light/Shadow must be .jpg
  41. # Parallax/Ground must be .png
  42. #
  43. #==============================================================================
  44.  
  45. module YSA
  46.   module OVERLAY
  47.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  48.     # - Overlay Switches -
  49.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  50.     # These are switches which are enable overlay layers. Turn them on to show
  51.     # them in your maps.
  52.     #--------------------------------------------------------------------------
  53.     # Default: ON
  54.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  55.     LIGHT_SWITCH = 1        # Turn on/off light layer
  56.     SHADOW_SWITCH = 2       # Turn on/off shadow layer
  57.     PARALLAX_SWITCH = 3     # Turn on/off parallax layer
  58.     GROUND_SWITCH = 4       # Turn on/off ground layer
  59.  
  60.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  61.     # - Overlay Variables -
  62.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  63.     # A map can have more than one image per layer, that means you can have a
  64.     # different light/shadow for day and night, or have a different ground when
  65.     # an event occured.
  66.     #--------------------------------------------------------------------------
  67.     # Default: 1
  68.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  69.     LIGHT_VARIABLE = 2      # Switch to another light
  70.     SHADOW_VARIABLE = 2     # Switch to another shadow
  71.     PARALLAX_VARIABLE = 1   # Switch to another parallax
  72.     GROUND_VARIABLE = 1     # Switch to another ground
  73.  
  74.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  75.     # - Filename Prefix -
  76.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  77.     # This will make this script automatic, it will check if there are layers in
  78.     # overlay folder
  79.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  80.     LIGHT = "light"         # Light layer's filename prefix
  81.     SHADOW = "shadow"       # Shadow layer's filename prefix
  82.     PARALLAX = "par"        # Parallax layer's filename prefix
  83.     GROUND = "ground"       # Ground layer's filename prefix
  84.  
  85.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  86.     # - Overlay Opacity -
  87.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  88.     # This will make this script automatic, it will check if there are layers in
  89.     # overlay folder
  90.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  91.     GROUND_OPACITY = 255
  92.     PARALLAX_OPACITY = 255
  93.     LIGHT_OPACITY = 128
  94.     SHADOW_OPACITY = 96
  95.   end #OVERLAY
  96. end # YSA
  97.  
  98. #==============================================================================
  99. # ▼ Editting anything past this point may potentially result in causing
  100. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  101. # halitosis so edit at your own risk.
  102. #==============================================================================
  103.  
  104. #==============================================================================
  105. # ■ Cache
  106. #==============================================================================
  107.  
  108. module Cache
  109.  
  110.   #--------------------------------------------------------------------------
  111.   # new method: overlay
  112.   #--------------------------------------------------------------------------
  113.   def self.overlay(filename)
  114.     load_bitmap("Graphics/Overlay/", filename)
  115.   end
  116.  
  117. end # Cache
  118.  
  119. #==============================================================================
  120. # ■ DataManager
  121. #==============================================================================
  122.  
  123. module DataManager
  124.  
  125.   #--------------------------------------------------------------------------
  126.   # alias method: setup_new_game
  127.   #--------------------------------------------------------------------------
  128.   class <<self; alias ovm_setup_new_game setup_new_game; end
  129.   def self.setup_new_game
  130.     ovm_setup_new_game
  131.     setup_overlay_mapping
  132.   end
  133.  
  134.   #--------------------------------------------------------------------------
  135.   # new method: setup_overlay_mapping
  136.   #--------------------------------------------------------------------------
  137.   def self.setup_overlay_mapping
  138.     # Control switches
  139.     $game_switches[YSA::OVERLAY::LIGHT_SWITCH] = true
  140.     $game_switches[YSA::OVERLAY::SHADOW_SWITCH] = true
  141.     $game_switches[YSA::OVERLAY::GROUND_SWITCH] = true
  142.     $game_switches[YSA::OVERLAY::PARALLAX_SWITCH] = true
  143.  
  144.     # Control variables
  145.     $game_variables[YSA::OVERLAY::LIGHT_VARIABLE] = 1
  146.     $game_variables[YSA::OVERLAY::SHADOW_VARIABLE] = 1
  147.     $game_variables[YSA::OVERLAY::GROUND_VARIABLE] = 1
  148.     $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE] = 1
  149.   end
  150.  
  151. end # DataManager
  152.  
  153. #==============================================================================
  154. # ■ Spriteset_Map
  155. #==============================================================================
  156.  
  157. class Spriteset_Map
  158.  
  159.   #--------------------------------------------------------------------------
  160.   # alias method: initialize
  161.   #--------------------------------------------------------------------------
  162.   alias overlay_initialize initialize
  163.   def initialize
  164.     overlay_initialize
  165.     create_overlay_map
  166.     update
  167.   end
  168.  
  169.   #--------------------------------------------------------------------------
  170.   # new method: check_file
  171.   #--------------------------------------------------------------------------
  172.   def check_file(type)
  173.     filename = "Graphics/Overlay/"
  174.     filename += YSA::OVERLAY::GROUND if type == "ground"
  175.     filename += YSA::OVERLAY::LIGHT if type == "light"
  176.     filename += YSA::OVERLAY::SHADOW if type == "shadow"
  177.     filename += YSA::OVERLAY::PARALLAX if type == "par"
  178.     filename += $game_map.map_id.to_s
  179.     filename += "-" + $game_variables[YSA::OVERLAY::GROUND_VARIABLE].to_s if type == "ground"
  180.     filename += "-" + $game_variables[YSA::OVERLAY::LIGHT_VARIABLE].to_s if type == "light"
  181.     filename += "-" + $game_variables[YSA::OVERLAY::SHADOW_VARIABLE].to_s if type == "shadow"
  182.     filename += "-" + $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE].to_s if type == "par"
  183.     filename += ".jpg" if type == "light" || type == "shadow"
  184.     filename += ".png" if type == "par" || type == "ground"
  185.     return FileTest.exist?(filename)
  186.   end
  187.  
  188.   #--------------------------------------------------------------------------
  189.   # new method: create_overlay_map
  190.   #--------------------------------------------------------------------------
  191.   def create_overlay_map
  192.     w = Graphics.width
  193.     h = Graphics.height
  194.     @current_light = 0
  195.     @current_shadow = 0
  196.     @current_par = 0
  197.     @current_ground = 0
  198.     # Ground Layer
  199.     @ground = Sprite.new(@viewport1)
  200.     @ground.z = 1
  201.     @ground.opacity = YSA::OVERLAY::GROUND_OPACITY
  202.     # Light Layer
  203.     @light_viewport = Viewport.new(0, 0, w, h)
  204.     @light_viewport.z = 10
  205.     [url=home.php?mod=space&uid=22469]@light[/url] = Sprite.new(@light_viewport)
  206.     @light.opacity = YSA::OVERLAY::LIGHT_OPACITY
  207.     @light.blend_type = 1
  208.     # Shadow Layer
  209.     @shadow_viewport = Viewport.new(0, 0, w, h)
  210.     @shadow_viewport.z = 9
  211.     [url=home.php?mod=space&uid=31758]@Shadow[/url] = Sprite.new(@shadow_viewport)
  212.     @shadow.opacity = YSA::OVERLAY::SHADOW_OPACITY
  213.     @shadow.blend_type = 2
  214.     # Parallax Layer
  215.     @par_viewport = Viewport.new(0, 0, w, h)
  216.     @par_viewport.z = 8
  217.     @par = Sprite.new(@par_viewport)
  218.     @par.opacity = YSA::OVERLAY::PARALLAX_OPACITY
  219.   end
  220.  
  221.   #--------------------------------------------------------------------------
  222.   # alias method: dispose_parallax
  223.   #--------------------------------------------------------------------------
  224.   alias overlay_dispose_parallax dispose_parallax
  225.   def dispose_parallax
  226.     overlay_dispose_parallax
  227.     dispose_overlay_map
  228.   end
  229.  
  230.   #--------------------------------------------------------------------------
  231.   # new method: dispose_overlay_map
  232.   #--------------------------------------------------------------------------
  233.   def dispose_overlay_map
  234.     @ground.dispose
  235.     @shadow_viewport.dispose
  236.     @light_viewport.dispose
  237.     @light.dispose
  238.     @shadow.dispose
  239.     @par_viewport.dispose
  240.     @par.dispose
  241.   end
  242.  
  243.   #--------------------------------------------------------------------------
  244.   # alias method: update_parallax
  245.   #--------------------------------------------------------------------------
  246.   alias overlay_update_parallax update_parallax
  247.   def update_parallax
  248.     overlay_update_parallax
  249.     # Parallax
  250.     if @ground != nil
  251.       if check_file("ground")
  252.         @ground.visible = $game_switches[YSA::OVERLAY::GROUND_SWITCH] if @ground.visible != $game_switches[YSA::OVERLAY::GROUND_SWITCH]
  253.         @ground.ox = $game_map.display_x * 32 if @ground.ox != $game_map.display_x * 32
  254.         @ground.oy = $game_map.display_y * 32 if @ground.oy != $game_map.display_y * 32
  255.         @ground.tone = $game_map.screen.tone
  256.         if @current_ground != $game_variables[YSA::OVERLAY::GROUND_VARIABLE]
  257.           filename = YSA::OVERLAY::GROUND
  258.           filename += $game_map.map_id.to_s
  259.           filename += "-" + $game_variables[YSA::OVERLAY::GROUND_VARIABLE].to_s
  260.           @ground.bitmap = Cache.overlay(filename)
  261.           @current_ground = $game_variables[YSA::OVERLAY::GROUND_VARIABLE]
  262.         end
  263.       else
  264.         @ground.visible = false
  265.       end
  266.     end
  267.     # Light
  268.     if [url=home.php?mod=space&uid=22469]@light[/url] != nil && @light_viewport != nil
  269.       if check_file("light")
  270.         @light.visible = $game_switches[YSA::OVERLAY::LIGHT_SWITCH] if @light.visible != $game_switches[YSA::OVERLAY::LIGHT_SWITCH]
  271.         @light.ox = $game_map.display_x * 32 if @light.ox != $game_map.display_x * 32
  272.         @light.oy = $game_map.display_y * 32 if @light.oy != $game_map.display_y * 32
  273.         @light.tone = $game_map.screen.tone
  274.         @light_viewport.ox = $game_map.screen.shake
  275.         @light_viewport.color = $game_map.screen.flash_color
  276.         if @current_light != $game_variables[YSA::OVERLAY::LIGHT_VARIABLE]
  277.           filename = YSA::OVERLAY::LIGHT
  278.           filename += $game_map.map_id.to_s
  279.           filename += "-" + $game_variables[YSA::OVERLAY::LIGHT_VARIABLE].to_s
  280.           @light.bitmap = Cache.overlay(filename)
  281.           @current_light = $game_variables[YSA::OVERLAY::LIGHT_VARIABLE]
  282.         end
  283.       else
  284.         @light.visible = false
  285.       end   
  286.     end
  287.     # Shadow
  288.     if [url=home.php?mod=space&uid=31758]@Shadow[/url] != nil && @shadow_viewport != nil
  289.       if check_file("shadow")
  290.         @shadow.visible = $game_switches[YSA::OVERLAY::SHADOW_SWITCH] if @shadow.visible != $game_switches[YSA::OVERLAY::SHADOW_SWITCH]
  291.         @shadow.ox = $game_map.display_x * 32 if @shadow.ox != $game_map.display_x * 32
  292.         @shadow.oy = $game_map.display_y * 32 if @shadow.oy != $game_map.display_y * 32
  293.         @shadow.tone = $game_map.screen.tone
  294.         @shadow_viewport.ox = $game_map.screen.shake
  295.         @shadow_viewport.color = $game_map.screen.flash_color
  296.         if @current_shadow != $game_variables[YSA::OVERLAY::SHADOW_VARIABLE]
  297.           filename = YSA::OVERLAY::SHADOW
  298.           filename += $game_map.map_id.to_s
  299.           filename += "-" + $game_variables[YSA::OVERLAY::SHADOW_VARIABLE].to_s
  300.           @shadow.bitmap = Cache.overlay(filename)
  301.           @current_shadow = $game_variables[YSA::OVERLAY::SHADOW_VARIABLE]
  302.         end
  303.       else
  304.         @shadow.visible = false
  305.       end
  306.     end
  307.     # Parallax
  308.     if @par != nil && @par_viewport != nil
  309.       if check_file("par")
  310.         @par.visible = $game_switches[YSA::OVERLAY::PARALLAX_SWITCH] if @par.visible != $game_switches[YSA::OVERLAY::PARALLAX_SWITCH]
  311.         @par.ox = $game_map.display_x * 32 if @par.ox != $game_map.display_x * 32
  312.         @par.oy = $game_map.display_y * 32 if @par.oy != $game_map.display_y * 32
  313.         @par.tone = $game_map.screen.tone
  314.         @par_viewport.ox = $game_map.screen.shake
  315.         @par_viewport.color = $game_map.screen.flash_color
  316.         if @current_par != $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE]
  317.           filename = YSA::OVERLAY::PARALLAX
  318.           filename += $game_map.map_id.to_s
  319.           filename += "-" + $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE].to_s
  320.           @par.bitmap = Cache.overlay(filename)
  321.           @current_par = $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE]
  322.         end
  323.       else
  324.         @par.visible = false
  325.       end
  326.     end
  327.   end
  328.  
  329. end # Spriteset_Map
  330.  
  331. #==============================================================================
  332. # ■ Scene_Map
  333. #==============================================================================
  334.  
  335. class Scene_Map < Scene_Base
  336.  
  337.   #--------------------------------------------------------------------------
  338.   # alias method: post_transfer
  339.   #--------------------------------------------------------------------------
  340.   alias overlay_post_transfer post_transfer
  341.   def post_transfer
  342.     @spriteset.dispose_overlay_map
  343.     @spriteset.create_overlay_map
  344.     @spriteset.update
  345.     overlay_post_transfer
  346.   end
  347.  
  348. end # Scene_Map
  349.  
  350. #==============================================================================
  351. #
  352. # ▼ End of File
  353. #
  354. #==============================================================================

评分

参与人数 1星屑 -10 收起 理由
熊喵酱 -10 編輯稅

查看全部评分

回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
22983
在线时间
8639 小时
注册时间
2011-12-31
帖子
3367
4
发表于 2013-11-9 19:10:38 | 只看该作者
本帖最后由 tseyik 于 2013-11-10 00:02 编辑

網上翻譯
#================================================= =============================
#¥說明
#= - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - =
#創建一個文件夾放圖形,並將它命名為Overlay。
#把所有你的圖形/覆蓋放到Overlay文件夾。
#覆蓋文件的名稱:“文件名前綴”+地圖ID+“ - ”+數字
#地圖ID是你的地圖的ID
#號是1,2,3,...使用疊加變數。

#示例:Graphics/Overlay/ground2-1.png的
#這意味著這將是地面層,圖2,變量=1

#光/陰影必須是jpg
#視差/地面必須是PNG

评分

参与人数 1星屑 +132 收起 理由
熊喵酱 + 132 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
54 小时
注册时间
2013-9-23
帖子
29
5
 楼主| 发表于 2013-11-10 21:53:39 | 只看该作者
tseyik 发表于 2013-11-9 19:10
網上翻譯
#================================================= =============================
#¥說明

谢谢~~~
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-12-5 08:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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