紫英晓狼1130 发表于 2013-8-18 20:41
这是主站上的脚本,原帖地址:http://www.66rpg.com/articles/4545
非常感谢
但是用这个脚本显示小数点的话会变成0,这个应该怎么改?
我的数字图片里有"."这个字符,写了if判断还是不行啊……(我肯定有哪里写错了……)
class Bitmap def draw_number(x, y, nu,pict = RPG::Cache.picture("bonus")) w=pict.width / 12 h=pict.height ce = Rect.new(0,0,w,h) nu=nu.to_s ar = nu.split(//) for i in 0...ar.size ar[i] = ar[i].to_i end for sz in ar if sz == "." ce.x = 11 * w else ce.x = sz * w end self.blt(x,y,pict,ce) x+=w end end end
class Bitmap
def draw_number(x, y, nu,pict = RPG::Cache.picture("bonus"))
w=pict.width / 12
h=pict.height
ce = Rect.new(0,0,w,h)
nu=nu.to_s
ar = nu.split(//)
for i in 0...ar.size
ar[i] = ar[i].to_i
end
for sz in ar
if sz == "."
ce.x = 11 * w
else
ce.x = sz * w
end
self.blt(x,y,pict,ce)
x+=w
end
end
end
|