设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
楼主: 忻緣
打印 上一主题 下一主题

血條顏色改成橫向漸變式。。

 关闭 [复制链接]

Lv5.捕梦者

梦石
0
星屑
39163
在线时间
5737 小时
注册时间
2006-11-10
帖子
6638
11
发表于 2008-9-28 10:35:02 | 只看该作者
以下引用trentswd于2008-9-28 2:01:58的发言:

因为每个矩形只能Fill一个颜色……所以要很多rect吧……

但是以写的方式来看,不像是用来重复描绘颜色的~  看Y的写法....难道它是要纵向叠颜色= =?

天圣小姐给的方法就是我说的方法~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
70
在线时间
386 小时
注册时间
2007-7-27
帖子
4106

开拓者

12
发表于 2008-9-28 10:45:38 | 只看该作者
OTL没注意看……看错了

是要把血条画成圆柱加的高光和阴影吧……

所以都要改= =
吸吸
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
39163
在线时间
5737 小时
注册时间
2006-11-10
帖子
6638
13
发表于 2008-9-28 10:47:56 | 只看该作者
以下引用trentswd于2008-9-28 2:45:38的发言:

OTL没注意看……看错了

是要把血条画成圆柱加的高光和阴影吧……

所以都要改= =

如果真要这样= =,工作量先不说,还很影响FPS~~  还不如直接用图片显示血槽~~~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
70
在线时间
386 小时
注册时间
2007-7-27
帖子
4106

开拓者

14
发表于 2008-9-28 10:52:22 | 只看该作者
以下引用灯笼菜刀王于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


至于fps,只要尽量减少刷新就行=。=比如不变化不刷新,比如不用contents.clear,用上面那个脚本新增的方法clear_rect清楚小范围

图片血槽直接rect的话,到了血很少的时候就没有渐变了=。=
吸吸
回复 支持 反对

使用道具 举报

Lv1.梦旅人

空靈

梦石
0
星屑
50
在线时间
11 小时
注册时间
2006-7-27
帖子
521
15
 楼主| 发表于 2008-9-29 06:56:12 | 只看该作者
#--------------------------------------------------------------------------
# ● HP描画
#--------------------------------------------------------------------------
def draw_actor_hp_meter(actor, x, y, width = 150, type = 0)
   if type == 1 and actor.hp == 0
     return
   end
   self.contents.font.color = system_color
#  self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 25))   
  self.contents.fill_rect(x-2, y+16, width+4,8, Color.new(255,255,255,255))
  self.contents.fill_rect(x-1, y+17, width+2,6, Color.new(0,0,0,255))   
#上面這幾個是描繪底的。。下面才是描繪血值的。。
   w = width * actor.hp / actor.maxhp
  self.contents.fill_rect(x, y+18, w,1, Color.new(200,10,18,255))
  self.contents.fill_rect(x, y+19, w,1, Color.new(255,50,50,255))
  self.contents.fill_rect(x, y+20, w,1, Color.new(180,0,0,255))
  end

#--------------------------------------------------------------------------
# ● SP描画
#--------------------------------------------------------------------------
def draw_actor_sp_meter(actor, x, y, width = 150, type = 0)
   if type == 1 and actor.hp == 0
     return
   end
   self.contents.font.color = system_color
#   self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
   self.contents.fill_rect(x-2, y+16, width+4,8, Color.new(255,255,255,255))
   self.contents.fill_rect(x-1, y+17, width+2,6, Color.new(0,0,0,255))
   w = width * actor.sp / actor.maxsp
   #self.contents.fill_rect(x, y+28, w,1, Color.new(128, 255, 255, 255))
   #self.contents.fill_rect(x, y+29, w,1, Color.new(0, 255, 255, 255))
   #self.contents.fill_rect(x, y+30, w,1, Color.new(0, 192, 192, 255))
   #self.contents.fill_rect(x, y+31, w,1, Color.new(0, 128, 128, 255))
   self.contents.fill_rect(x, y+18, w,1, Color.new(0,100,255,255))
   self.contents.fill_rect(x, y+19, w,1, Color.new(0,150,255,255))
   self.contents.fill_rect(x, y+20, w,1, Color.new(0,100,255,255))
end
end

。。呃。。不知那個用圖片顯示的效果如何。。

星星在哪里都是很亮的,就看你有沒有抬頭去看他們                       --------華麗麗的百變暖暖窩
本人之作《夙誓》龜速進行中。。= =!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

