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

Project1

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

[RMVA发布] 【镜子】——做一个真实的镜像效果

[复制链接]

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
10079
在线时间
5020 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

跳转到指定楼层
1
发表于 2014-9-18 12:16:59 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 VIPArcher 于 2015-10-19 23:21 编辑

在地图层下面显示行走图,模仿镜子的效果。
在恐解类的游戏中经常有镜子呢,
GIF效果图

当角色站在区域ID为脚本中的预设值时就会显示镜像。
使用起来相当麻烦,你必须PS远景层和镜子层(镜片部分半透明),分别显示在远景层和地图层。
用图块绘制的地图上对应的区域还必须留空透明
(或者你可以直接在图块上处理镜子半透明)
否则将什么都看不到(因为镜像的z值是-1,也就是在地图下方)。

其他的直接看脚本注释或者范例吧。
虽然直接用事件和固定的远景就可以做到还可以的效果。
但是,我还是推荐使用【ULDS】无限图层显示系统 Unlimited Layers Display System这个脚本来做镜子和远景。效果真的很不错
下面是范例,范例中使用了【ULDS】脚本。还有一份我做的远景和镜子的PSD。你们可以参考一下。
更新日志
脚本正文

镜像.zip

2.27 MB, 下载次数: 676

售价: 1 星屑  [记录]

