赞 | 0 |
VIP | 0 |
好人卡 | 1 |
积分 | 0 |
经验 | 999 |
最后登录 | 2012-5-2 |
在线时间 | 328 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 49
- 在线时间
- 328 小时
- 注册时间
- 2009-10-8
- 帖子
- 168
|
- #==============================================================================
- # ■ VX图层无穷无尽
- #------------------------------------------------------------------------------
- # 原作BY:S. F. LaValle 翻译、修改BY:仲秋启明
- # 使用方法:在子地图名的最后加上“LX”(X为第几添加层)
- #==============================================================================
- class Scene_Map < Scene_Base
- alias start_2 start
- alias update_2 update
- attr_reader :map_layer_spritesets
- def start
- start_2
- setup_map_layers
- end
- def update_transfer_player
- return unless $game_player.transfer?
- fade = (Graphics.brightness > 0)
- fadeout(30) if fade
- @spriteset.dispose
- for i in 0...@map_layer_spritesets.size
- @map_layer_spritesets[i].dispose
- end
- $game_player.perform_transfer
- $game_map.autoplay
- $game_map.update
- Graphics.wait(15)
- @spriteset = Spriteset_Map.new
- setup_map_layers
- fadein(30) if fade
- Input.update
- end
- def setup_map_layers
- maps = load_data("Data/MapInfos.rvdata")
- game_map_name = maps[$game_map.map_id].name
- @map_layers = []
- @map_layer_spritesets = []
- map_names = []
- layer_map_names = []
- layer_index = []
- c = maps.keys
- d = c.max
- for i in 1..d
- unless maps[i] == nil
- a = nil
- map_names.push(maps[i].name)
- a = maps[i].name =~ /(l|L)\d+/
- layer_map_names.push(maps[i].name) if a != nil
- layer_index.push(maps.index(maps[i])) if a != nil
- end
- end
- for string in layer_map_names
- string.chop! until string == game_map_name or string == ""
- end
- if layer_map_names.include?(game_map_name)
- for i in 0...layer_map_names.size
- if layer_map_names[i] != ""
- map = Game_Map.new
- map.setup(layer_index[i])
- @map_layer_spritesets.push(Spriteset_Map_2.new(map))
- @map_layers.push(map)
- end
- end
- end
- end
- def update
- update_2
- for i in 0...@map_layer_spritesets.size
- @map_layers[i].update
- @map_layer_spritesets[i].update
- end
- end
- end
- class Spriteset_Map_2 < Spriteset_Map
- def initialize(layer)
- @layer = layer
- create_viewports
- create_tilemap
- update
- end
- def update
- update_tilemap
- update_viewports
- end
- def dispose
- @tilemap.dispose
- end
- def create_tilemap(a1 = nil, a2 = nil, a3 = nil, a4 = nil, a5 = nil, b = nil, c = nil, d = nil, e = nil)
- @tilemap = Tilemap.new(@viewport1)
- @tilemap.bitmaps[0] = (a1 == nil ? Cache.system("TileA1") : a1)
- @tilemap.bitmaps[1] = (a2 == nil ? Cache.system("TileA2") : a2)
- @tilemap.bitmaps[2] = (a3 == nil ? Cache.system("TileA3") : a3)
- @tilemap.bitmaps[3] = (a4 == nil ? Cache.system("TileA4") : a4)
- @tilemap.bitmaps[4] = (a5 == nil ? Cache.system("TileA5") : a5)
- @tilemap.bitmaps[5] = (b == nil ? Cache.system("TileB") : b)
- @tilemap.bitmaps[6] = (c == nil ? Cache.system("TileC") : c)
- @tilemap.bitmaps[7] = (d == nil ? Cache.system("TileD") : d)
- @tilemap.bitmaps[8] = (e == nil ? Cache.system("TileE") : e)
- @tilemap.map_data = @layer.data
- @tilemap.passages = @layer.passages
- end
- def update_viewports
- @viewport1.tone = @layer.screen.tone
- @viewport1.ox = @layer.screen.shake
- @viewport2.color = @layer.screen.flash_color
- @viewport3.color.set(0, 0, 0, 255 - @layer.screen.brightness)
- @viewport1.update
- @viewport2.update
- @viewport3.update
- end
- end
复制代码 把要覆盖的画在顶层的图层 |
|