綾川司の姫様<

梦石
0
星屑
50
在线时间
796 小时
注册时间
2007-12-20
帖子
4520

贵宾第3届短篇游戏大赛R剧及RMTV组亚军

16
发表于 2008-9-29 12:59:28 | 只看该作者
你是希望做成这样的效果:
http://rpg.blue/web/htm/news140.htm
还是这样的效果?
http://rpg.blue/web/htm/news913.htm

生命即是责任。自己即是世界。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

空靈

梦石
0
星屑
50
在线时间
11 小时
注册时间
2006-7-27
帖子
521
17
 楼主| 发表于 2008-9-29 16:42:41 | 只看该作者
以下引用天圣的马甲于2008-9-29 4:59:28的发言:

你是希望做成这样的效果:
http://rpg.blue/web/htm/news140.htm
还是这样的效果?
http://rpg.blue/web/htm/news913.htm

不是差不多麼。。-V-。。喜歡下面的漸變。。-V-。。但是。。只要漸變就好。。

星星在哪里都是很亮的,就看你有沒有抬頭去看他們                       --------華麗麗的百變暖暖窩
本人之作《夙誓》龜速進行中。。= =!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

綾川司の姫様<

梦石
0
星屑
50
在线时间
796 小时
注册时间
2007-12-20
帖子
4520

贵宾第3届短篇游戏大赛R剧及RMTV组亚军

18
发表于 2008-9-29 16:56:44 | 只看该作者
类似这样么?= =
  1.   def draw_actor_hp_meter(actor,x,y)
  2.     width = 128
  3.     white = Color.new(255,255,255,200)
  4.     black = Color.new(0,0,0,200)
  5.     black2 = Color.new(0,0,0,100)
  6.     startcolor = Color.new(255,0,0,200)
  7.     endcolor = Color.new(255,255,0,200)
  8.     w = width * actor.hp / actor.maxhp
  9.     #黑色倒影
  10.     self.contents.fill_rect(x+5, y+15, width-2, 1, black2)
  11.     self.contents.fill_rect(x+4, y+16, width, 1, black2)
  12.     self.contents.fill_rect(x+3, y+17, width+2, 9, black2)
  13.     self.contents.fill_rect(x+4, y+26, width, 1, black2)
  14.     self.contents.fill_rect(x+5, y+27, width-2, 1, black2)
  15.     #白色边框
  16.     self.contents.fill_rect(x+1, y+11, width-2, 1, white)
  17.     self.contents.fill_rect(x, y+12, width, 1, white)
  18.     self.contents.fill_rect(x-1, y+13, width+2, 9, white)
  19.     self.contents.fill_rect(x, y+22, width, 1, white)
  20.     self.contents.fill_rect(x+1, y+23, width-2, 1, white)
  21.     #黑色背景
  22.     self.contents.fill_rect(x+2, y+12, width-4, 1, black)
  23.     self.contents.fill_rect(x+1, y+13, width-2, 1, black)
  24.     self.contents.fill_rect(x, y+14, width, 7, black)
  25.     self.contents.fill_rect(x+1, y+21, width-2, 1, black)
  26.     self.contents.fill_rect(x+2, y+22, width-4, 1, black)
  27.   if w > width/2
  28.     draw_line(x+1, y+12, x+w-3, y+12, startcolor, 1, endcolor)
  29.     draw_line(x, y+13, x+w-2, y+13, startcolor, 1, endcolor)
  30.     draw_line(x-1, y+14, x+w-1, y+14, startcolor, 1, endcolor)
  31.     draw_line(x-1, y+15, x+w-1, y+15, startcolor, 1, endcolor)
  32.     draw_line(x-1, y+16, x+w-1, y+16, startcolor, 1, endcolor)
  33.     draw_line(x-1, y+17, x+w-1, y+17, startcolor, 1, endcolor)
  34.     draw_line(x-1, y+18, x+w-1, y+18, startcolor, 1, endcolor)
  35.     draw_line(x-1, y+19, x+w-1, y+19, startcolor, 1, endcolor)
  36.     draw_line(x-1, y+20, x+w-1, y+20, startcolor, 1, endcolor)
  37.     draw_line(x, y+21, x+w-2, y+21, startcolor, 1, endcolor)
  38.     draw_line(x+1, y+22, x+w-3, y+22, startcolor, 1, endcolor)
  39.   else
  40.     draw_line(x+1, y+12, x+w+2, y+12, startcolor, 1, endcolor)
  41.     draw_line(x, y+13, x+w+1, y+13, startcolor, 1, endcolor)
  42.     draw_line(x-1, y+14, x+w, y+14, startcolor, 1, endcolor)
  43.     draw_line(x-1, y+15, x+w, y+15, startcolor, 1, endcolor)
  44.     draw_line(x-1, y+16, x+w, y+16, startcolor, 1, endcolor)
  45.     draw_line(x-1, y+17, x+w, y+17, startcolor, 1, endcolor)
  46.     draw_line(x-1, y+18, x+w, y+18, startcolor, 1, endcolor)
  47.     draw_line(x-1, y+19, x+w, y+19, startcolor, 1, endcolor)
  48.     draw_line(x-1, y+20, x+w, y+20, startcolor, 1, endcolor)
  49.     draw_line(x, y+21, x+w+1, y+21, startcolor, 1, endcolor)
  50.     draw_line(x+1, y+22, x+w+2, y+22, startcolor, 1, endcolor)
  51.   end
  52.   end
  53.   def draw_actor_sp_meter(actor,x,y)
  54.     width = 128
  55.     white = Color.new(255,255,255,200)
  56.     black = Color.new(0,0,0,200)
  57.     black2 = Color.new(0,0,0,100)
  58.     startcolor = Color.new(0,0,255,200)
  59.     endcolor = Color.new(0,255,255,200)
  60.     w = width * actor.sp / actor.maxsp
  61.     #黑色倒影
  62.     self.contents.fill_rect(x+5, y+15, width-2, 1, black2)
  63.     self.contents.fill_rect(x+4, y+16, width, 1, black2)
  64.     self.contents.fill_rect(x+3, y+17, width+2, 9, black2)
  65.     self.contents.fill_rect(x+4, y+26, width, 1, black2)
  66.     self.contents.fill_rect(x+5, y+27, width-2, 1, black2)
  67.     #白色边框
  68.     self.contents.fill_rect(x+1, y+11, width-2, 1, white)
  69.     self.contents.fill_rect(x, y+12, width, 1, white)
  70.     self.contents.fill_rect(x-1, y+13, width+2, 9, white)
  71.     self.contents.fill_rect(x, y+22, width, 1, white)
  72.     self.contents.fill_rect(x+1, y+23, width-2, 1, white)
  73.     #黑色背景
  74.     self.contents.fill_rect(x+2, y+12, width-4, 1, black)
  75.     self.contents.fill_rect(x+1, y+13, width-2, 1, black)
  76.     self.contents.fill_rect(x, y+14, width, 7, black)
  77.     self.contents.fill_rect(x+1, y+21, width-2, 1, black)
  78.     self.contents.fill_rect(x+2, y+22, width-4, 1, black)
  79.   if w > width/2
  80.     draw_line(x+1, y+12, x+w-3, y+12, startcolor, 1, endcolor)
  81.     draw_line(x, y+13, x+w-2, y+13, startcolor, 1, endcolor)
  82.     draw_line(x-1, y+14, x+w-1, y+14, startcolor, 1, endcolor)
  83.     draw_line(x-1, y+15, x+w-1, y+15, startcolor, 1, endcolor)
  84.     draw_line(x-1, y+16, x+w-1, y+16, startcolor, 1, endcolor)
  85.     draw_line(x-1, y+17, x+w-1, y+17, startcolor, 1, endcolor)
  86.     draw_line(x-1, y+18, x+w-1, y+18, startcolor, 1, endcolor)
  87.     draw_line(x-1, y+19, x+w-1, y+19, startcolor, 1, endcolor)
  88.     draw_line(x-1, y+20, x+w-1, y+20, startcolor, 1, endcolor)
  89.     draw_line(x, y+21, x+w-2, y+21, startcolor, 1, endcolor)
  90.     draw_line(x+1, y+22, x+w-3, y+22, startcolor, 1, endcolor)
  91.   else
  92.     draw_line(x+1, y+12, x+w+1, y+12, startcolor, 1, endcolor)
  93.     draw_line(x, y+13, x+w, y+13, startcolor, 1, endcolor)
  94.     draw_line(x-1, y+14, x+w-1, y+14, startcolor, 1, endcolor)
  95.     draw_line(x-1, y+15, x+w-1, y+15, startcolor, 1, endcolor)
  96.     draw_line(x-1, y+16, x+w-1, y+16, startcolor, 1, endcolor)
  97.     draw_line(x-1, y+17, x+w-1, y+17, startcolor, 1, endcolor)
  98.     draw_line(x-1, y+18, x+w-1, y+18, startcolor, 1, endcolor)
  99.     draw_line(x-1, y+19, x+w-1, y+19, startcolor, 1, endcolor)
  100.     draw_line(x-1, y+20, x+w-1, y+20, startcolor, 1, endcolor)
  101.     draw_line(x, y+21, x+w, y+21, startcolor, 1, endcolor)
  102.     draw_line(x+1, y+22, x+w+1, y+22, startcolor, 1, endcolor)
  103.   end
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # ● ライン描画 by 桜雅 在土
  107.   #--------------------------------------------------------------------------
  108.   def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  109.     # 描写距離の計算。大きめに直角時の長さ。
  110.     distance = (start_x - end_x).abs + (start_y - end_y).abs
  111.     # 描写開始
  112.     if end_color == start_color
  113.       for i in 1..distance
  114.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  115.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  116.         if width == 1
  117.           self.contents.set_pixel(x, y, start_color)
  118.         else
  119.           self.contents.fill_rect(x, y, width, width, start_color)
  120.         end
  121.       end
  122.     else
  123.       for i in 1..distance
  124.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  125.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  126.         r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  127.         g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  128.         b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  129.         a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  130.         if width == 1
  131.           self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  132.         else
  133.           self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  134.         end
  135.       end
  136.     end
  137.     end
