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

Project1

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

[已经过期] 在战斗中如何显示敌人的血量

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
150
在线时间
116 小时
注册时间
2011-1-23
帖子
121
跳转到指定楼层
1
发表于 2011-1-24 17:04:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
    不用脚本行不,我是新手,不会用脚本,一窍不通。求最简单的方法,我用RPGMakerXP做的游戏,我看别人的游戏中显了血条,我做的游戏敌人血多,朋友说看不见血条干着急,求方法。实在不行的话给我列举最最最简单的脚本吧........

Lv1.梦旅人

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
帖子
3597
2
发表于 2011-1-24 17:14:11 | 只看该作者
  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————————

  4. #==============================================================================
  5. # ■ Window_Help
  6. #------------------------------------------------------------------------------
  7. # 重新定义的内容,可以显示敌人的HP\MP百分比
  8. # 作者:carol3_柳柳
  9. #==============================================================================

  10. class Window_Help < Window_Base
  11.   def set_enemy(actor)
  12.     self.contents.clear
  13.     draw_actor_name(actor, 4, 0)
  14.     draw_actor_state(actor, 140, 0)
  15.     carol3_draw_hp_bar(actor, 380, 0)
  16.     carol3_draw_sp_bar(actor, 495, 0)
  17.     @text = nil
  18.     self.visible = true
  19.   end
  20.   def carol3_draw_hp_bar(actor, x, y, width = 100) #宽度可调
  21.     self.contents.font.color = system_color
  22.     self.contents.fill_rect(x-1, y+17, width+2,6, Color.new(0, 0, 0, 255))
  23.     w = width * actor.hp / actor.maxhp
  24.     self.contents.fill_rect(x, y+18, w,1, Color.new(255, 96, 96, 255))
  25.     self.contents.fill_rect(x, y+19, w,1, Color.new(255, 0, 0, 255))
  26.     self.contents.fill_rect(x, y+20, w,1, Color.new(128, 0, 0, 255))
  27.     self.contents.fill_rect(x, y+21, w,1, Color.new(0, 0, 0, 255))
  28.     self.contents.draw_text(x,y,128,32,$data_system.words.hp,1)
  29.     self.contents.font.color = normal_color
  30.   end
  31.   def carol3_draw_sp_bar(actor, x, y, width = 100)
  32.     self.contents.font.color = system_color
  33.     self.contents.fill_rect(x-1, y+17, width+2,6, Color.new(0, 0, 0, 255))
  34.     w = width * actor.sp / actor.maxsp
  35.     self.contents.fill_rect(x, y+18, w,1, Color.new(128, 255, 255, 255))
  36.     self.contents.fill_rect(x, y+19, w,1, Color.new(0, 255, 255, 255))
  37.     self.contents.fill_rect(x, y+20, w,1, Color.new(0, 192, 192, 255))
  38.     self.contents.fill_rect(x, y+21, w,1, Color.new(0, 128, 128, 255))
  39.     self.contents.draw_text(x,y,128,32,$data_system.words.sp,1)
  40.     self.contents.font.color = normal_color
  41.   end
  42. end
复制代码
不要问怎么使用

http://rpg.blue/thread-175056-1-2.html
PVZ型塔防物一个
http://rpg.blue/thread-155199-1-2.html
RMXP技术讨论区手动认可帖,得到答案请认可
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
150
在线时间
116 小时
注册时间
2011-1-23
帖子
121
3
 楼主| 发表于 2011-1-24 17:54:23 | 只看该作者
那我就不问怎么使用......


1101于2011-1-24 18:01补充以下内容:
用了之后无法打开游戏.......
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
32 小时
注册时间
2011-1-18
帖子
28
4
发表于 2011-1-24 18:20:40 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
150
在线时间
116 小时
注册时间
2011-1-23
帖子
121
5
 楼主| 发表于 2011-1-25 11:36:02 | 只看该作者