范例(未更新,请复制最新脚本

点评

+ 300 精品文章  发表于 2014-9-18 21:19

评分

参与人数 4星屑 +480 收起 理由
火烧兔子 + 10 精品文章
越前リョーマ + 150 明明都发了
喵呜喵5 + 120 $VIPArcherScript = 0
taroxd + 200 笑果不错~

查看全部评分

Lv2.观梦者 (暗夜天使)

卑微的梦

梦石
0
星屑
527
在线时间
820 小时
注册时间
2013-2-23
帖子
1185

短篇九勇士组季军

2
发表于 2014-9-18 12:43:20 | 只看该作者
弓箭手快来当我的脚本师
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (版主)

…あたしは天使なんかじゃないわ

梦石
0
星屑
2208
在线时间
4033 小时
注册时间
2010-10-4
帖子
10779

开拓者贵宾

3
发表于 2014-9-18 17:31:29 | 只看该作者
本帖最后由 taroxd 于 2014-9-18 17:40 编辑

我绝对没有看到喵呜喵5

下面按照范例里的行数来吐槽:
51行,nota是啥……?别欺负我英文不好。
65行,正则表达式中的括号需要用反斜杠转义,否则表示分群。不过你为啥不用 include? 呢= =

点评

51行 手滑 65行 我也不造,喵呜在哪里?,我这就去改改。  发表于 2014-9-18 17:48
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
23063
在线时间
8647 小时
注册时间
2011-12-31
帖子
3367
4
发表于 2014-9-19 13:55:04 | 只看该作者
本帖最后由 tseyik 于 2014-9-19 13:59 编辑

Character Effects
http://galvs-scripts.com/2013/02/21/character-effects/
  1. #------------------------------------------------------------------------------#
  2. #  Galv's Character Effects
  3. #------------------------------------------------------------------------------#
  4. #  For: RPGMAKER VX ACE
  5. #  Version 2.1
  6. #------------------------------------------------------------------------------#
  7. #  2014-01-16 - Version 2.1 - Fixed double balloon/animation bug with shadows
  8. #  2013-12-07 - Version 2.0 - Added comments to more easily add event effects
  9. #                           - Fixed shadow facing bug
  10. #  2013-02-24 - Version 1.9 - added z level option for reflection and shadows
  11. #  2013-02-23 - Version 1.8 - added multiple light sources for shadows
  12. #  2013-02-22 - Version 1.7 - bug fixes
  13. #  2013-02-22 - Version 1.6 - added icon effect
  14. #  2013-02-22 - Version 1.5 - fixed mirror bug on large maps
  15. #  2013-02-22 - Version 1.4 - added effects to vehicles
  16. #  2013-02-21 - Version 1.3 - fixed jump reflection and other minor tweaks
  17. #  2013-02-21 - Version 1.2 - bug with less than 4 actors (oops)
  18. #  2013-02-21 - Version 1.1 - updated flicker effect
  19. #  2013-02-21 - Version 1.0 - release
  20. #------------------------------------------------------------------------------#
  21. #  This script was made to provide some additional effects for characters such
  22. #  as events, followers and the player on the map.
  23. #  Currently it includes:
  24. #
  25. #  Shadows
  26. #  Shadows that appear under player and events in a directions depending on
  27. #  a light source that you choose.
  28. #
  29. #  Parallax Reflect
  30. #  Reflections that appear on the parallax layer for events and actors to be
  31. #  used for things like reflections in the water or glass floor etc. To get
  32. #  effects like the demo, you need to edit the charset graphic to make the water
  33. #  partially transparent.
  34. #
  35. #  Parallax Mirrors
  36. #  Much like reflect but are instead actors and event are reflected in a mirror
  37. #  on a wall designated by a region. Both mirror and reflect effects can be
  38. #  changed so actors and events can use different charsets for their reflections
  39. #
  40. #------------------------------------------------------------------------------#
  41.   

  42. #------------------------------------------------------------------------------#
  43. #  NEW - First event command as a COMMENT
  44. #------------------------------------------------------------------------------#
  45. #  You can add a comment as the first event command on an event page to set if
  46. #  that event has an icon, shadow or reflection active. The tags to use are
  47. #  below, all must be on the same line in the comment.
  48. #
  49. # <icon:id,x,y>      # set the event to display an icon (x,y position offset)
  50. # <shadow>           # set the event to display a shadow
  51. # <reflect>          # set the event to display reflections
  52. #
  53. #------------------------------------------------------------------------------#
  54. #  EXAMPLE:
  55. # <icon:1,0,0><shadow><reflect>    # to show reflect, shadow and icon 1 on event
  56. #------------------------------------------------------------------------------#


  57. #------------------------------------------------------------------------------#
  58. #  SCRIPT CALLS:
  59. #------------------------------------------------------------------------------#
  60. #
  61. #  char_effects(x,x,x,status)
  62. #
  63. #------------------------------------------------------------------------------#
  64. #  # each effect can be true or false to enable/disable them during the game.
  65. #  # you can change multiples of effects at once, x being the effect number
  66. #  # 0 = reflect    1 = shadows    2 = mirror    3 = icons
  67. #------------------------------------------------------------------------------#
  68. #  EXAMPLES:
  69. #  char_effects(0,true)              # turn reflections on
  70. #  char_effects(0,2,true)            # turn reflections and mirror on
  71. #  char_effects(1,3,false)           # turn shadows and icons off
  72. #------------------------------------------------------------------------------#
  73. #
  74. #  reflect_sprite(actor_id,filename,pos)    # Change actor's reflect charset
  75. #
  76. #  reflect_esprite(event_id,filename,pos)   # Change event's reflect charset
  77. #
  78. #  reflect_vsprite(vehicle_id,filename,pos) # Change vehicle's reflect charset
  79. #
  80. #------------------------------------------------------------------------------#
  81. #  EXAMPLES:
  82. #  reflect_sprite(1,"Actor2",2)      # change actor 1's charset to use sprite
  83. #                                    # in position 2 of "Actor2" charset.
  84. #  reflect_esprite(3,"Actor4",5)     # event 3 will use sprite in position 5 of
  85. #                                    # "Actor4" charset.
  86. #  reflect_vsprite(1,"Vehicle",5)    # Ship will use sprite in position 5 of
  87. #                                    # "Vehicle" charset.
  88. #------------------------------------------------------------------------------#
  89.   
  90. #------------------------------------------------------------------------------#
  91. #  SCRIPT CALLS to turn effects ON or OFF for chosen EVENTS
  92. #------------------------------------------------------------------------------#
  93. #
  94. #  reflect(x,x,x,status)   # status can be true or false to turn on or off
  95. #                          # use this to specify for mirror and reflect.
  96. #  shadow(x,x,x,status)    # where x is the event ids you want to change
  97. #                          # to change all events use :all
  98. #  icon(x,x,x,icon_id)     # set which icon id to appear above character. Make
  99. #                          # it 0 for no icon.
  100. #
  101. #------------------------------------------------------------------------------#
  102. #  EXAMPLES:
  103. #  reflect(14,17,3,1,true) # Turn events 14, 17, 3 and 1 reflections ON
  104. #  shadow(1,false)         # Turn event 1 shadow OFF
  105. #  reflect(:all,true)      # Turn all event reflections ON
  106. #  icon(1,2,3,4,38)        # Events 1,2,3 and 4 will have icon 38 appear
  107. #
  108. #  NOTE: All events will default to NO shadows and NO reflections when entering
  109. #        a map. This is a design decision to try to keep lag to a minimum. You
  110. #        should use these effects sparingly and only activate them on events
  111. #        that require them.
  112. #------------------------------------------------------------------------------#
  113.   
  114. #------------------------------------------------------------------------------#
  115. #  SCRIPT CALLS to turn effects ON or OFF for ACTORS and VEHICLES
  116. #------------------------------------------------------------------------------#
  117. #
  118. #  actor_reflect(actor_id,status)  # reflections and shadows are ON by default
  119. #  actor_shadow(actor_id,status)   # for actors and vehicles. Turning them off
  120. #  actor_icon(actor_id,icon_id)    # or on will permanently change them.
  121. #
  122. #  v_reflect(x,x,x,status)    # use these v_ calls for changing vehicle effects
  123. #  v_shadow(x,x,x,status)     # on and off for vehicles.
  124. #  v_icon(x,x,x,icon_id)
  125. #
  126. #------------------------------------------------------------------------------#
  127.   
  128. #------------------------------------------------------------------------------#
  129. #  SCRIPT CALLS for shadow options
  130. #------------------------------------------------------------------------------#
  131. #
  132. #  shadow_source(x,y,id)       # set the x,y location for the light. id is the
  133. #                              # light source number you wish to change (for
  134. #                              # more than one). These are reset on map change.
  135. #  shadow_source(event_id,id)  # use an event's x,y location for the light.
  136. #                              # This will need to be in parallel process if you
  137. #                              # want it to be a moving light.
  138. #
  139. #  shadow_options(intensity,fade,flicker)    # descriptions below
  140. #
  141. #    # intensity = opacity when standing next to the light source (255 is black)
  142. #    # fade = amount shadow becomes more transparent the further away you are.
  143. #    # flicker = true or false. Shadows will flicker as if being cast by fire.
  144. #
  145. #------------------------------------------------------------------------------#
  146. #  EXAMPLE:
  147. #  shadow_options(80,10,false)    # This is the default setting.
  148. #------------------------------------------------------------------------------#
  149.   
  150. #------------------------------------------------------------------------------#
  151. #  SCRIPT CALLS for reflect options
  152. #------------------------------------------------------------------------------#
  153. #
  154. #  reflect_options(wave_pwr)
  155. #
  156. #    # wave_pwr = how strong the wave movement is. 0 is off
  157. #
  158. #------------------------------------------------------------------------------#
  159. #  EXAMPLE:
  160. #  reflect_options(1) # Turn wave power to 1
  161. #------------------------------------------------------------------------------#
  162.   
  163.   
  164. #------------------------------------------------------------------------------#
  165. #  NOTETAG for ACTORS
  166. #------------------------------------------------------------------------------#
  167. #
  168. #  <no_reflect>    # Actor will not have a reflection (for vampires of course!)
  169. #
  170. #  <reflect_sprite: FileName,pos>  # Actor will use this charset for reflections
  171. #                                  # and use the character in position 'pos'
  172. #
  173. #------------------------------------------------------------------------------#
  174. #  EXAMPLES:
  175. #  <reflect_sprite: Actor2,0>    # The first character from Actor2 charset
  176. #  <reflect_sprite: Actor3,7>    # The last character from Actor2 charset
  177. #------------------------------------------------------------------------------#
  178.   
  179.   
  180. ($imported ||= {})["Galv_Character_Effects"] = true
  181. module Galv_CEffects
  182.   
  183. #------------------------------------------------------------------------------#
  184. #  SETUP OPTIONS
  185. #------------------------------------------------------------------------------#
  186.   
  187.   MIRROR_REGION = 1     # Region ID used to determine mirror walls. Paint the
  188.                         # region on the wall you want to make reflective (and
  189.                         # then use tiles/mapping that make the parallax visible)
  190.   
  191.   ICON_OFFSET = -60     # Y offset for icons that are displayed above characters
  192.    
  193.   REFLECT_Z = -10       # Z level of reflections
  194.   SHADOW_Z = 0          # Z level of shadows
  195.   
  196. #------------------------------------------------------------------------------#
  197. #  END SETUP OPTIONS
  198. #------------------------------------------------------------------------------#
  199. end
  200.   
  201.   


  202. class Game_Map
  203.   def do_icons(refresh = true)
  204.     @events.values.each { |e|
  205.       next if !e.list
  206.       if e.list[0].code == 108 && e.list[0].parameters[0] =~ /<icon:(.*),(.*),(.*)>/
  207.         e.icon = $1.to_i
  208.         e.icon_offset = [$2.to_i,$3.to_i]
  209.       else
  210.         e.icon = 0
  211.         e.icon_offset = [0,0]
  212.       end
  213.     }
  214.     SceneManager.scene.spriteset.refresh_effects if refresh
  215.   end
  216.    
  217.    
  218.   def do_shadows(refresh = true)
  219.     @events.values.each { |e|
  220.       next if !e.list
  221.       if e.list[0].code == 108 && e.list[0].parameters[0] =~ /<shadow>/
  222.         e.shadow = true
  223.       else
  224.         e.shadow = false
  225.       end
  226.     }
  227.     SceneManager.scene.spriteset.refresh_effects if refresh
  228.   end
  229.    
  230.   def do_reflects(refresh = true)
  231.     @events.values.each { |e|
  232.       next if !e.list
  233.       if e.list[0].code == 108 && e.list[0].parameters[0] =~ /<reflect>/
  234.         e.reflect = true
  235.       else
  236.         e.reflect = false
  237.       end
  238.     }
  239.     SceneManager.scene.spriteset.refresh_effects if refresh
  240.   end
  241.    
  242.   def do_all_chareffects
  243.     do_icons(false)
  244.     do_shadows(false)
  245.     do_reflects(false)
  246.   end
  247.    
  248. end # Game_Map



  249.   
  250. class Game_Interpreter
  251.    
  252.   def remove_icon
  253.     icon(@event_id,0)
  254.   end
  255.   
  256. #-----------------------------------#
  257. #  REFLECTIONS
  258. #-----------------------------------#
  259.   
  260.   # Add/Remove Reflections from selected events
  261.   def reflect(*args,status)
  262.     char_ids = [*args]
  263.     if char_ids == [:all]
  264.       $game_map.events.values.each { |e| e.reflect = status }
  265.     else
  266.       char_ids.each {|c| $game_map.events[c].reflect = status }
  267.     end
  268.     SceneManager.scene.spriteset.refresh_effects
  269.   end
  270.    
  271.   # Change forever actor's reflect status
  272.   def actor_reflect(actor_id,status)
  273.     $game_actors[actor_id].reflect = status
  274.     $game_player.refresh
  275.   end
  276.    
  277.   # Change forever vehicle's reflect status
  278.   def v_reflect(*args,status)
  279.     char_ids = [*args]
  280.     if char_ids == [:all]
  281.       $game_map.vehicles.each { |v| v.reflect = status }
  282.     else
  283.       char_ids.each { |v| $game_map.vehicles[v].reflect = status }
  284.     end
  285.     SceneManager.scene.spriteset.refresh_effects
  286.   end
  287.   
  288.   def reflect_options(*args)
  289.     $game_map.reflect_options = [*args]
  290.     SceneManager.scene.spriteset.refresh_effects
  291.   end
  292.    
  293.   # Actor reflect sprite change
  294.   def reflect_sprite(actor_id,filename,pos)
  295.     $game_actors[actor_id].reflect_sprite = [filename,pos]
  296.     $game_player.refresh
  297.   end
  298.    
  299.   # Event reflect sprite change
  300.   def reflect_esprite(event_id,filename,pos)
  301.     $game_map.events[event_id].reflect_sprite = [filename,pos]
  302.     $game_map.events[event_id].reflect = true
  303.     SceneManager.scene.spriteset.refresh_characters
  304.   end
  305.    
  306.   # Vehicle reflect sprite change
  307.   def reflect_vsprite(v_id,filename,pos)
  308.     $game_map.vehicles[v_id].reflect_sprite = [filename,pos]
  309.     SceneManager.scene.spriteset.refresh_characters
  310.   end
  311.   
  312. #-----------------------------------#
  313. #  SHADOWS
  314. #-----------------------------------#
  315.   
  316.   # Add/Remove Shadows from selected characters
  317.   def shadow(*args,status)
  318.     char_ids = [*args]
  319.     if char_ids == [:all]
  320.       $game_map.events.values.each { |e| e.shadow = status }
  321.     else
  322.       char_ids.each {|c| $game_map.events[c].shadow = status }
  323.     end
  324.     SceneManager.scene.spriteset.refresh_effects
  325.   end
  326.    
  327.   # Change player and follower shadows
  328.   def actor_shadows(status)
  329.     $game_player.shadow = status
  330.     $game_player.followers.each { |f| f.shadow = status }
  331.     SceneManager.scene.spriteset.refresh_effects
  332.   end
  333.    
  334.   # Change vehicle's shadow status
  335.   def v_shadow(*args,status)
  336.     char_ids = [*args]
  337.     if char_ids == [:all]
  338.       $game_map.vehicles.each { |v| v.shadow = status }
  339.     else
  340.       char_ids.each { |v| $game_map.vehicles[v].shadow = status }
  341.     end
  342.     SceneManager.scene.spriteset.refresh_effects
  343.   end
  344.    
  345.   def shadow_options(*args)
  346.     $game_map.shadow_options = [*args]
  347.     SceneManager.scene.spriteset.refresh_effects
  348.   end
  349.   
  350.   def shadow_source(*args,shad_id)
  351.     shadsource = [*args]
  352.   
  353.     if shadsource.count == 1
  354.       $game_map.light_source[shad_id] = [$game_map.events[shadsource[0]].real_x,
  355.         $game_map.events[shadsource[0]].real_y]
  356.     elsif shadsource.count > 1
  357.       $game_map.light_source[shad_id] = shadsource
  358.     else
  359.       $game_map.light_source = []
  360.     end
  361.   end
  362.   
  363.   
  364. #-----------------------------------#
  365. #  ICONS
  366. #-----------------------------------#
  367.   
  368.   # Add/Remove Icons from selected events
  369.   def icon(*args,icon_id)
  370.     char_ids = [*args]
  371.     if char_ids == [:all]
  372.       $game_map.events.values.each { |e|
  373.       if e.icon <= 0
  374.         e.icon = nil
  375.       else
  376.         e.icon = icon_id
  377.       end
  378.     }
  379.     else
  380.       char_ids.each {|c| $game_map.events[c].icon = icon_id }
  381.     end
  382.     SceneManager.scene.spriteset.refresh_effects
  383.   end
  384.    
  385.   # Change forever actor's icon
  386.   def actor_icon(actor_id,icon_id)
  387.     $game_actors[actor_id].icon = icon_id
  388.     $game_player.refresh
  389.   end
  390.    
  391.   # Change forever vehicle's icon
  392.   def v_icon(*args,icon_id)
  393.     char_ids = [*args]
  394.     if char_ids == [:all]
  395.       $game_map.vehicles.each { |v| v.icon = icon_id }
  396.     else
  397.       char_ids.each { |v| $game_map.vehicles[v].icon = icon_id }
  398.     end
  399.     SceneManager.scene.spriteset.refresh_effects
  400.   end
  401.   
  402. #-----------------------------------#
  403. #  GENERAL
  404. #-----------------------------------#
  405.   
  406.   # Turn on/off effects
  407.     # 0 = reflect
  408.     # 1 = shadow
  409.     # 2 = mirror
  410.     # 3 = icon
  411.       
  412.   def char_effects(*args,status)
  413.     [*args].each { |e| $game_map.char_effects[e] = status }
  414.     SceneManager.scene.spriteset.refresh_effects
  415.   end
  416.   
  417.    
  418. end # Game_Interpreter
  419.   
  420.   
  421. #-------------------------------------------------------------------------------
  422. #  Spriteset_Map
  423. #-------------------------------------------------------------------------------
  424.   
  425. class Spriteset_Map
  426.   alias galv_reflect_sm_initialize initialize
  427.   def initialize
  428.     create_effects
  429.     galv_reflect_sm_initialize
  430.     refresh_characters
  431.   end
  432.    
  433.   alias galv_reflect_sm_refresh_characters refresh_characters
  434.   def refresh_characters
  435.     galv_reflect_sm_refresh_characters
  436.     create_effects
  437.   end
  438.    
  439.   def refresh_effects
  440.     dispose_effects
  441.     create_effects
  442.   end
  443.    
  444.   def create_effects
  445.     @shadow_sprites = []
  446.     @reflect_sprites = []
  447.     @mirror_sprites = []
  448.     @icon_sprites = []
  449.       
  450.     # Do reflections
  451.     if $game_map.char_effects[0]
  452.       $game_map.events.values.each { |e|
  453.         @reflect_sprites.push(Sprite_Reflect.new(@viewport1, e)) if e.reflect
  454.       }
  455.       $game_player.followers.each { |f|
  456.         @reflect_sprites.push(Sprite_Reflect.new(@viewport1, f)) if f.reflect
  457.       }
  458.       if $game_player.reflect
  459.         @reflect_sprites.push(Sprite_Reflect.new(@viewport1, $game_player))
  460.       end
  461.       $game_map.vehicles.each { |v|
  462.         @reflect_sprites.push(Sprite_Reflect.new(@viewport1, v)) if v.reflect
  463.       }
  464.     end
  465.       
  466.     # Do mirrors
  467.     if $game_map.char_effects[2]
  468.       $game_map.events.values.each { |e|
  469.         @mirror_sprites.push(Sprite_Mirror.new(@viewport1, e)) if e.reflect
  470.       }
  471.       $game_player.followers.each { |f|
  472.         @mirror_sprites.push(Sprite_Mirror.new(@viewport1, f)) if f.reflect
  473.       }
  474.       if $game_player.reflect
  475.         @mirror_sprites.push(Sprite_Mirror.new(@viewport1, $game_player))
  476.       end
  477.       $game_map.vehicles.each { |v|
  478.         @mirror_sprites.push(Sprite_Mirror.new(@viewport1, v)) if v.reflect
  479.       }
  480.     end
  481.       
  482.     # Do Shadows
  483.     if $game_map.char_effects[1]
  484.       return if $game_map.light_source.empty?
  485.       $game_map.light_source.count.times { |s|
  486.         $game_map.events.values.each { |e|
  487.           @shadow_sprites.push(Sprite_Shadow.new(@viewport1, e, s)) if e.shadow
  488.         }
  489.         $game_player.followers.each { |f|
  490.           @shadow_sprites.push(Sprite_Shadow.new(@viewport1, f, s)) if f.shadow
  491.         }
  492.         if $game_player.shadow
  493.           @shadow_sprites.push(Sprite_Shadow.new(@viewport1, $game_player, s))
  494.         end
  495.         $game_map.vehicles.each { |v|
  496.           @shadow_sprites.push(Sprite_Shadow.new(@viewport1, v, s)) if v.shadow
  497.         }
  498.       }
  499.     end
  500.       
  501.     # Do icons
  502.     if $game_map.char_effects[3]
  503.       $game_map.events.values.each { |e|
  504.         @icon_sprites.push(Sprite_Icon.new(@viewport1, e)) if e.icon
  505.       }
  506.       $game_player.followers.each { |f|
  507.         @icon_sprites.push(Sprite_Icon.new(@viewport1, f)) if f.icon
  508.       }
  509.       if $game_player.icon
  510.         @icon_sprites.push(Sprite_Icon.new(@viewport1, $game_player))
  511.       end
  512.       $game_map.vehicles.each { |v|
  513.         @icon_sprites.push(Sprite_Icon.new(@viewport1, v)) if v.icon
  514.       }
  515.     end
  516.   end
  517.    
  518.   alias galv_reflect_sm_update update
  519.   def update
  520.     galv_reflect_sm_update
  521.     @reflect_sprites.each {|s| s.update} if $game_map.char_effects[0]
  522.     @mirror_sprites.each {|s| s.update} if $game_map.char_effects[2]
  523.     @shadow_sprites.each {|s| s.update} if $game_map.char_effects[1]
  524.     @icon_sprites.each {|s| s.update} if $game_map.char_effects[3]
  525.   end
  526.   
  527.   alias galv_reflect_sm_dispose_characters dispose_characters
  528.   def dispose_characters
  529.     galv_reflect_sm_dispose_characters
  530.     dispose_effects
  531.   end
  532.    
  533.   def dispose_effects
  534.     @reflect_sprites.each {|s| s.dispose}
  535.     @shadow_sprites.each {|s| s.dispose}
  536.     @mirror_sprites.each {|s| s.dispose}
  537.     @icon_sprites.each {|s| s.dispose}
  538.   end
  539. end # Spriteset_Map
  540.   
  541.   
  542. #-------------------------------------------------------------------------------
  543. #  Sprite_Reflect
  544. #-------------------------------------------------------------------------------
  545.   
  546. class Sprite_Reflect < Sprite_Character
  547.   def initialize(viewport, character = nil)
  548.     super(viewport, character)
  549.   end
  550.   
  551.   def update
  552.     super
  553.   end
  554.    
  555.   def update_balloon; end
  556.   def setup_new_effect; end
  557.    
  558.   def set_character_bitmap
  559.     if @character.reflect_sprite
  560.       self.bitmap = Cache.character(@character.reflect_sprite[0])
  561.     else
  562.       self.bitmap = Cache.character(@character_name)
  563.     end
  564.     self.mirror = true
  565.     self.angle = 180
  566.     self.opacity = 220
  567.     self.z = Galv_CEffects::REFLECT_Z
  568.     self.wave_amp = $game_map.reflect_options[0]
  569.       
  570.     sign = @character_name[/^[\!\$]./]
  571.     if sign && sign.include?(')
  572.       @cw = bitmap.width / 3
  573.       @ch = bitmap.height / 4
  574.     else
  575.       @cw = bitmap.width / 12
  576.       @ch = bitmap.height / 8
  577.     end
  578.     self.ox = @cw / 2
  579.     self.oy = @ch
  580.   end
  581.   
  582.   def update_position
  583.     self.x = @character.screen_x
  584.     jump = @character.jumping? ? @character.jump_height * 2 : 0
  585.     alt = @character.altitude ? @character.altitude * 2 : 0
  586.     self.y = @character.screen_y - 3 + jump + alt
  587.   end
  588.   
  589.   def update_other
  590.     self.blend_type = @character.blend_type
  591.     self.visible = [email protected]
  592.   end
  593.    
  594.   def update_src_rect
  595.     if @character.reflect_sprite
  596.       index = @character.reflect_sprite[1]
  597.     else
  598.       index = @character.character_index
  599.     end
  600.     pattern = @character.pattern < 3 ? @character.pattern : 1
  601.     sx = (index % 4 * 3 + pattern) * @cw
  602.     sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
  603.     self.src_rect.set(sx, sy, @cw, @ch)
  604.   end
  605. end # Sprite_Reflect < Sprite_Character
  606.   
  607.   
  608. #-------------------------------------------------------------------------------
  609. #  Sprite_Mirror
  610. #-------------------------------------------------------------------------------
  611.   
  612. class Sprite_Mirror < Sprite_Character
  613.   def initialize(viewport, character = nil)
  614.     @distance = 0
  615.     super(viewport, character)
  616.   end
  617.   
  618.   def update
  619.     super
  620.   end
  621.    
  622.   def update_balloon; end
  623.   def setup_new_effect; end
  624.    
  625.   def set_character_bitmap
  626.     if @character.reflect_sprite
  627.       self.bitmap = Cache.character(@character.reflect_sprite[0])
  628.     else
  629.       self.bitmap = Cache.character(@character_name)
  630.     end
  631.     self.mirror = true
  632.     self.opacity = 255
  633.     self.z = Galv_CEffects::REFLECT_Z
  634.       
  635.     sign = @character_name[/^[\!\$]./]
  636.     if sign && sign.include?(')
  637.       @cw = bitmap.width / 3
  638.       @ch = bitmap.height / 4
  639.     else
  640.       @cw = bitmap.width / 12
  641.       @ch = bitmap.height / 8
  642.     end
  643.     self.ox = @cw / 2
  644.     self.oy = @ch
  645.   end
  646.   
  647.   def update_src_rect
  648.     if @character.reflect_sprite
  649.       index = @character.reflect_sprite[1]
  650.     else
  651.       index = @character.character_index
  652.     end
  653.     pattern = @character.pattern < 3 ? @character.pattern : 1
  654.     sx = (index % 4 * 3 + pattern) * @cw
  655.     sy = (index / 4 * 4 + (10 - @character.direction - 2) / 2) * @ch
  656.     self.src_rect.set(sx, sy, @cw, @ch)
  657.   end
  658.    
  659.   def get_mirror_y
  660.     20.times {|i|
  661.       if $game_map.region_id(@character.x, @character.y - i) == Galv_CEffects::MIRROR_REGION
  662.         @distance = (i - 1) * 0.05
  663.         [url=home.php?mod=space&uid=502659]@DISPLAY[/url] = @character.y - i - $game_map.display_y + $game_map.height
  664.         self.opacity = 255
  665.         return (@character.y - i + 1 - $game_map.display_y) * 32 - i * 4
  666.       end
  667.     }
  668.     self.opacity = 0
  669.     return @ch
  670.   end
  671.    
  672.   def update_position
  673.     self.x = @character.screen_x
  674.     self.y = get_mirror_y - 6
  675.     self.zoom_x = 1 - @distance
  676.     self.zoom_y = 1 - @distance
  677.   end
  678.   
  679.   def update_other
  680.     self.blend_type = @character.blend_type
  681.     self.visible = [email protected]
  682.   end
  683. end # Sprite_Mirror < Sprite_Character
  684.   
  685.   
  686. #-------------------------------------------------------------------------------
  687. #  Sprite_Shadow
  688. #-------------------------------------------------------------------------------
  689.   
  690. class Sprite_Shadow < Sprite_Character
  691.   def initialize(viewport, character = nil, source)
  692.     [url=home.php?mod=space&uid=14094]@flicker[/url] = 0
  693.     @famount = 0
  694.     @aamount = 0
  695.     [url=home.php?mod=space&uid=171370]@source[/url] = source
  696.     super(viewport, character)
  697.   end
  698.    
  699.   def update_balloon; end
  700.   def setup_new_effect; end
  701.   
  702.   def update
  703.     super
  704.     update_bitmap
  705.     update_src_rect
  706.     update_position
  707.     update_other
  708.     update_facing
  709.   end
  710.    
  711.   def set_character_bitmap
  712.     self.bitmap = Cache.character(@character_name)
  713.      
  714.     self.color = Color.new(0, 0, 0, 255)
  715.     self.z = Galv_CEffects::SHADOW_Z
  716.     self.wave_amp = 1 if $game_map.shadow_options[2]
  717.     self.wave_speed = 1000
  718.       
  719.     sign = @character_name[/^[\!\$]./]
  720.     if sign && sign.include?(')
  721.       @cw = bitmap.width / 3
  722.       @ch = bitmap.height / 4
  723.     else
  724.       @cw = bitmap.width / 12
  725.       @ch = bitmap.height / 8
  726.     end
  727.     self.ox = @cw / 2
  728.     self.oy = @ch
  729.   end
  730.   
  731.   def update_position
  732.     self.x = @character.screen_x
  733.     self.y = @character.screen_y - 10
  734.     get_angle
  735.   end
  736.    
  737.   def get_angle
  738.     x = $game_map.light_source[@source][0] - @character.real_x
  739.     y = $game_map.light_source[@source][1] - @character.real_y
  740.     self.opacity = $game_map.shadow_options[0] -
  741.       Math::sqrt(x * x + y * y) * $game_map.shadow_options[1]
  742.       
  743.     if x == 0 && y == 0 || self.opacity <= 0
  744.       self.opacity = 0
  745.     else
  746.       self.angle = Math::atan2(x, y) * 180 / Math::PI + @aamount
  747.     end
  748.   end
  749.    
  750.   def update_facing
  751.     if @character.y < $game_map.light_source[@source][1]
  752.       self.mirror = false
  753.     else
  754.       self.mirror = true
  755.     end
  756.   end
  757.    
  758.   def update_other
  759.     self.blend_type = @character.blend_type
  760.     self.visible = [email protected]
  761.   end
  762. end # Sprite_Shadow < Sprite_Character
  763.   
  764.   
  765. #-------------------------------------------------------------------------------
  766. #  Sprite_Icon
  767. #-------------------------------------------------------------------------------
  768.   
  769. class Sprite_Icon < Sprite_Character
  770.   def initialize(viewport, character = nil)
  771.     @icon_sprite ||= Sprite.new
  772.     @icon_sprite.bitmap ||= Cache.system("Iconset")
  773.     @icon = nil
  774.     super(viewport, character)
  775.   end
  776.   
  777.   def dispose
  778.     super
  779.     if @icon_sprite
  780.       @icon_sprite.dispose
  781.       @icon_sprite = nil
  782.     end
  783.   end
  784.    
  785.   def update
  786.     super
  787.     update_icon
  788.   end
  789.    
  790.   def update_icon
  791.     return if [email protected]
  792.     draw_icon(@character.icon)
  793.   end
  794.    
  795.   def draw_icon(icon_index)
  796.     return if [email protected]?
  797.     rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  798.     @icon_sprite.src_rect  = rect
  799.     @icon = icon_index
  800.   end
  801.    
  802.   def update_position
  803.     @icon_sprite.x = @character.screen_x - 12
  804.     @icon_sprite.y = @character.screen_y + Galv_CEffects::ICON_OFFSET
  805.   end
  806.   
  807.   def update_other
  808.     self.blend_type = @character.blend_type
  809.     @icon_sprite.visible = [email protected]
  810.   end
  811. end # Sprite_Icon < Sprite_Character
  812.   
  813.   
  814. #-------------------------------------------------------------------------------
  815. #  Other Stuff
  816. #-------------------------------------------------------------------------------
  817.   
  818.   
  819. class Game_Character < Game_CharacterBase
  820.   attr_reader    :altitude
  821.   attr_accessor  :reflect
  822.   attr_accessor  :reflect_sprite
  823.   attr_accessor  :shadow
  824.   attr_accessor  :icon
  825.   attr_accessor  :icon_offset
  826. end
  827.   
  828.   
  829. class Game_Event < Game_Character
  830.   alias galv_reflect_ge_initialize initialize
  831.   def initialize(map_id, event)
  832.     @reflect = false
  833.     [url=home.php?mod=space&uid=31758]@Shadow[/url] = false
  834.     @icon_offset = [0,0]
  835.     galv_reflect_ge_initialize(map_id, event)
  836.   end
  837. end # Game_Event < Game_Character
  838.   
  839.   
  840. class Game_Vehicle < Game_Character
  841.   attr_reader :map_id
  842.    
  843.   alias galv_reflect_gv_initialize initialize
  844.   def initialize(type)
  845.     @reflect = true
  846.     [url=home.php?mod=space&uid=31758]@Shadow[/url] = true
  847.     @icon_offset = [0,0]
  848.     galv_reflect_gv_initialize(type)
  849.   end
  850. end # Game_Vehicle < Game_Character
  851.   
  852.   
  853. class Game_Follower < Game_Character
  854.   alias galv_reflect_gf_initialize initialize
  855.   def initialize(member_index, preceding_character)
  856.     galv_reflect_gf_initialize(member_index, preceding_character)
  857.     @reflect = true
  858.     [url=home.php?mod=space&uid=31758]@Shadow[/url] = true
  859.   end
  860.    
  861.   alias galv_reflect_gf_refresh refresh
  862.   def refresh
  863.     galv_reflect_gf_refresh
  864.     return if actor.nil?
  865.     @reflect = actor.reflect
  866.     @reflect_sprite = actor.reflect_sprite
  867.     @icon = actor.icon
  868.     if SceneManager.scene_is?(Scene_Map)
  869.       SceneManager.scene.spriteset.refresh_effects
  870.     end
  871.   end
  872. end # Game_Follower < Game_Character
  873.   
  874.   
  875. class Game_Player < Game_Character
  876.   alias galv_reflect_gp_initialize initialize
  877.   def initialize
  878.     galv_reflect_gp_initialize
  879.     @reflect = true
  880.     [url=home.php?mod=space&uid=31758]@Shadow[/url] = true
  881.   end
  882.    
  883.   alias galv_reflect_gp_refresh refresh
  884.   def refresh
  885.     galv_reflect_gp_refresh
  886.     @reflect = actor.reflect
  887.     @reflect_sprite = actor.reflect_sprite
  888.     @icon = actor.icon
  889.     if SceneManager.scene_is?(Scene_Map)
  890.       SceneManager.scene.spriteset.refresh_effects
  891.     end
  892.   end
  893. end # Game_Player < Game_Character
  894.   
  895.   
  896. class Scene_Map < Scene_Base
  897.   attr_accessor :spriteset
  898. end # Scene_Map
  899.   
  900.   
  901. class Game_Map
  902.   attr_accessor :char_effects
  903.   attr_accessor :light_source
  904.   attr_accessor :shadow_options
  905.   attr_accessor :reflect_options
  906.    
  907.   alias galv_reflect_game_map_initialize initialize
  908.   def initialize
  909.     @light_source = []
  910.     @shadow_options = [80,10,false]
  911.     @reflect_options = [0]
  912.     @char_effects = [false,false,false,false]
  913.     #[reflect,shadow,mirror,icon]
  914.     galv_reflect_game_map_initialize
  915.   end
  916.    
  917.    
  918.   alias galv_reflect_game_map_setup setup
  919.   def setup(map_id)
  920.     galv_reflect_game_map_setup(map_id)
  921.     reset_char_effects
  922.     do_all_chareffects
  923.     if SceneManager.scene_is?(Scene_Map)
  924.       SceneManager.scene.spriteset.refresh_effects
  925.     end
  926.   end
  927.    
  928.   def reset_char_effects
  929.     @light_source = []
  930.     @events.values.each { |e|
  931.       e.reflect = false
  932.       e.icon = nil }
  933.   end
  934. end # Game_Map
  935.   
  936.   
  937. class Game_Actor < Game_Battler
  938.   attr_accessor :reflect
  939.   attr_accessor :reflect_sprite
  940.   attr_accessor :icon
  941.    
  942.   alias galv_reflect_game_actor_initialize initialize
  943.   def initialize(actor_id)
  944.     galv_reflect_game_actor_initialize(actor_id)
  945.     @reflect = $data_actors[actor_id].reflect
  946.     @reflect_sprite = $data_actors[actor_id].reflect_sprite
  947.     @icon_offset = [0,0]
  948.   end
  949. end # Game_Actor < Game_Battler
  950.   
  951.   
  952. class RPG::Actor
  953.   def reflect_sprite
  954.     if @reflect_sprite.nil?
  955.       if @note =~ /<reflect_sprite:[ ](.*),(.*)>/i
  956.         @reflect_sprite = [$1.to_s,$2.to_i]
  957.       else
  958.         @reflect_sprite = nil
  959.       end
  960.     end
  961.     @reflect_sprite
  962.   end
  963.   def reflect
  964.     if @reflect.nil?
  965.       if @note =~ /<no_reflect>/i
  966.         @reflect = false
  967.       else
  968.         @reflect = true
  969.       end
  970.     end
  971.     @reflect
  972.   end
  973. end # RPG::Actor
复制代码
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

名侦探小柯

梦石
0
星屑
3299
在线时间
3619 小时
注册时间
2006-9-6
帖子
37400

开拓者贵宾第3届短篇游戏大赛主流游戏组亚军第5届短篇游戏比赛亚军

5
发表于 2014-9-19 17:38:50 | 只看该作者
麻烦但是效果不错啊

点评

想骗个糖,结果泥萌都不发。嗯,做解谜游戏的话这个应该效果很好。麻烦也只是在PS上。说起来和无限图层一样都是需要PS功底的。  发表于 2014-9-19 17:55
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

6
发表于 2014-9-19 23:29:23 | 只看该作者
调整下坐标就是水面倒影了0.0

点评

这个脚本让我想到黄鸡还是谁发的那个XP的脚本···但是有BUG,插了那个不能按F12,否则弹错···  发表于 2014-9-20 09:24
倒影你妹啊,倒影的话还得来个上下翻转,你造吗?不过如果要改的话倒是很简单。  发表于 2014-9-19 23:50
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
10079
在线时间
5020 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

7
 楼主| 发表于 2015-1-21 18:30:23 | 只看该作者
本帖最后由 VIPArcher 于 2015-1-21 18:31 编辑

更新自顶(范例未更新,脚本请自行复制
1.2修正内容:
1.以前没想过不对称的行走图的情况,现在是完全翻转的镜像了
2.可以指定镜像的行走图文件名。使用方法写在开头的注释了。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
163 小时
注册时间
2015-11-12
帖子
43
8
发表于 2016-6-9 11:01:50 | 只看该作者
请问一下,看了你放在文件夹里的说明,好像可以更改角色在镜子里的行走图。
但是渣渣表示不懂。
求大大举个例子!

点评

用事件脚本 看脚本注释。移动指令里填脚本也可以。范例的话,你看那个范例工程里左上角的那几个角色的事件  发表于 2016-6-9 20:21
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
163 小时
注册时间
2015-11-12
帖子
43
9
发表于 2016-6-9 22:09:31 | 只看该作者
好的,我自己去看下范例了,谢谢。
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
483
在线时间
94 小时
注册时间
2019-6-10
帖子
34
10
发表于 2020-3-29 01:16:41 | 只看该作者
本帖最后由 蔡铭衍 于 2020-3-29 01:22 编辑

@VIPArcher

???
区域ID搞了,图层也搞了
\{\{\{\{就是显示不出来啊————QAQ
<font color=&quot;RoyalBlue&quot;>furry<font color=&quot;Black&quot;>画师一个
WWW
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-12-21 23:45

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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