复制代码


生命即是责任。自己即是世界。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

空靈

梦石
0
星屑
50
在线时间
11 小时
注册时间
2006-7-27
帖子
521
19
 楼主| 发表于 2008-9-29 17:16:05 | 只看该作者
以下引用天圣的马甲于2008-9-29 8:56:44的发言:

类似这样么?= =
  1.   def draw_actor_hp_meter(actor,x,y)
  2.     width = 128
  3.     white = Color.new(255,255,255,200)
  4.     black = Color.new(0,0,0,200)
  5.     black2 = Color.new(0,0,0,100)
  6.     startcolor = Color.new(255,0,0,200)
  7.     endcolor = Color.new(255,255,0,200)
  8.     w = width * actor.hp / actor.maxhp
  9.     #黑色倒影
  10.     self.contents.fill_rect(x+5, y+15, width-2, 1, black2)
  11.     self.contents.fill_rect(x+4, y+16, width, 1, black2)
  12.     self.contents.fill_rect(x+3, y+17, width+2, 9, black2)
  13.     self.contents.fill_rect(x+4, y+26, width, 1, black2)
  14.     self.contents.fill_rect(x+5, y+27, width-2, 1, black2)
  15.     #白色边框
  16.     self.contents.fill_rect(x+1, y+11, width-2, 1, white)
  17.     self.contents.fill_rect(x, y+12, width, 1, white)
  18.     self.contents.fill_rect(x-1, y+13, width+2, 9, white)
  19.     self.contents.fill_rect(x, y+22, width, 1, white)
  20.     self.contents.fill_rect(x+1, y+23, width-2, 1, white)
  21.     #黑色背景
  22.     self.contents.fill_rect(x+2, y+12, width-4, 1, black)
  23.     self.contents.fill_rect(x+1, y+13, width-2, 1, black)
  24.     self.contents.fill_rect(x, y+14, width, 7, black)
  25.     self.contents.fill_rect(x+1, y+21, width-2, 1, black)
  26.     self.contents.fill_rect(x+2, y+22, width-4, 1, black)
  27.   if w > width/2
  28.     draw_line(x+1, y+12, x+w-3, y+12, startcolor, 1, endcolor)
  29.     draw_line(x, y+13, x+w-2, y+13, startcolor, 1, endcolor)
  30.     draw_line(x-1, y+14, x+w-1, y+14, startcolor, 1, endcolor)
  31.     draw_line(x-1, y+15, x+w-1, y+15, startcolor, 1, endcolor)
  32.     draw_line(x-1, y+16, x+w-1, y+16, startcolor, 1, endcolor)
  33.     draw_line(x-1, y+17, x+w-1, y+17, startcolor, 1, endcolor)
  34.     draw_line(x-1, y+18, x+w-1, y+18, startcolor, 1, endcolor)
  35.     draw_line(x-1, y+19, x+w-1, y+19, startcolor, 1, endcolor)
  36.     draw_line(x-1, y+20, x+w-1, y+20, startcolor, 1, endcolor)
  37.     draw_line(x, y+21, x+w-2, y+21, startcolor, 1, endcolor)
  38.     draw_line(x+1, y+22, x+w-3, y+22, startcolor, 1, endcolor)
  39.   else
  40.     draw_line(x+1, y+12, x+w+2, y+12, startcolor, 1, endcolor)
  41.     draw_line(x, y+13, x+w+1, y+13, startcolor, 1, endcolor)
  42.     draw_line(x-1, y+14, x+w, y+14, startcolor, 1, endcolor)
  43.     draw_line(x-1, y+15, x+w, y+15, startcolor, 1, endcolor)
  44.     draw_line(x-1, y+16, x+w, y+16, startcolor, 1, endcolor)
  45.     draw_line(x-1, y+17, x+w, y+17, startcolor, 1, endcolor)
  46.     draw_line(x-1, y+18, x+w, y+18, startcolor, 1, endcolor)
  47.     draw_line(x-1, y+19, x+w, y+19, startcolor, 1, endcolor)
  48.     draw_line(x-1, y+20, x+w, y+20, startcolor, 1, endcolor)
  49.     draw_line(x, y+21, x+w+1, y+21, startcolor, 1, endcolor)
  50.     draw_line(x+1, y+22, x+w+2, y+22, startcolor, 1, endcolor)
  51.   end
  52.   end
  53.   def draw_actor_sp_meter(actor,x,y)
  54.     width = 128
  55.     white = Color.new(255,255,255,200)
  56.     black = Color.new(0,0,0,200)
  57.     black2 = Color.new(0,0,0,100)
  58.     startcolor = Color.new(0,0,255,200)
  59.     endcolor = Color.new(0,255,255,200)
  60.     w = width * actor.sp / actor.maxsp
  61.     #黑色倒影
  62.     self.contents.fill_rect(x+5, y+15, width-2, 1, black2)
  63.     self.contents.fill_rect(x+4, y+16, width, 1, black2)
  64.     self.contents.fill_rect(x+3, y+17, width+2, 9, black2)
  65.     self.contents.fill_rect(x+4, y+26, width, 1, black2)
  66.     self.contents.fill_rect(x+5, y+27, width-2, 1, black2)
  67.     #白色边框
  68.     self.contents.fill_rect(x+1, y+11, width-2, 1, white)
  69.     self.contents.fill_rect(x, y+12, width, 1, white)
  70.     self.contents.fill_rect(x-1, y+13, width+2, 9, white)
  71.     self.contents.fill_rect(x, y+22, width, 1, white)
  72.     self.contents.fill_rect(x+1, y+23, width-2, 1, white)
  73.     #黑色背景
  74.     self.contents.fill_rect(x+2, y+12, width-4, 1, black)
  75.     self.contents.fill_rect(x+1, y+13, width-2, 1, black)
  76.     self.contents.fill_rect(x, y+14, width, 7, black)
  77.     self.contents.fill_rect(x+1, y+21, width-2, 1, black)
  78.     self.contents.fill_rect(x+2, y+22, width-4, 1, black)
  79.   if w > width/2
  80.     draw_line(x+1, y+12, x+w-3, y+12, startcolor, 1, endcolor)
  81.     draw_line(x, y+13, x+w-2, y+13, startcolor, 1, endcolor)
  82.     draw_line(x-1, y+14, x+w-1, y+14, startcolor, 1, endcolor)
  83.     draw_line(x-1, y+15, x+w-1, y+15, startcolor, 1, endcolor)
  84.     draw_line(x-1, y+16, x+w-1, y+16, startcolor, 1, endcolor)
  85.     draw_line(x-1, y+17, x+w-1, y+17, startcolor, 1, endcolor)
  86.     draw_line(x-1, y+18, x+w-1, y+18, startcolor, 1, endcolor)
  87.     draw_line(x-1, y+19, x+w-1, y+19, startcolor, 1, endcolor)
  88.     draw_line(x-1, y+20, x+w-1, y+20, startcolor, 1, endcolor)
  89.     draw_line(x, y+21, x+w-2, y+21, startcolor, 1, endcolor)
  90.     draw_line(x+1, y+22, x+w-3, y+22, startcolor, 1, endcolor)
  91.   else
  92.     draw_line(x+1, y+12, x+w+1, y+12, startcolor, 1, endcolor)
  93.     draw_line(x, y+13, x+w, y+13, startcolor, 1, endcolor)
  94.     draw_line(x-1, y+14, x+w-1, y+14, startcolor, 1, endcolor)
  95.     draw_line(x-1, y+15, x+w-1, y+15, startcolor, 1, endcolor)
  96.     draw_line(x-1, y+16, x+w-1, y+16, startcolor, 1, endcolor)
  97.     draw_line(x-1, y+17, x+w-1, y+17, startcolor, 1, endcolor)
  98.     draw_line(x-1, y+18, x+w-1, y+18, startcolor, 1, endcolor)
  99.     draw_line(x-1, y+19, x+w-1, y+19, startcolor, 1, endcolor)
  100.     draw_line(x-1, y+20, x+w-1, y+20, startcolor, 1, endcolor)
  101.     draw_line(x, y+21, x+w, y+21, startcolor, 1, endcolor)
  102.     draw_line(x+1, y+22, x+w+1, y+22, startcolor, 1, endcolor)
  103.   end
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # ● ライン描画 by 桜雅 在土
  107.   #--------------------------------------------------------------------------
  108.   def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  109.     # 描写距離の計算。大きめに直角時の長さ。
  110.     distance = (start_x - end_x).abs + (start_y - end_y).abs
  111.     # 描写開始
  112.     if end_color == start_color
  113.       for i in 1..distance
  114.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  115.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  116.         if width == 1
  117.           self.contents.set_pixel(x, y, start_color)
  118.         else
  119.           self.contents.fill_rect(x, y, width, width, start_color)
  120.         end
  121.       end
  122.     else
  123.       for i in 1..distance
  124.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  125.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  126.         r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  127.         g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  128.         b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  129.         a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  130.         if width == 1
  131.           self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  132.         else
  133.           self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  134.         end
  135.       end
  136.     end
  137.     end
