赞 | 1 |
VIP | 246 |
好人卡 | 87 |
积分 | 1 |
经验 | 34142 |
最后登录 | 2015-1-15 |
在线时间 | 323 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 55
- 在线时间
- 323 小时
- 注册时间
- 2010-8-21
- 帖子
- 666
|
本帖最后由 沙漠点灰 于 2012-11-10 19:13 编辑
serena718 发表于 2012-11-10 18:28
我把所用到的腳本中的某段截下來然後我在 Window_Base 中 def draw_actor_hp 的最下面新增了開啟遊戲時雖 ...
原作者的疏忽,或者lz没有复制最新的版本,代码出现bug了,修改如下:另求lz头像出处
class Bitmap def gradient_fill_rect(x, y, width, height, color1, color2,vertical = false,opacity = 255) #gradient_fill_rect(x坐标,y坐标,矩形宽,矩形高,颜色1,颜色2,横(竖)填充,不透明度) vertical == false ? step = width - x : step = height - y;color = color1;color.alpha = opacity key_re = Math.sqrt(((color2.red - color1.red)/step)**2);key_gr = Math.sqrt(((color2.green - color1.green)/step)**2);key_bl = Math.sqrt(((color2.blue - color1.blue)/step)**2) color2.red-color1.red>0 ? key_re=key_re : key_re= -key_re;color2.green-color1.green>0 ? key_gr=key_gr : key_gr= -key_gr;color2.blue-color1.blue>0 ? key_bl=key_bl : key_bl= -key_bl if vertical == true for i in y..(y+height) self.fill_rect(x, y, width, 1, color) y=y+1;color.red =color.red + key_re;color.green =color.green + key_gr;color.blue =color.blue + key_bl end else for i in x..(x+width) self.fill_rect(x, y, 1, height, color) x=x+1;color.red =color.red + key_re;color.green =color.green + key_gr;color.blue =color.blue + key_bl end end end alias :bsucat_gradient_fill_rect :gradient_fill_rect def gradient_fill_rect(x, y, width, height=false, color1 = 255, color2=nil,vertical = false,opacity = 255) if x.instance_of?(Rect) bsucat_gradient_fill_rect(x.x, x.y, x.width, x.height, y, width,height,color1) else bsucat_gradient_fill_rect(x, y, width, height, color1, color2,vertical = false,opacity = 255) end end end
class Bitmap
def gradient_fill_rect(x, y, width, height, color1, color2,vertical = false,opacity = 255)
#gradient_fill_rect(x坐标,y坐标,矩形宽,矩形高,颜色1,颜色2,横(竖)填充,不透明度)
vertical == false ? step = width - x : step = height - y;color = color1;color.alpha = opacity
key_re = Math.sqrt(((color2.red - color1.red)/step)**2);key_gr = Math.sqrt(((color2.green - color1.green)/step)**2);key_bl = Math.sqrt(((color2.blue - color1.blue)/step)**2)
color2.red-color1.red>0 ? key_re=key_re : key_re= -key_re;color2.green-color1.green>0 ? key_gr=key_gr : key_gr= -key_gr;color2.blue-color1.blue>0 ? key_bl=key_bl : key_bl= -key_bl
if vertical == true
for i in y..(y+height)
self.fill_rect(x, y, width, 1, color)
y=y+1;color.red =color.red + key_re;color.green =color.green + key_gr;color.blue =color.blue + key_bl
end
else
for i in x..(x+width)
self.fill_rect(x, y, 1, height, color)
x=x+1;color.red =color.red + key_re;color.green =color.green + key_gr;color.blue =color.blue + key_bl
end
end
end
alias :bsucat_gradient_fill_rect :gradient_fill_rect
def gradient_fill_rect(x, y, width, height=false, color1 = 255, color2=nil,vertical = false,opacity = 255)
if x.instance_of?(Rect)
bsucat_gradient_fill_rect(x.x, x.y, x.width, x.height, y, width,height,color1)
else
bsucat_gradient_fill_rect(x, y, width, height, color1, color2,vertical = false,opacity = 255)
end
end
end
|
评分
-
查看全部评分
|