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

Project1

 找回密码
 注册会员
搜索
查看: 1894|回复: 2
打印 上一主题 下一主题

[已经解决] 战斗显示敌方生命血条

[复制链接]

Lv1.梦旅人

梦石
0
星屑
90
在线时间
55 小时
注册时间
2009-11-8
帖子
31
跳转到指定楼层
1
发表于 2016-3-31 20:43:53 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
战斗显示敌方生命血条  求大神发个给我用用  感谢

Lv4.逐梦者

素材区好人

梦石
3
星屑
6802
在线时间
3462 小时
注册时间
2011-7-21
帖子
2254

极短24参与极短23参与极短22参与极短21参与

2
发表于 2016-3-31 21:35:34 | 只看该作者
该脚本可以显示生命百分比,如果需要显示详细数值,可以告诉我
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================  
  4. #==============================================================================
  5. # ■ Window_Help
  6. #------------------------------------------------------------------------------
  7. # 重新定义的内容,可以显示敌人的HP\MP百分比
  8. # 你可以改脚本的开头部分定义生命、精神描述词。只和敌人描述有关,可随意修改
  9. #==============================================================================
  10. class Window_Help < Window_Base
  11.   def set_enemy(actor)   
  12.     #--------------------------------------------------------------------
  13.     # 在这里修改描述文字,比如@生命描述词="敌人生命"
  14.     #--------------------------------------------------------------------
  15.  
  16.     @生命描述词 = $data_system.words.hp
  17.     @精神描述词 = $data_system.words.sp
  18.  
  19.     #--------------------------------------------------------------------
  20.     #--------------------------------------------------------------------
  21.     self.contents.clear
  22.     draw_actor_name(actor, 4, 0)
  23.     draw_actor_state(actor, 140, 0)
  24.     carol3_draw_hp_bar(actor, 284, 12)
  25.     carol3_draw_sp_bar(actor, 460, 12)
  26.     @text = nil
  27.     self.visible = true
  28.   end  
  29.   def carol3_draw_hp_bar(actor, x, y, width = 128, height = 14) #宽度可调
  30.     w = width * actor.hp / [actor.maxhp,1].max
  31.     hp_color_1 = Color.new(255, 0, 0, 192)  
  32.     hp_color_2 = Color.new(255, 255, 0, 192)  
  33.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))  
  34.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)  
  35.     x -= 1  
  36.     y += (height/4).floor  
  37.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))  
  38.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)  
  39.     x -= 1  
  40.     y += (height/4).ceil  
  41.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))  
  42.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)  
  43.     x -= 1  
  44.     y += (height/4).ceil  
  45.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))  
  46.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)  
  47.     self.contents.font.color = Color.new(0,0,0,255)
  48.     self.contents.draw_text(x+2,-3,128,32,@生命描述词,1)
  49.     self.contents.font.color = Color.new(255,255,255,255)
  50.     self.contents.draw_text(x,-4,128,32,@生命描述词,1)
  51.   end  
  52.   def carol3_draw_sp_bar(actor, x, y, width = 128, height=14)
  53.     w = width * actor.sp / [actor.maxsp,1].max  
  54.     hp_color_1 = Color.new( 0, 0, 255, 192)  
  55.     hp_color_2 = Color.new( 0, 255, 255, 192)  
  56.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))  
  57.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)  
  58.     x -= 1  
  59.     y += (height/4).floor  
  60.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))  
  61.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)  
  62.     x -= 1  
  63.     y += (height/4).ceil  
  64.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))  
  65.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)  
  66.     x -= 1  
  67.     y += (height/4).ceil  
  68.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))  
  69.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)  
  70.     self.contents.font.color = Color.new(0,0,0,255)
  71.     self.contents.draw_text(x+2,-3,128,32,@精神描述词,1)
  72.     self.contents.font.color = Color.new(255,255,255,255)
  73.     self.contents.draw_text(x,-4,128,32,@精神描述词,1)
  74.   end
  75.   #--------------------------------------------------------------------------  
  76.   # ● ライン描画 by 桜雅 在土  
  77.   #--------------------------------------------------------------------------  
  78.   def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)  
  79.     # 描写距離の計算。大きめに直角時の長さ。  
  80.     distance = (start_x - end_x).abs + (start_y - end_y).abs  
  81.     # 描写開始  
  82.     if end_color == start_color  
  83.       for i in 1..distance  
  84.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i  
  85.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i  
  86.         if width == 1  
  87.           self.contents.set_pixel(x, y, start_color)  
  88.         else  
  89.           self.contents.fill_rect(x, y, width, width, start_color)  
  90.         end  
  91.       end  
  92.     else  
  93.       for i in 1..distance  
  94.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i  
  95.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i  
  96.         r = start_color.red * (distance-i)/distance + end_color.red * i/distance  
  97.         g = start_color.green * (distance-i)/distance + end_color.green * i/distance  
  98.         b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance  
  99.         a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance  
  100.         if width == 1  
  101.           self.contents.set_pixel(x, y, Color.new(r, g, b, a))  
  102.         else  
  103.           self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))  
  104.         end  
  105.       end  
  106.     end  
  107.   end  
  108. end
  109. #==============================================================================
  110. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  111. #==============================================================================

评分

参与人数 1星屑 +150 收起 理由
RyanBern + 150 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
90
在线时间
55 小时
注册时间
2009-11-8
帖子
31
3
 楼主| 发表于 2016-4-1 11:35:53 | 只看该作者
真心 感谢大神 {:2_275:} {:2_275:} {:2_275:} {:2_275:}
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-3 07:01

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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