复制代码

嗯。。但是我不知道怎么把這個改過來用。。-V-
我是想直接改在這個腳本里。。
  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————————

  4. #==============================================================================
  5. # ■ Game_Actor
  6. #------------------------------------------------------------------------------
  7. #  处理角色的类。本类在 Game_Actors 类 ($game_actors)
  8. # 的内部使用、Game_Party 类请参考 ($game_party) 。
  9. #==============================================================================

  10. class Game_Actor < Game_Battler
  11. #--------------------------------------------------------------------------
  12. # ● 取得战斗画面的 X 坐标
  13. #--------------------------------------------------------------------------
  14. def screen_x
  15. case self.index
  16. when 0
  17.    return 350
  18. when 1
  19.    return 430
  20. when 2
  21.    return 510
  22. when 3
  23.    return 580
  24. else
  25.    return 600

  26.   end
  27. end
  28. #--------------------------------------------------------------------------
  29. # ● 取得战斗画面的 Y 坐标
  30. #--------------------------------------------------------------------------
  31. def screen_y
  32. case self.index
  33. when 0
  34.    return 430
  35. when 1
  36.    return 395
  37. when 2
  38.    return 360
  39. when 3
  40.    return 325
  41. else
  42.    return 1000
  43.   end
  44. end
  45. #--------------------------------------------------------------------------
  46. # ● 取得战斗画面的 Z 坐标
  47. #--------------------------------------------------------------------------
  48. def screen_z
  49. case self.index
  50. when 0
  51.    return 10
  52. when 1
  53.    return 9
  54. when 2
  55.    return 8
  56. when 3
  57.    return 7
  58. else
  59.    return 0
  60.    end
  61. end
  62. end


  63. #==============================================================================
  64. # ■ Window_Base
  65. #------------------------------------------------------------------------------
  66. #  游戏中全部窗口的超级类。
  67. #==============================================================================

  68. class Window_Base < Window
  69. #--------------------------------------------------------------------------
  70. # ● 描绘 HP
  71. #     actor : 角色
  72. #     x     : 描画目标 X 坐标
  73. #     y     : 描画目标 Y 坐标
  74. #     width : 描画目标的宽
  75. #--------------------------------------------------------------------------
  76. def draw_actor_hp1(actor, x, y, width = 72)
  77.    # 描绘字符串 "HP"
  78.    self.contents.font.color = system_color
  79.    self.contents.draw_text(x, y, 24, 24, $data_system.words.hp)
  80.    # 计算描绘 MaxHP 所需的空间
  81.    if width - 24 >= 32
  82.      hp_x = x + 32# + width - 24
  83.    end
  84.    # 描绘 HP
  85.    self.contents.font.color = actor.hp == 0 ? knockout_color :
  86.      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  87.    self.contents.draw_text(hp_x, y, 32, 24, actor.hp.to_s, 2)
  88. end
  89. #--------------------------------------------------------------------------
  90. # ● 描绘 SP
  91. #     actor : 角色
  92. #     x     : 描画目标 X 坐标
  93. #     y     : 描画目标 Y 坐标
  94. #     width : 描画目标的宽
  95. #--------------------------------------------------------------------------
  96. def draw_actor_sp1(actor, x, y, width = 72)
  97.    # 描绘字符串 "SP"
  98.    self.contents.font.color = system_color
  99.    self.contents.draw_text(x, y, 24, 24, $data_system.words.sp)
  100.    # 计算描绘 MaxSP 所需的空间
  101.    if width - 24 >= 32
  102.      sp_x = x + 32# + width - 24
  103.    end
  104.    # 描绘 SP
  105.    self.contents.font.color = actor.sp == 0 ? knockout_color :
  106.      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  107.    self.contents.draw_text(sp_x, y, 32, 24, actor.sp.to_s, 2)
  108. end
  109. end





  110. #==============================================================================
  111. # ■ Window_BattleStatus
  112. #------------------------------------------------------------------------------
  113. #  显示战斗画面同伴状态的窗口。
  114. #==============================================================================

  115. class Window_BattleStatus < Window_Base
  116. #--------------------------------------------------------------------------
  117. # ● 初始化对像
  118. #--------------------------------------------------------------------------
  119. #$data_system_level_up_me = "Audio/ME/升级音乐"
  120. def initialize
  121.    super(0, 0, 640, 480)
  122.    self.contents = Bitmap.new(width - 10, height - 32)
  123.    self.opacity = 0
  124.    @level_up_flags = [false, false, false, false]
  125.    refresh
  126. end
  127. #--------------------------------------------------------------------------
  128. # ● 释放
  129. #--------------------------------------------------------------------------
  130. def dispose
  131.    super
  132. end
  133. #--------------------------------------------------------------------------
  134. # ● 设置升级标志
  135. #     actor_index : 角色索引
  136. #--------------------------------------------------------------------------
  137. def level_up(actor_index)
  138.    @level_up_flags[actor_index] = true
  139. end
  140. #--------------------------------------------------------------------------
  141. # ● 刷新
  142. #--------------------------------------------------------------------------
  143. def refresh
  144.    self.contents.clear
  145.    @item_max = $game_party.actors.size
  146.     for i in 0...$game_party.actors.size
  147.      actor = $game_party.actors[i]
  148.      
  149.       x = i * 125
  150.       a = actor.id.to_s + "_b"
  151.       bitmap=Bitmap.new("Graphics/Battlersface/#{a}")  
  152.       src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  153.       self.contents.blt(110 + x , 376, bitmap, src_rect)
  154.       
  155.    case i
  156.        when 0
  157.         x = 171
  158.         y = 406
  159.        when 1
  160.         x = 296
  161.         y = 406
  162.        when 2
  163.         x = 421
  164.         y = 406
  165.        when 3
  166.         x = 546
  167.         y = 406
  168.       end
  169.      if @level_up_flags[i]
  170.        self.contents.font.color = normal_color
  171.        self.contents.draw_text(x, y, 80, 24, "修為提升!")
  172.        Audio.me_stop
  173.         Audio.me_play($data_system_level_up_me)

  174.      else
  175.      self.contents.font.size = 12
  176.      draw_actor_hp1(actor, x-15, y-15, 80)
  177.      self.contents.font.size = 12
  178.      draw_actor_sp1(actor, x-15, y+5, 80)
  179.      self.contents.font.size = 12
  180.     end
  181.    end
  182. end
  183. #--------------------------------------------------------------------------
  184. # ● 刷新画面
  185. #--------------------------------------------------------------------------
  186. def update
  187.    super
  188.    # 主界面的不透明度下降
  189.    if $game_temp.battle_main_phase
  190.      self.contents_opacity -= 50 if self.contents_opacity > 1
  191.    else
  192.      self.contents_opacity += 50 if self.contents_opacity < 255
  193.    end
  194. end
  195. end





  196. #==============================================================================
  197. # ■ Window_BattleStatus
  198. #==============================================================================
  199. class Window_BattleStatus < Window_Base
  200. #--------------------------------------------------------------------------
  201. # ● 初始化
  202. #--------------------------------------------------------------------------
  203. alias xrxs_bp2_refresh refresh
  204. def refresh
  205.    xrxs_bp2_refresh
  206.    @item_max = $game_party.actors.size
  207.     for i in 0...$game_party.actors.size
  208.      actor = $game_party.actors[i]
  209.      case i
  210.        when 0
  211.         x = 169
  212.         y = 394
  213.        when 1
  214.         x = 294
  215.         y = 394
  216.        when 2
  217.         x = 419
  218.         y = 394
  219.        when 3
  220.         x = 544
  221.         y = 394
  222.       end
  223.      draw_actor_hp_meter(actor, x, y, 50)
  224.      draw_actor_sp_meter(actor, x, y + 19, 50)
  225.    end
  226. end
  227. end
  228. #==============================================================================
  229. # ■ Window_Base
  230. #==============================================================================
  231. class Window_Base < Window
  232. #--------------------------------------------------------------------------
  233. # ● HP描画
  234. #--------------------------------------------------------------------------
  235. def draw_actor_hp_meter(actor, x, y, width = 150, type = 0)
  236.    if type == 1 and actor.hp == 0
  237.      return
  238.    end
  239.    self.contents.font.color = system_color
  240. #  self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 25))   
  241.   self.contents.fill_rect(x-2, y+16, width+4,8, Color.new(255,255,255,255))
  242.   self.contents.fill_rect(x-1, y+17, width+2,6, Color.new(0,0,0,255))   
  243.    w = width * actor.hp / actor.maxhp
  244.    #self.contents.fill_rect(x, y+28, w,1, Color.new(255, 96, 96, 255))
  245.    #self.contents.fill_rect(x, y+29, w,1, Color.new(255, 0, 0, 255))
  246.    #self.contents.fill_rect(x, y+30, w,1, Color.new(128, 0, 0, 255))
  247.    #self.contents.fill_rect(x, y+31, w,1, Color.new(0, 0, 0, 255))
  248.    #end
  249.   self.contents.fill_rect(x, y+18, w,1, Color.new(200,10,18,255))
  250.   self.contents.fill_rect(x, y+19, w,1, Color.new(255,50,50,255))
  251.   self.contents.fill_rect(x, y+20, w,1, Color.new(180,0,0,255))
  252.   end

  253. #--------------------------------------------------------------------------
  254. # ● SP描画
  255. #--------------------------------------------------------------------------
  256. def draw_actor_sp_meter(actor, x, y, width = 150, type = 0)
  257.    if type == 1 and actor.hp == 0
  258.      return
  259.    end
  260.    self.contents.font.color = system_color
  261. #   self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
  262.    self.contents.fill_rect(x-2, y+16, width+4,8, Color.new(255,255,255,255))
  263.    self.contents.fill_rect(x-1, y+17, width+2,6, Color.new(0,0,0,255))
  264.    w = width * actor.sp / actor.maxsp
  265.    #self.contents.fill_rect(x, y+28, w,1, Color.new(128, 255, 255, 255))
  266.    #self.contents.fill_rect(x, y+29, w,1, Color.new(0, 255, 255, 255))
  267.    #self.contents.fill_rect(x, y+30, w,1, Color.new(0, 192, 192, 255))
  268.    #self.contents.fill_rect(x, y+31, w,1, Color.new(0, 128, 128, 255))
  269.    self.contents.fill_rect(x, y+18, w,1, Color.new(0,100,255,255))
  270.    self.contents.fill_rect(x, y+19, w,1, Color.new(0,150,255,255))
  271.    self.contents.fill_rect(x, y+20, w,1, Color.new(0,100,255,255))
  272. end
  273. end
复制代码

星星在哪里都是很亮的,就看你有沒有抬頭去看他們                       --------華麗麗的百變暖暖窩
本人之作《夙誓》龜速進行中。。= =!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

綾川司の姫様<

梦石
0
星屑
50
在线时间
796 小时
注册时间
2007-12-20
帖子
4520

贵宾第3届短篇游戏大赛R剧及RMTV组亚军

20
发表于 2008-9-29 17:25:59 | 只看该作者
     draw_actor_hp_meter(actor, x, y, 50)
     draw_actor_sp_meter(actor, x, y + 19, 50)

这里在你那里有的啊0 0直接可以调用,不过把后面那个50删掉,然后在我给你的那段脚本里修改width就行了。
那段脚本插在Main前面就能调用。

生命即是责任。自己即是世界。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-1-23 14:01

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表