Project1
标题:
【翻译】改变行走图色调
[打印本页]
作者:
仲秋启明
时间:
2010-12-5 13:47
标题:
【翻译】改变行走图色调
不多说了,上图
2010-12-05_134444.png
(4.51 KB, 下载次数: 13)
下载附件
保存到相册
2010-12-5 13:47 上传
BUG:每次修改完后一定要改回来否则会一直这样
#========================================
# 改变行走图色调
# 原作BY: Nechigawara Sanzenin
# 提供BY:企鹅达达
# 翻译BY:仲秋启明
#========================================
#使用方法:
#事件注释中输入:[rX][gX][bX][alX][hueX]
#[rX] 红 ( -255 to 255 )
#[gX] 绿 ( -255 to 255 )
#[bX] 蓝 ( -255 to 255 )
#[alX] Alpha通道 ( 0 to 255 )
#[hueX] 色调 ( 0 to 360 )
#配合RGB颜色设置
#BUG:每次修改完后一定要改回来否则会一直这样
#========================================
module Cache
def self.character(filename , hue=0)
load_bitmap("Graphics/Characters/", filename , hue)
end
end
class Game_Character
attr_accessor :tone
attr_accessor :hue
#--------------------------------------------------------------------------
# - 读取
#--------------------------------------------------------------------------
alias inc_initialize initialize
def initialize
inc_initialize
@tone = [0,0,0,0]
@hue = 0
end
end
class Game_Event < Game_Character
alias inc_update update
def update
for i in
[email protected]
next if @list[i].code != 108
# 红
if @list[i].parameters[0].include?("[r")
text = @list[i].parameters[0].scan(/\[r([-,0-9]+)\]/)
red = $1.to_i
if red > 255
red = 255
elsif red < -255
red = -255
end
@tone[0] = red
end
# 绿
if @list[i].parameters[0].include?("[g")
text = @list[i].parameters[0].scan(/\[g([-,0-9]+)\]/)
green = $1.to_i
if green > 255
green = 255
elsif green < -255
green = -255
end
@tone[1] = green
end
# 蓝
if @list[i].parameters[0].include?("[b")
text = @list[i].parameters[0].scan(/\[b([-,0-9]+)\]/)
blue = $1.to_i
if blue > 255
blue = 255
elsif blue < -255
blue = -255
end
@tone[2] = blue
end
# Alpha
if @list[i].parameters[0].include?("[al")
text = @list[i].parameters[0].scan(/\[al([0-9]+)\]/)
alpha = $1.to_i
if alpha > 255
alpha = 255
elsif alpha < 0
alpha = 0
end
@tone[3] = alpha
end
# 色调
if @list[i].parameters[0].include?("[hue")
text = @list[i].parameters[0].scan(/\[hue([0-9]+)\]/)
hue = $1.to_i
if hue > 360
hue = 360
elsif hue < 0
hue = 0
end
@hue = hue
end
end
inc_update
end
end
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# - 刷新
#--------------------------------------------------------------------------
def update_bitmap
@character.update
self.tone.set(@character.tone[0],@character.tone[1],@character.tone[2],@character.tone[3])
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_index != @character.character_index or
@hue != @character.hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_index = @character.character_index
@hue = @character.hue
if @tile_id > 0
sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
sy = @tile_id % 256 / 8 % 16 * 32;
self.bitmap = tileset_bitmap(@tile_id)
self.src_rect.set(sx, sy, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = Cache.character(@character_name,@character.hue)
sign = @character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
@cw = bitmap.width / 3
@ch = bitmap.height / 4
else
@cw = bitmap.width / 12
@ch = bitmap.height / 8
end
self.ox = @cw / 2
self.oy = @ch
end
end
end
end
复制代码
作者:
★PIG★
时间:
2010-12-5 14:00
额,做中毒效果么
作者:
冰舞蝶恋
时间:
2010-12-5 14:09
应该不是吧,大概是自由运用的= =
中毒不会自动改变色调。。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1