用法: 复制脚本后, 塞到 main 前, 之后去PS里给行走图底下增加一行像素(栗: 原本默认行走图高度是px192 增为193)
然后在这行里点上需要锁定的颜色即可, 不加则按默认色相处理
多一行也不会影响原本的行走图效果, 放心加
冲突: 几乎没有吧
#-----------------------------------------------------------------------# ● 锁色相 by 灯笼菜刀王 2022.12.9## 用途: 为行走图更改色相时,锁定特定颜色不改## 用法: 给行走图底下增加一行像素(栗: 原本默认行走图高度是px192 增为193)# 然后在这行里点上需要锁定的颜色即可#-----------------------------------------------------------------------module RPG module Cache def self.load_bitmap2(folder_name,filename,hue = 0) path = folder_name + filename if not @cache.include?(path) or @cache[path].disposed? if filename != "" @cache[path] = Bitmap.new(path) else @cache[path] = Bitmap.new(32,32) end end if hue == 0 return @cache[path] else cf = [] if (h=@cache[path].height) % 4 == 1 (w = @cache[path].width).times do |i| #获取锁定颜色 c = @cache[path].get_pixel(i,h - 1) next if c.alpha < 1 cf.push([c.red,c.green,c.blue]) end end key = [path, hue] if [email protected]?(key) or @cache[key].disposed? @cache[key] = @cache[path].clone @cache[key].hue_change(hue) return @cache[key] if cf.empty? w.times do |i| h.times do |j| c = @cache[path].get_pixel(i,j) next if !cf.include?([c.red,c.green,c.blue]) @cache[key].set_pixel(i,j,c) end end end return @cache[key] end end def self.character(filename,hue=0) self.load_bitmap2("Graphics/Characters/",filename,hue) end endend复制代码