# 怪物血条

![](https://tu-1302037808.cos.ap-nanjing.myqcloud.com/study/bld1.png)

如图所示

这是一个最基础的怪物血条

那么配置这种血条，我们需要修改2个配置文件

> **EntityModel.yml**
>
> **Blood.yml** #如果这个配置文件没有，可以自行创建

我们打开EntityModel.yml

这样写

```
僵尸: #这个名字随便写
  entity: "僵尸" #这里的僵尸是代表怪物的名字
  model: "empty" #不填模型路径，'empty'就是'空'
  blood: "僵尸1" #这是blood.yml里面的项目名
```

这样一边的配置文件就写好了

现在写另一边的

打开Blood.yml

```
僵尸1: #上面提到的项目名，可以随便写
  offsetY: 2.4 #从脚下向上偏移的格数
  background: #血条的背景图片组件
    path: "https://tu-1302037808.cos.ap-nanjing.myqcloud.com/laoban/xtbg1.png" #图片路径
    width: 100 #图片长度
    height: 10 #图片高度
  health: #血条的本体图片组件
    path: "https://tu-1302037808.cos.ap-nanjing.myqcloud.com/laoban/xt2.png" #图片路径
    width: "100-(1-%h%/%hmax%)*100" #算法，%per%*100应该也是相同的效果
    height: 10
  string: #字符串
    xx: 项目名，随便写，可以无限添加
      content: "§a§l%h% / %hmax%" #文本内容
      x: 65 #从背景图片x为0偏移
      y: 5 #从背景图片y为0偏移
      scale: 0.5 #文本放大倍数
    xxx:
      content: "§b§l%name%"
      x: 90
      y: -9
      scale: 0.5
```

这样blood也配置好了

重载就能看到效果了

blood中用到了一些变量

> %per% #该实体当前生命值的百分比，返回值为0.00\~1.00
>
> %h% #该实体当前生命值
>
> %hmax% #该实体生命值上限
>
> %name% #该实体名字

有时候可能会出现血条跟背景叠不到一起

我们可以在画图软件中在血条图片的四边加上一些透明边

那样就能把血条的位置挤了位移，从而和背景重合


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://q1c.gitbook.io/dragoncore-course/other/mobblood.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
