以下引用塑望于2008-9-27 19:13:11的发言:
self.contents.font.color = system_color
self.contents.draw_text(x, y, 24, 24, $data_system.words.hp)
if width - 24 >= 32
hp_x = x + 32# + width - 24
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 32, 24, actor.hp.to_s, 2)
end
以下引用trentswd于2008-9-28 2:01:58的发言:
因为每个矩形只能Fill一个颜色……所以要很多rect吧……
以下引用trentswd于2008-9-28 2:45:38的发言:
OTL没注意看……看错了
是要把血条画成圆柱加的高光和阴影吧……
所以都要改= =
以下引用灯笼菜刀王于2008-9-28 2:47:56的发言:
以下引用trentswd于2008-9-28 2:45:38的发言:
OTL没注意看……看错了
是要把血条画成圆柱加的高光和阴影吧……
所以都要改= =
如果真要这样= =,工作量先不说,还很影响FPS~~ 还不如直接用图片显示血槽~~~
以下引用trentswd于2008-9-28 2:16:39的发言:
突然想起这个……
gradient_fill_rect可以直接在rect里面画渐变,本来是个RGSS2的方法,不过有高手写了xp版
http://rpg.blue/viewthread.php?tid=68399&ntime=2008%2D9%2D28+2%3A15%3A07
以下引用天圣的马甲于2008-9-29 4:59:28的发言:
你是希望做成这样的效果:
http://rpg.blue/web/htm/news140.htm
还是这样的效果?
http://rpg.blue/web/htm/news913.htm
以下引用天圣的马甲于2008-9-29 8:56:44的发言:
类似这样么?= =
复制代码
- def draw_actor_hp_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(255,0,0,200)
- endcolor = Color.new(255,255,0,200)
- w = width * actor.hp / actor.maxhp
- #黑色倒影
- 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+2, y+12, startcolor, 1, endcolor)
- draw_line(x, y+13, x+w+1, y+13, startcolor, 1, endcolor)
- draw_line(x-1, y+14, x+w, y+14, startcolor, 1, endcolor)
- draw_line(x-1, y+15, x+w, y+15, startcolor, 1, endcolor)
- draw_line(x-1, y+16, x+w, y+16, startcolor, 1, endcolor)
- draw_line(x-1, y+17, x+w, y+17, startcolor, 1, endcolor)
- draw_line(x-1, y+18, x+w, y+18, startcolor, 1, endcolor)
- draw_line(x-1, y+19, x+w, y+19, startcolor, 1, endcolor)
- draw_line(x-1, y+20, x+w, y+20, startcolor, 1, endcolor)
- draw_line(x, y+21, x+w+1, y+21, startcolor, 1, endcolor)
- draw_line(x+1, y+22, x+w+2, y+22, startcolor, 1, endcolor)
- end
- end
- 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
draw_actor_hp_meter(actor, x, y, 50)
draw_actor_sp_meter(actor, x, y + 19, 50)
以下引用天圣的马甲于2008-9-29 9:25:59的发言:
draw_actor_hp_meter(actor, x, y, 50)
draw_actor_sp_meter(actor, x, y + 19, 50)
这里在你那里有的啊0 0直接可以调用,不过把后面那个50删掉,然后在我给你的那段脚本里修改width就行了。
那段脚本插在Main前面就能调用。
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
以下引用天圣的马甲于2008-9-29 11:52:58的发言:
宽度是width = 128这句话,可以自行修改数字。
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)
#比如把这些描绘线条的语句注释掉
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |