本帖最后由 VIPArcher 于 2015-5-22 12:14 编辑
你需要一个Bitmap#save_png才能使用这个脚本。
Bitmap#save_png脚本在这里的范例里可以找到https://rpg.blue/thread-377103-1-1.html
把要转化为VA用的行走图全部放在Graphics/XP_Characters文件夹里,
然后运行转化行走图的工程。就会自动批量转化为VA用的行走图并在文件名前面加上"$"保存在Graphics/Characters文件夹下。Dir["Graphics/XP_Characters/*.png"].each do |path| filename = File.basename(path, ".png") next if FileTest.directory?(filename) bitmap = Bitmap.new(path) width, height = bitmap.width / 4 * 3, bitmap.height src_rect = Rect.new(bitmap.width / 4, 0, width, height) new_bitmap = Bitmap.new(width, height) new_bitmap.blt(0, 0, bitmap, src_rect) new_bitmap.save_png("Graphics/Characters/$#{filename}.png") p '=*' * 30 p "行走图:#{path}" p '已转为VX/VA的行走图并输出到' p "Graphics/Characters/$#{filename}.png" end msgbox '素材转化结束' exit
Dir["Graphics/XP_Characters/*.png"].each do |path|
filename = File.basename(path, ".png")
next if FileTest.directory?(filename)
bitmap = Bitmap.new(path)
width, height = bitmap.width / 4 * 3, bitmap.height
src_rect = Rect.new(bitmap.width / 4, 0, width, height)
new_bitmap = Bitmap.new(width, height)
new_bitmap.blt(0, 0, bitmap, src_rect)
new_bitmap.save_png("Graphics/Characters/$#{filename}.png")
p '=*' * 30
p "行走图:#{path}"
p '已转为VX/VA的行走图并输出到'
p "Graphics/Characters/$#{filename}.png"
end
msgbox '素材转化结束'
exit
做了个范例,你可以直接用 |