BEN10 发表于 2011-1-24 18:20
你打开右上角的脚本编辑器,在左边,随便找个脚本右击,再按插入,再把楼上的代码复制到你新建的那个页面就 ...

新建脚本的12行发生了TypeError.......然后就打不开游戏了


1101于2011-1-25 12:48补充以下内容:
谢谢,我现在用这个:
class Window_Help < Window_Base
def set_enemy(actor)
    self.contents.clear
    draw_actor_name(actor, 4, 0)
    draw_actor_state(actor, 140, 0)
    carol3_draw_hp_bar(actor, 284, 0)
    carol3_draw_sp_bar(actor, 460, 0)
    @text = nil
    self.visible = true
end
def carol3_draw_hp_bar(actor, x, y, width = 128) #宽度可调
    self.contents.font.color = system_color
    w = width * actor.hp / [actor.maxhp,1].max
    if actor.maxhp != 0
      rate = actor.hp.to_f / actor.maxhp
    else
      rate = 0
    end
    color1 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 150)
    self.contents.fill_rect(x+1, y+15, width+2,1, Color.new(0, 0, 0, 255))
    self.contents.fill_rect(x+1, y+16, width+2,1, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x+1, y+17, w,6,color1)
    self.contents.fill_rect(x+1, y+23, width+2,1, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x+1, y+24, width+2,1, Color.new(0, 0, 0, 255))
    self.contents.fill_rect(x, y+16, 1,8, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x-1, y+15, 1,10, Color.new(0, 0, 0, 255))
    self.contents.fill_rect(x+129, y+16, 1,8, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x+130, y+15, 1,10, Color.new(0, 0, 0, 255))
    self.contents.draw_text(x-53,y,128,32,$data_system.words.hp,1)
    if actor.hp>actor.maxhp/3
      self.contents.font.color = Color.new(255, 255, 255, 250)
    end
    if actor.hp>=actor.maxhp/6 and actor.maxhp/3>actor.hp
      self.contents.font.color = Color.new(200, 200, 0, 255)
    end
    if actor.maxhp/6>actor.hp
      self.contents.font.color = Color.new(200, 0, 0, 255)
    end
    self.contents.draw_text(x+47,y,128,32,actor.hp.to_s,1)
end
def carol3_draw_sp_bar(actor, x, y, width = 128)
    self.contents.font.color = system_color
    if actor.maxsp != 0
      rate = actor.sp.to_f / actor.maxsp
    else
      rate = 0
    end
    color2 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
    w = width * actor.sp / [actor.maxsp,1].max
    self.contents.fill_rect(x+1, y+15, width+2,1, Color.new(0, 0, 0, 255))
    self.contents.fill_rect(x+1, y+16, width+2,1, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x+1, y+17, w,6,color2)
    self.contents.fill_rect(x+1, y+23, width+2,1, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x+1, y+24, width+2,1, Color.new(0, 0, 0, 255))
    self.contents.fill_rect(x, y+16, 1,8, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x-1, y+15, 1,10, Color.new(0, 0, 0, 255))
    self.contents.fill_rect(x+129, y+16, 1,8, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x+130, y+15, 1,10, Color.new(0, 0, 0, 255))
    self.contents.draw_text(x-53,y,128,32,$data_system.words.sp,1)
    if actor.hp>actor.maxsp/3
      self.contents.font.color = Color.new(255, 255, 255, 250)
    end
    if actor.hp>=actor.maxsp/6 and actor.maxsp/3>actor.sp
      self.contents.font.color = Color.new(200, 200, 0, 255)
    end
    if actor.maxsp/6>actor.sp
      self.contents.font.color = Color.new(200, 0, 0, 255)
    end
    self.contents.draw_text(x+47,y,128,32,actor.sp.to_s,1)
end
end

点评

请在Main的上面插入- -  发表于 2011-1-25 11:53
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-21 18:03

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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