Project1
标题:
cp描绘出错
[打印本页]
作者:
魏玉龙
时间:
2010-11-11 23:08
标题:
cp描绘出错
本帖最后由 fux2 于 2010-11-12 07:05 编辑
#--------------------------------------------------------------------------
# ● CPメーター の描画
#--------------------------------------------------------------------------
def draw_actor_cp(actor,x,y,width)
color_b = Color.new(255,255,255,255)
if actor.cp == actor.maxcp
r = 128
g = 0
b = 255
o = 255
else
if actor.cp < actor.maxcp/2
if actor.cp < actor.maxcp/4
r = 255
g = 128
b = 64
o = 255
else
r = 255
g = 0
b = 64
o = 255
end
else
if actor.cp < actor.maxcp*3/4
r = 255
g = 0
b = 128
o = 255
else
r = 255
g = 0
b = 255
o = 255
end
end
end
w = width * (actor.cp.to_f / actor.maxcp.to_f)
#边框
self.contents.fill_rect(x-1, y-1, width+2, 1, color_b)
self.contents.fill_rect(x-1, y+10, width+2, 1, color_b)
self.contents.fill_rect(x-1, y, 1, 10, color_b)
self.contents.fill_rect(x+width, y, 1, 10, color_b)
#背景
self.contents.fill_rect(x, y, width, 10, Color.new(0,0,0,200))
#描绘
self.contents.fill_rect(x, y, w, 1,Color.new(r+46,g+79,b+12,o))
self.contents.fill_rect(x, y+1, w, 1,Color.new(r+44,g+77,b+10,o))
self.contents.fill_rect(x, y+2, w, 1,Color.new(r+41,g+73,b+7,o))
self.contents.fill_rect(x, y+3, w, 1,Color.new(r+38,g+69,b+3,o))
self.contents.fill_rect(x, y+4, w, 1,Color.new(r+34,g+65,b-1,o))
self.contents.fill_rect(x, y+5, w, 1,Color.new(r+30,g+60,b-6,o))
self.contents.fill_rect(x, y+6, w, 1,Color.new(r+10,g+40,b-32,o))
self.contents.fill_rect(x, y+7, w, 1,Color.new(r+10,g+46,b-37,o))
self.contents.fill_rect(x, y+8, w, 1,Color.new(r+13,g+59,b-41,o))
self.contents.fill_rect(x, y+9, w, 1,Color.new(r+18,g+73,b-43,o))
end
复制代码
这句报错:self.contents.fill_rect(x, y, w, 1,Color.new(r+46,g+79,b+12,o))
float -1.#IND out of range of integer
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1