Project1

标题: 血條顏色改成橫向漸變式。。 [打印本页]

作者: 忻緣    时间: 2008-9-28 02:49
标题: 血條顏色改成橫向漸變式。。
追加下懸賞積分。。-V-。。天聖大人。。-V-。。真是麻煩您了。。-V-
-----------------------------------------------------------
想改血條的顏色。。-V-
改成橫向漸變式。。於是。。不知道怎么改。。-V-
下面是我的戰鬥腳本。。-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
复制代码
[LINE]1,#dddddd[/LINE]版务信息:本贴由楼主自主结贴~
作者: 塑望    时间: 2008-9-28 03:13
  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
作者: 忻緣    时间: 2008-9-28 03:31
以下引用塑望于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

  self.contents.draw_text(hp_x, y, 32, 24, actor.hp.to_s, 2) 會出錯。。-V-
作者: 黑鏻    时间: 2008-9-28 04:19
@confirm_window.contents.font.color = Color.new(255,255,255,255)
括号内按RGB改吧~~

颜色也可以进Window_Base里改~~
@namesprite.bitmap.font.color.set(255, 255, 255)

推荐清爽血条的单独发行版本
http://rpg.blue/web/htm/news913.htm
作者: 灯笼菜刀王    时间: 2008-9-28 05:14
- -~~ 按我的理解楼主是要血条的颜色有渐变效果吧~~~

光改颜色不行,

思路就是把槽值显示的部分一象素一象素描绘颜色。具体就是把最后的渐变色的RPG减去开始的渐变色的RPG,描绘前面几个象素,然后把最后渐变色减去之前减好的那个色在描绘几象素,然后在用最后减去前面的色在描绘-。-~~~  直到最后差等于0,就OK了~

作者: 黑鏻    时间: 2008-9-28 05:15
去把站上的“全动画战斗”的血条弄下来~~
作者: 灯笼菜刀王    时间: 2008-9-28 05:26
其实,写这个不难的~~,不过我弄不明白的是为什么这里要描绘那么多矩形~~ 这样我就不知道该改哪个....

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+28, w,1, Color.new(255, 96, 96, 255))
   #self.contents.fill_rect(x, y+29, w,1, Color.new(255, 0, 0, 255))
   #self.contents.fill_rect(x, y+30, w,1, Color.new(128, 0, 0, 255))
   #self.contents.fill_rect(x, y+31, w,1, Color.new(0, 0, 0, 255))
   #end
  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

作者: trentswd    时间: 2008-9-28 10:01
因为每个矩形只能Fill一个颜色……所以要很多rect吧……
作者: 天圣的马甲    时间: 2008-9-28 10:08
简单的方法是描绘成线,然后铺……=。=
这个范例取材自天干宝典,可以参考。
http://rpg.blue/upload_program/g ... ��)_102996497.rar [LINE]1,#dddddd[/LINE]系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者: trentswd    时间: 2008-9-28 10:16
突然想起这个……
gradient_fill_rect可以直接在rect里面画渐变,本来是个RGSS2的方法,不过有高手写了xp版
http://rpg.blue/viewthread.php?tid=68399&ntime=2008%2D9%2D28+2%3A15%3A07
作者: 灯笼菜刀王    时间: 2008-9-28 10:35
以下引用trentswd于2008-9-28 2:01:58的发言:

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

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

天圣小姐给的方法就是我说的方法~
作者: trentswd    时间: 2008-9-28 10:45
OTL没注意看……看错了

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

所以都要改= =
作者: 灯笼菜刀王    时间: 2008-9-28 10:47
以下引用trentswd于2008-9-28 2:45:38的发言:

OTL没注意看……看错了

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

所以都要改= =

如果真要这样= =,工作量先不说,还很影响FPS~~  还不如直接用图片显示血槽~~~
作者: trentswd    时间: 2008-9-28 10:52
以下引用灯笼菜刀王于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的话,到了血很少的时候就没有渐变了=。=
作者: 忻緣    时间: 2008-9-29 06:56
#--------------------------------------------------------------------------
# ● 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

。。呃。。不知那個用圖片顯示的效果如何。。
作者: 天圣的马甲    时间: 2008-9-29 12:59
你是希望做成这样的效果:
http://rpg.blue/web/htm/news140.htm
还是这样的效果?
http://rpg.blue/web/htm/news913.htm
作者: 忻緣    时间: 2008-9-29 16:42
以下引用天圣的马甲于2008-9-29 4:59:28的发言:

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

不是差不多麼。。-V-。。喜歡下面的漸變。。-V-。。但是。。只要漸變就好。。
作者: 天圣的马甲    时间: 2008-9-29 16:56
类似这样么?= =
  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
复制代码


作者: 忻緣    时间: 2008-9-29 17:16
以下引用天圣的马甲于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
复制代码

作者: 天圣的马甲    时间: 2008-9-29 17:25
     draw_actor_hp_meter(actor, x, y, 50)
     draw_actor_sp_meter(actor, x, y + 19, 50)

这里在你那里有的啊0 0直接可以调用,不过把后面那个50删掉,然后在我给你的那段脚本里修改width就行了。
那段脚本插在Main前面就能调用。
作者: 忻緣    时间: 2008-9-29 17:35
以下引用天圣的马甲于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前面就能调用。

那個。。有描繪SP的麼。。-V-只有一個不能調。。-V-
作者: 天圣的马甲    时间: 2008-9-29 17:43
给你的脚本里这一部分是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

作者: 忻緣    时间: 2008-9-29 19:35
那個。。可以用了。。但是。。太寬了。。-V-應該在那哪邊改。。-V-
作者: 天圣的马甲    时间: 2008-9-29 19:52
宽度是width = 128这句话,可以自行修改数字。
作者: 忻緣    时间: 2008-9-29 19:56
以下引用天圣的马甲于2008-9-29 11:52:58的发言:

宽度是width = 128这句话,可以自行修改数字。

我錯了。。-V-。。那個改了是長度。。-V-。。
可能我是把長度理解成寬度。。-V-
作者: 天圣的马甲    时间: 2008-9-29 19:59
喔,也就是血条的『厚度』的意思吧?
因为这些血条是用线叠起来的,所以要减少厚度,就减少线的数量就可以了。
   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)
#比如把这些描绘线条的语句注释掉


作者: 忻緣    时间: 2008-9-29 20:03
謝謝天聖大人啦。。我知道怎么做了。。{/hx}




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1