Project1

标题: 求地图上显示角色属性的脚本 [打印本页]

作者: 蛋黄派    时间: 2011-8-18 22:33
标题: 求地图上显示角色属性的脚本
求在地图上显示角色等级、HP、SP的脚本,谢谢了dsu_plus_rewardpost_czw
作者: 龙腾天下    时间: 2011-8-18 23:05
http://rpg.blue/forum.php?mod=vi ... 9083&highlight=

大家要好好爱 度娘 。。。
作者: tyrpg    时间: 2011-8-18 23:34
本帖最后由 tyrpg 于 2011-8-18 23:38 编辑

#显示人物HP、SP、等级-tyrpg
class Window_ahsl < Window_Base
def initialize
    super(0, 0, 640, 480)
    self.windowskin = ()
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = Font.default_name
    self.contents.font.size = 18
    @renwu = $game_party.actors[0]
    xianshixinxi
end
  def xianshixinxi
    self.contents.clear
    self.contents.font.color = normal_color
      dengjimingchengxianshi(@renwu, 0, 0, 170)
      hpxianshi(@renwu, 0, 32)
      spxianshi(@renwu, 0, 64)
    end
def update
    super
  end
end
class Window_Base < Window  
  def hpxianshi(actor, x, y, width = 144)
    ahp = "HP: "+"#{actor.hp}"+"/"+"#{actor.maxhp}"
    self.contents.draw_text(x, y,320, 50,ahp )
    self.contents.font.color = normal_color
end
def spxianshi(actor, x, y, width = 144)
      asp = "SP: "+"#{actor.sp}"+"/"+"#{actor.maxsp}"
    self.contents.draw_text(x, y,320, 50,asp )
    self.contents.font.color = normal_color
end  
    def dengjimingchengxianshi(actor, x, y, width = 120)
    text = "Lv:#{actor.level}"
    text2 = "#{actor.name}"+"  "+text
    self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
    self.contents.draw_text(x, y, width, 32, text2)
  end
end
class Scene_Map
  alias old_main main
  def main
    @xianshi_Window = Window_ahsl.new
    old_main
    @xianshi_Window.dispose
  end
  alias old_update update
  def update
    @xianshi_Window.update
    old_update
  end
end

作者: 蛋黄派    时间: 2011-8-19 17:46
tyrpg 发表于 2011-8-18 23:34
#显示人物HP、SP、等级-tyrpg
class Window_ahsl < Window_Base
def initialize

很好的说,但是怎么把字的颜色调一下?
作者: tyrpg    时间: 2011-8-19 19:51
要什么颜色的啊


tyrpg于2011-8-19 20:00补充以下内容:
self.contents.font.color = normal_color
在这一行可以改颜色
那一句里面 normal_color 是白色 可以改成别的颜色
紫改为:text_color(1)
红改为:text_color(2)
绿改为:text_color(3)
蓝改为:text_color(4)
黄改为:text_color(6)
粉改为:text_color(7)





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