赞 | 1 |
VIP | 22 |
好人卡 | 4 |
积分 | 1 |
经验 | 14594 |
最后登录 | 2015-10-25 |
在线时间 | 796 小时 |
Lv1.梦旅人 綾川司の姫様<
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 796 小时
- 注册时间
- 2007-12-20
- 帖子
- 4520
|
给你的脚本里这一部分是SP相关,可以自行修改的- -
def draw_actor_sp_meter(actor,x,y)
width = 128
white = Color.new(255,255,255,200)
black = Color.new(0,0,0,200)
black2 = Color.new(0,0,0,100)
startcolor = Color.new(0,0,255,200)
endcolor = Color.new(0,255,255,200)
w = width * actor.sp / actor.maxsp
#黑色倒影
self.contents.fill_rect(x+5, y+15, width-2, 1, black2)
self.contents.fill_rect(x+4, y+16, width, 1, black2)
self.contents.fill_rect(x+3, y+17, width+2, 9, black2)
self.contents.fill_rect(x+4, y+26, width, 1, black2)
self.contents.fill_rect(x+5, y+27, width-2, 1, black2)
#白色边框
self.contents.fill_rect(x+1, y+11, width-2, 1, white)
self.contents.fill_rect(x, y+12, width, 1, white)
self.contents.fill_rect(x-1, y+13, width+2, 9, white)
self.contents.fill_rect(x, y+22, width, 1, white)
self.contents.fill_rect(x+1, y+23, width-2, 1, white)
#黑色背景
self.contents.fill_rect(x+2, y+12, width-4, 1, black)
self.contents.fill_rect(x+1, y+13, width-2, 1, black)
self.contents.fill_rect(x, y+14, width, 7, black)
self.contents.fill_rect(x+1, y+21, width-2, 1, black)
self.contents.fill_rect(x+2, y+22, width-4, 1, black)
if w > width/2
draw_line(x+1, y+12, x+w-3, y+12, startcolor, 1, endcolor)
draw_line(x, y+13, x+w-2, y+13, startcolor, 1, endcolor)
draw_line(x-1, y+14, x+w-1, y+14, startcolor, 1, endcolor)
draw_line(x-1, y+15, x+w-1, y+15, startcolor, 1, endcolor)
draw_line(x-1, y+16, x+w-1, y+16, startcolor, 1, endcolor)
draw_line(x-1, y+17, x+w-1, y+17, startcolor, 1, endcolor)
draw_line(x-1, y+18, x+w-1, y+18, startcolor, 1, endcolor)
draw_line(x-1, y+19, x+w-1, y+19, startcolor, 1, endcolor)
draw_line(x-1, y+20, x+w-1, y+20, startcolor, 1, endcolor)
draw_line(x, y+21, x+w-2, y+21, startcolor, 1, endcolor)
draw_line(x+1, y+22, x+w-3, y+22, startcolor, 1, endcolor)
else
draw_line(x+1, y+12, x+w+1, y+12, startcolor, 1, endcolor)
draw_line(x, y+13, x+w, y+13, startcolor, 1, endcolor)
draw_line(x-1, y+14, x+w-1, y+14, startcolor, 1, endcolor)
draw_line(x-1, y+15, x+w-1, y+15, startcolor, 1, endcolor)
draw_line(x-1, y+16, x+w-1, y+16, startcolor, 1, endcolor)
draw_line(x-1, y+17, x+w-1, y+17, startcolor, 1, endcolor)
draw_line(x-1, y+18, x+w-1, y+18, startcolor, 1, endcolor)
draw_line(x-1, y+19, x+w-1, y+19, startcolor, 1, endcolor)
draw_line(x-1, y+20, x+w-1, y+20, startcolor, 1, endcolor)
draw_line(x, y+21, x+w, y+21, startcolor, 1, endcolor)
draw_line(x+1, y+22, x+w+1, y+22, startcolor, 1, endcolor)
end
end
#--------------------------------------------------------------------------
# ● ライン描画 by 桜雅 在土
#--------------------------------------------------------------------------
def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
# 描写距離の計算。大きめに直角時の長さ。
distance = (start_x - end_x).abs + (start_y - end_y).abs
# 描写開始
if end_color == start_color
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
if width == 1
self.contents.set_pixel(x, y, start_color)
else
self.contents.fill_rect(x, y, width, width, start_color)
end
end
else
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
r = start_color.red * (distance-i)/distance + end_color.red * i/distance
g = start_color.green * (distance-i)/distance + end_color.green * i/distance
b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
if width == 1
self.contents.set_pixel(x, y, Color.new(r, g, b, a))
else
self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
end
end
end
end |
|