Project1

标题: 呵呵突然发现血条美化好简单 [打印本页]

作者: cmbljsw    时间: 2008-11-1 22:52
标题: 呵呵突然发现血条美化好简单
http://rpg.blue/web/htm/news123.htm

从这里的脚本中抽取一点点:



  1.   #-----------------------------------------------------------------------
  2.   # ● HP描画
  3.   #-----------------------------------------------------------------------
  4.   def draw_actor_hp_meter(actor, x, y, width = 156, type = 0)
  5.     if type == 1 and actor.hp == 0
  6.       return
  7.     end
  8.     self.contents.font.color = system_color
  9.     self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
  10.     w = width * actor.hp / [actor.maxhp,1].max
  11.     self.contents.fill_rect(x, y+28, w,1, Color.new(255, 96, 96, 255))
  12.     self.contents.fill_rect(x, y+29, w,1, Color.new(255, 0, 0, 255))
  13.     self.contents.fill_rect(x, y+30, w,1, Color.new(128, 0, 0, 255))
  14.     self.contents.fill_rect(x, y+31, w,1, Color.new(0, 0, 0, 255))
  15.   end
复制代码



比如把上面这个改成:


  1.   # ● HP描画
  2.   #-----------------------------------------------------------------------
  3.   def draw_actor_hp_meter(actor, x, y, width = 156, type = 0)
  4.     if type == 1 and actor.hp == 0
  5.       return
  6.     end
  7.     self.contents.font.color = system_color
  8.     self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
  9.     w = width * actor.hp / [actor.maxhp,1].max
  10.     for i in 1...100#循环
  11.     s = i*(w/100.00)
  12.     self.contents.fill_rect(x+s, y+28, 1,1, Color.new(155+i, i, i, 255))
  13.     end
  14.   end
复制代码


你会发现,血槽的颜色从,深红,到粉红,非常有趣和简单……


突发的灵感,给大家分享一下。


作者: 一瞬间的幻觉    时间: 2008-11-2 02:07
{/cy}谢谢了,我用看看




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