声明:本文是自己做的项目,可能不是最好的方法,或有错误使用方式。各位不喜勿喷!

HP进度

HP背景

将上面的资源拖到UE4中(使用UE4自带的颜色也可实现效果,具体参考官方教程 https://docs.unrealengine.com/latest/CHN/Engine/UMG/QuickStart/2/index.html)

网上相关教程:https://answers.unrealengine.com/questions/79728/how-to-make-a-progress-bar-in-umg.html

下面是自己的做法:(注意:下面教程中使用了部分的官方教程截图)

一、创建并设置血条的控件蓝图。

1. 在内容浏览器中添加一个控件蓝图,并命名为HP_Widget。  (控件蓝图,即:widget Blueprint)

2. 双击刚创建的控件蓝图,并拖进一个Progress Bar

3. 按照下图设置progress Bar后,保存

二、 创建可以添加到游戏中的3D Actor 蓝图类,并命名为HP_Blueprint

直接粘贴了部分官方教程, 见谅。   (对官方教程 感兴趣的可以看下Creating and Adding the 3D Actor to the Game World ,具体见官方教程

注意:将下面MainMenu换成自己的HP_Widget即可。

In this step, we will create the Actor that will contain and display our UI Menu we created in game.

  1. Right-click in the Content Browser, then choose Blueprint from the context menu that appears to create a new Blueprint.

  2. Select Actor from the pop-up menu that appears, give the new Blueprint a name, then save the Blueprint.

  3. Double-click on the new Blueprint to open it up in the Editor, it should open to the Components tab.

    If it does not open up on the Components tab, click the Components tab to jump to it.

  4. Click the Add Component button, then find and select the Widget option.

  5. Give the component a name (such as MainMenu), then click the Compile and Save buttons.

  6. In the Details panel for the new widget component, scroll down to the UI section and under Widget Class, select the MainMenuWidget Blueprint.

  7. You can adjust the Draw Size settings to increase the scale of the widget.

  8. There is also a Max Interaction option which will determine how far away the player can be to interact with the widget.

  9. There are additional options for rendering under the Rendering section (below we have set the component to two sided so the component is visible from behind).

三、给蓝图类添加进度条和朝向摄像机的功能。

1.新建一个蓝图附加对象的变量MyOwner

2.新建一个获得蓝图要附加的对象的函数:GetAttachOwner

3. 新建一个变量Progress Bar,存储进度条对象

4. 新建一个函数GetProgressBar,用来获得进度条对象

5. 新建一个函数HpBarLookAtCamera,每帧都使血条朝向摄像机

6. 在事件图标中调用各个函数。

四、将HPBlueprint蓝图类从资源浏览器中拖到人或怪身上,并设置位置就OK了。

注意:不能通过添加组件的方式HPBlueprint蓝图类。

UE4 使用UGM制作血条的更多相关文章

  1. UGUI之Slider使用,制作血条

    用Slider来控制Cube旋转 Slider是滑动条.

  2. unity3d-游戏实战突出重围,第二天 制作血条

    using UnityEngine; using System.Collections; public class xt : MonoBehaviour { //红色血条 public Texture ...

  3. Unity中制作血条2.0

    ##1.血量显示 不必像之前那样添加Slider组件 直接创建Image 在添加Source Image之后,将Image Type 修改为Filled 通过修改Fill Mode就可以显示不同效果 ...

  4. Unity NGUI弧形血条的制作

    unity版本:4.6 NGUI版本:3.6. (转载请注明参考链接及作者) 参考链接:http://www.cnblogs.com/louissong/p/3841656.html,作者:博客园 L ...

  5. Unity NGUI 血条制作

    NGUI 血条制作步骤 实现过程: 模拟血条的变化当点击按钮Button是血条会实时发生变化. 1.向Unity中导入NGUI2.6.3.unitypackage 点击create your ui 后 ...

  6. unity制作简单血条

    学习Unity已经10天了,也没发现有什么长进,真的急.昨天仿着官方Demo做了个射击游戏轮廓,其中需要给每个怪做一个血条. 搜了一些,挺复杂的,用NGUI或者UGUI,外加很长的代码...不过还是找 ...

  7. Shader实例:NGUI制作网格样式血条

    效果: 思路: 1.算出正确的uv去采样过滤图,上一篇文章说的很明白了.Shader实例:NGUI图集中的UISprite正确使用Shader的方法 2.用当前血量占总血量的百分比来设置shader中 ...

  8. [UE4][Canvas]用C++代码绘制血条(HealthBar)

    转自:http://aigo.iteye.com/blog/2275110 参考自Epic官方项目StrategyGame 血条效果: StrategyHUD.h StrategyHUD.cpp

  9. Unity3D 人形血条制作小知识

    这几天用Unity3D做个射击小游戏,想做个人形的血条.百思不得其解,后来问了网上的牛牛们,攻克了,事实上挺简单的,GUI里面有个函数DrawTextureWithTexCoords就能够实现图片的裁 ...

随机推荐

  1. linux下普通用户如何使用80端口启动程序

    linux下普通用户如何使用80端口启动程序 http://blog.csdn.net/shootyou/article/details/6750230 大家都知道默认情况下linux的1024以下端 ...

  2. sed处理url编码解码=== web日志的url处理

    URL 编码/解码方法(linux  shell实现),方法如下: 1.编码的两种方法: admin@~ 11:14:29>echo '手机' | tr -d '\n' | xxd -plain ...

  3. javascript的缓动效果

    这部分对原先的缓动函数进行抽象化,并结合缓动公式进行强化.成品的效果非常惊人逆天.走过路过不要错过. 好了,打诨到此为止.普通的加速减速是难以让人满意的,为了实现弹簧等让人眼花缭乱的效果必须动用缓动公 ...

  4. Python之路----------迭代器

    直接用作于for循环的数据类型有以下几种: 1.集合类的数据类型:list tuple dict set str等 2.生成器generator,包括生成器和带有yiled 的generator fu ...

  5. PHP数组内容不重复组合排列算法

    最近在做ecshop的商品库存模块,分别给一款商品的多个属性组合设置库存,如下图: 一款手机有不同颜色,屏幕尺寸,系统和电量,都要设置不同的库存,如果都要手动选择属性组合,则会耗费很多不必要的时间.假 ...

  6. python引用py文件中文报错

    文件 a.py 中引用文件 b.py 如果文件b.py中包含中文,会报错. 文件hello.py中代码如下: def say_nihao(): print "你好" 文件main. ...

  7. 【转】Deadlock的一些总结(死锁分析及处理)

    1.1.1 摘要 在系统设计过程中,系统的稳定性.响应速度和读写速度至关重要,就像12306.cn那样,当然我们可以通过提高系统并发能力来提高系统性能总体性能,但在并发作用下也会出现一些问题,例如死锁 ...

  8. SLP的模块结构

    SLP的模块结构 在开发初期,拟将SLP分为5个模块: 基础练习模块 特定歌曲难点练习模块 玩家能力测试模块 全局设置模块 玩家信息模块 基础练习模块 这里提供可控类型.可控长度.可控BPM的练习套餐 ...

  9. rdesktop的使用

    整个地球都知道rdesktop,有了它,我们可以从Solaris或者Linux使用Windows,当然Windows要开启Windows Terminal Service.虽然也有基于GTK+的tsc ...

  10. vbs 中文字符串

    vbs 字符串包含中文字符,文件以UTF-8无BOM格式保存,就会出现“编译器错误: 未结束的字符串常量”错误,改以ANSI保存就没有这个问题