赞 | 12 |
VIP | 107 |
好人卡 | 6 |
积分 | 4 |
经验 | 31122 |
最后登录 | 2024-6-29 |
在线时间 | 1606 小时 |
Lv2.观梦者 傻♂逼
- 梦石
- 0
- 星屑
- 374
- 在线时间
- 1606 小时
- 注册时间
- 2007-3-13
- 帖子
- 6562
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
重要更新:
--------------
再次修正严重bug
修正一个非常严重的bug
更新远景遮挡,全傻瓜式导出
更新四方位支持 2008年8月26日-
--------------
补丁:
添加到main以前
内容-针对上一个更新包兼容问题- #==============================================================================
- # ** Game_Map
- #==============================================================================
- class Game_Map
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :map
- attr_accessor :tilemap_tone
- attr_accessor :tilemap_plane
- attr_accessor :tilemap_zoom_x
- attr_accessor :tilemap_zoom_y
- attr_accessor :tilemap_tile_width
- attr_accessor :tilemap_tile_height
- #--------------------------------------------------------------------------
- # * Alias Listings
- #--------------------------------------------------------------------------
- alias seph_tilemap_gmap_init initialize
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- # Original Initialization
- seph_tilemap_gmap_init
- # Sets Special Tilemap Properties
- @tilemap_tone = nil
- @tilemap_plane = false
- @tilemap_zoom_x = 1.0
- @tilemap_zoom_y = 1.0
- @tilemap_tile_width = 32
- @tilemap_tile_height = 32
- end
- end
- #==============================================================================
- # Super Tilemap
- # 作者:釣到一隻猴子@_@ ( AAM@_@ )
- # 版本:Ver.1.0
- # 本資訊不得刪除
- #==============================================================================
- #==============================================================================
- # ■ Tilemap
- #------------------------------------------------------------------------------
- # 顯示地圖的核心。
- #==============================================================================
- class Tilemap
- #--------------------------------------------------------------------------
- # ● 定量
- #--------------------------------------------------------------------------
- Animated_Autotiles_Frames = 15
- Scroll_Times = 4
- Autotiles = [
- [ [27, 28, 33, 34], [ 5, 28, 33, 34], [27, 6, 33, 34], [ 5, 6, 33, 34],
- [27, 28, 33, 12], [ 5, 28, 33, 12], [27, 6, 33, 12], [ 5, 6, 33, 12] ],
- [ [27, 28, 11, 34], [ 5, 28, 11, 34], [27, 6, 11, 34], [ 5, 6, 11, 34],
- [27, 28, 11, 12], [ 5, 28, 11, 12], [27, 6, 11, 12], [ 5, 6, 11, 12] ],
- [ [25, 26, 31, 32], [25, 6, 31, 32], [25, 26, 31, 12], [25, 6, 31, 12],
- [15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ],
- [ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36],
- [39, 40, 45, 46], [ 5, 40, 45, 46], [39, 6, 45, 46], [ 5, 6, 45, 46] ],
- [ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12],
- [17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ],
- [ [37, 38, 43, 44], [37, 6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44],
- [37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1, 2, 7, 8] ]
- ]
- #--------------------------------------------------------------------------
- # ● 定義外部變數
- #--------------------------------------------------------------------------
- attr_reader :layers
- attr_accessor :tileset
- attr_accessor :autotiles
- attr_accessor :map_data
- attr_accessor :flash_data
- attr_accessor :priorities
- attr_accessor :visible
- attr_accessor :ox
- attr_accessor :oy
- attr_accessor :tone
- attr_accessor :zoom_x
- attr_accessor :zoom_y
- #--------------------------------------------------------------------------
- # ● 初始化
- #--------------------------------------------------------------------------
- def initialize(viewport,map_data=$game_map.map)
- # 生成圖層
- @layers = []
- for l in 0..5
- layer = Sprite.new(viewport)
- layer.bitmap = Bitmap.new(map_data.data.xsize*32, map_data.data.ysize*32)
- layer.z = (l == 0 ? 0 : (64 + 32 * (l - 1)))
- @layers << layer
- end
- @map_data = map_data.data
- # 定義變數
- @tileset = nil
- @autotiles = []
- @map_data = nil
- @flash_data = nil
- @priorities = nil
- @visible = true
- @ox = @o_ox = 0
- @oy = @o_oy = 0
- @tone = nil
- @zoom_x = 1.0
- @zoom_y = 1.0
- end
- #--------------------------------------------------------------------------
- # ● 釋放
- #--------------------------------------------------------------------------
- def dispose
- # 釋放圖層
- for layer in @layers
- layer.dispose
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def update
- # 地圖資訊更換
- if @o_map_data != @map_data
- @o_map_data = @map_data
- refresh
- end
- # 偏移座標更換
- if @o_ox != @ox or @o_oy != @oy
- sx = @ox - @o_ox
- sy = @oy - @o_oy
- @o_ox = @ox
- @o_oy = @oy
- refresh#_map(sx, sy)
- end
- # 色調更換
- if @o_tone != @tone
- @o_tone = @tone
- @tone = Tone.new(0, 0, 0, 0) if @tone.nil?
- for layer in @layers
- layer.tone = @tone
- end
- end
- # 比例更換
- if @o_zoom_x != @zoom_x
- @o_zoom_x = @zoom_x
- for layer in @layers
- layer.zoom_x = @zoom_x
- end
- end
- if @o_zoom_y != @zoom_y
- @o_zoom_y = @zoom_y
- for layer in @layers
- layer.zoom_y = @zoom_y
- end
- end
- # 自動元件動畫
- if Graphics.frame_count % Animated_Autotiles_Frames == 0
- # 更新自動元件
- refresh_autotiles
- end
- get_bitmap.save2png("VX/Graphics/Parallaxes/" + $iiii.to_s + ".png") if $start_out
- end
- #--------------------------------------------------------------------------
- # ● 更新元件
- #--------------------------------------------------------------------------
- def refresh_map(sx, sy)
- # 圖層捲動
- move(0, sx)
- move(0, sy)
- # 循環所有優先級
- for p in 0..5
- # 循環所有圖層
- for z in 0...@map_data.zsize
- # 循環所有X座標
- for x in 0...@map_data.xsize
- # 循環所有Y座標
- for y in 0...@map_data.ysize
- # 當偏移座標不正常時略過
- next if @ox < 0
- next if @oy < 0
- # 取得元件ID
- mx = @ox / 32
- my = @oy / 32
- id = @map_data[x + mx, y + my, z]
- # 當元件ID不正常時略過
- next if id == 0
- # 當圖層不符時略過
- next unless p == @priorities[id]
- # 描繪元件(自動元件)
- id < 384 ? draw_autotile(x, y, p, id) : draw_tile(x, y, p, id)
- end
- end
- end
- end
- # 循環所有優先級
- for p in 0..5
- # 循環所有圖層
- for z in 0...@map_data.zsize
- # 循環所有X座標
- for x in 0...@map_data.xsize
- # 循環所有Y座標
- for y in 0...@map_data.ysize
- # 當偏移座標不正常時略過
- next if @ox < 0
- next if @oy < 0
- # 取得元件ID
- mx = @ox / 32
- my = @oy / 32
- id = @map_data[x + mx, y + my, z]
- # 當元件ID不正常時略過
- next if id == 0
- # 當圖層不符時略過
- next unless p == @priorities[id]
- # 描繪元件(自動元件)
- id < 384 ? draw_autotile(x, y, p, id) : draw_tile(x, y, p, id)
- end
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 圖層捲動
- #--------------------------------------------------------------------------
- def move(d, v)
- # 設定單次移動距離
- #v /= Scroll_Times
- # 循環次數
- #for i in 0...Scroll_Times
- # # 判斷方向
- # case d
- # when 0
- # # 移動圖層
- # for layer in @layers
- # bitmap = layer.bitmap
- # layer.bitmap.blt(v, 0, bitmap, Rect.new(0, 0, 640, 480))
- # end
- # when 1
- # # 移動圖層
- # for layer in @layers
- # bitmap = layer.bitmap
- # layer.bitmap.blt(0, v, bitmap, Rect.new(0, 0, 640, 480))
- # end
- # end
- #end
- end
- #--------------------------------------------------------------------------
- # ● 初次描繪地圖
- #--------------------------------------------------------------------------
- def refresh
- # 循環所有優先級
- for p in 0..5
- # 循環所有圖層
- for z in 0...@map_data.zsize
- # 循環所有X座標
- for x in 0...@map_data.xsize
- # 循環所有Y座標
- for y in 0...@map_data.ysize
- # 當偏移座標不正常時略過
- next if @ox < 0
- next if @oy < 0
- # 取得元件ID
- mx = @ox / 32
- my = @oy / 32
- id = @map_data[x + mx, y + my, z]
- # 當元件ID不正常時略過
- next if id == 0
- # 當圖層不符時略過
- next unless p == @priorities[id]
- # 描繪元件(自動元件)
- id < 384 ? draw_autotile(x, y, p, id) : draw_tile(x, y, p, id)
- end
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新自動元件
- #--------------------------------------------------------------------------
- def refresh_autotiles
- # 循環所有優先級
- for p in 0..5
- # 循環所有圖層
- for z in 0...@map_data.zsize
- # 循環所有X座標
- for x in 0...@map_data.xsize
- # 循環所有Y座標
- for y in 0...@map_data.ysize
- # 當偏移座標不正常時略過
- next if @ox < 0
- next if @oy < 0
- # 取得元件ID
- mx = @ox / 32
- my = @oy / 32
- id = @map_data[x + mx, y + my, z]
- # 當元件ID不正常時略過
- next if id == 0
- # 當圖層不符時略過
- next unless p == @priorities[id]
- # 描繪元件(自動元件)
- draw_autotile(x, y, p, id) if id < 384
- end
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 描繪元件
- #--------------------------------------------------------------------------
- def draw_tile(x, y, z, id)
- # 設定元件矩形座標範圍
- rect = Rect.new((id - 384) % 8 * 32, (id - 384) / 8 * 32, 32, 32)
- # 假想座標轉為實際座標
- x *= 32
- y *= 32
- # 描繪圖形
- @layers[z].bitmap.blt(x, y, @tileset, rect)
- end
- #--------------------------------------------------------------------------
- # ● 描繪自動元件
- #--------------------------------------------------------------------------
- def draw_autotile(x, y, z, tile_id)
- # 取得自動元件
- autotile = @autotiles[tile_id / 48 - 1]
- # 取得自動元件ID
- tile_id %= 48
- # 生成暫時圖形區塊
- bitmap = Bitmap.new(32, 32)
- # 取得自動元件編號
- tiles = Autotiles[tile_id / 8][tile_id % 8]
- # 自動元件動畫
- frames = autotile.width / 96
- # 設定動畫偏移座標
- anim = (Graphics.frame_count / Animated_Autotiles_Frames) % frames * 96
- # 生成自動元件圖塊
- for i in 0...4
- tile_position = tiles[i] - 1
- src_rect = Rect.new(tile_position % 6 * 16 + anim,
- tile_position / 6 * 16, 16, 16)
- bitmap.blt(i % 2 * 16, i / 2 * 16, autotile, src_rect)
- end
- # 假想座標轉為實際座標
- x *= 32
- y *= 32
- # 描繪圖形
- @layers[z].bitmap.blt(x, y, bitmap, Rect.new(0, 0, 32, 32))
- end
- #--------------------------------------------------------------------------
- # * Collect Bitmap
- #--------------------------------------------------------------------------
- def get_bitmap
- # Creates New Blank Bitmap
- bitmap = Bitmap.new(@layers[0].bitmap.width, @layers[0].bitmap.height)
- # Passes Through All Layers
- for layer in @layers
- bitmap.blt(0, 0, layer.bitmap,
- Rect.new(0, 0, bitmap.width, bitmap.height))
- end
- # Return Bitmap
- return bitmap
- end
- end
复制代码 现在连遮挡图一起生成咯~~
使用方法很傻瓜
http://rpg.blue/upload_program/files/范例工程_100285530.rar
下载这个工程,一个脚本是ForVX的,一个是ForXP的。
然后运行XP工程,按照范例里的使用方法执行脚本:make_map2png
程序会创建VX目录,拷贝VX目录下的所有文件到VX工程的根目录,粘贴。运行VX看看吧。
注意:使用完后务必删除XP工程里的VX目录下的所有文件。以方便下一次使用。。。
----------------------------------------------------------------------------
如果还不会就看范例咯。。。
有两个名字叫...的脚本一定要拷贝哦~~如果你觉得远景遮挡图的z太大,直接修改
#--------------------------------------------------------------------------
# ● 生成远景
#--------------------------------------------------------------------------
def create_parallax
@parallax = Plane.new(@viewport1)
@parallax.z = 1
@parallax1 = Plane.new(@viewport3)
@parallax1.z = 99999
end
这里的@parallax1.z = 99999为理想值即可。。。
[td][/td]
梦想世界——点击进入 |
|