当前位置:网站首页>08_ue4进阶_开始结束暂停菜单等ui
08_ue4进阶_开始结束暂停菜单等ui
2022-07-26 19:57:00 【无情的阅读机器】
在进度条上附上数字,来显示值
拖一个文本块放在相应的位置,并改变锚点

创建文本的绑定(这个我已经创建好,并重命名了)

绑定函数内容

编译,效果

同理显示当前的hp值

同理显示mp值

其中还要修复一个bug,就是我们要一直检测血量是否减为负值。
在damage事件中,修改,recent-damage>0,true就是将结果赋值给recent,false就是将recent直接设为0.

新增需求:当角色的血变成0,我们希望游戏暂停或者结束。
所以用0设置hprecent时,我们希望让游戏暂停。

这种暂停效果太僵硬了。
我们需要先让玩家失去控制权,几秒钟后再冻结屏幕。
当hp为0,人物的速度和转速都成立0,0.2s之后,游戏暂停(后期会加上倒地动画)

增加需求:游戏暂停之后增加一个ui,显示gameover
创建ui控件蓝图

拉入一个border,调整位置和锚点
设置border 的背景


放入一个文本,写gameover,调整一下字体大小

放入一个按钮

给按钮拖入一个文本,内容为退出游戏
为按钮创建功能
添加按钮的点击事件



游戏暂停后启动ui

虽然出现了这个ui,但是我们并没有获得鼠标的控制权。现在获得控制权。
测试成功。
现在实现游戏暂停ui

继续游戏键添加事件

点击之后,消除所有的ui控件,然后显示hp和mp的ui,然后继续游戏,游戏控制权由鼠标变到游戏角色。

按p键,生成暂停游戏ui,并得到鼠标的控制

测试成功。
------------------------------------------------------------------------------------------------------------------------------
游戏的开始菜单
方案1:打开游戏,就显示开始游戏菜单,然后点击开始游戏进入游戏。
缺点:当我们点击exe,就要立即加载整个主地图,地图越大,加载速度会越慢。如果地图很大,会黑屏很长事件,才能看到我们的开始菜单。
方案2:先加载一个小关卡,然后点击开始游戏,进入主关卡。
首先新建一个游戏关卡。

重命名为start_menu,这是一个完全空白的地图。

创建开始菜单ui蓝图

开始游戏按钮的点击事件为

双击进入start_menu关卡,然后打开关卡蓝图,进行编辑。

关卡启动时,开始菜单生成。

运行该关卡,发现hpbar的ui已经运行了
这是因为该关卡虽然什么都没有,但是默认加载了小白人。
小白人的游戏开始事件创建了hpbar。

所以,我们将创建hpbar的代码放到主关卡蓝图里面。

测试成功。
边栏推荐
- Bean注入和生命周期
- Centos7 about Oracle RAC 11gr2 deployment disk partition
- Installation and configuration of [basic services] [database] Clickhouse
- Leetcode-300 longest increasing subsequence
- Kotlin - 协程构建器 CoroutineBuilder
- 查询字段较多时可以添加普通查询和高级查询两种情况
- 81. (cesium home) cesium modifies the gray background (default blue)
- NVIDIA canvas first experience~
- [Delphi] different platform descriptions of borderstyles of FMX form
- The UK and Germany have successively launched 5g commercial services, and Huawei has become a behind the scenes hero
猜你喜欢

Task 1 report

BGP--边界网关协议

Houdini notes 2

Experiment 6 BGP federal comprehensive experiment

深度可分离卷积(DepthwiseSeparableConvolution):Depthwise卷积与Pointwise卷积

QT driving school subject examination system -- from implementation to release

软件测试-开发提测内容规范(项目提测模板)

Quick start to connection pooling

Easy gene | introduction to macrovirus sequencing technology

Summary of message queue knowledge points
随机推荐
营销与销售文件管理以及工作流程解决方案
[基础服务] [数据库] ClickHouse的安装和配置
Keepalived high availability introduction and configuration details
Centos7 about Oracle RAC 11gr2 deployment disk partition
Depthwiseseparableconvolution: depthwise convolution and pointwise convolution
Nmap installation and use
Correct the classpath of your application so that it contains compatible versions of the classes com
Bean injection and lifecycle
[wechat applet] zero basics | applet syntax
Buu brush inscription - WANGDING cup column 2
App uploader download and installation
tkinter使用wpf控件
培训软件测试能不能就业
Gartner released the latest market guide for Chinese AI start-ups, and Hongji cyclone was once again rated as a representative enterprise
Shell函数、系统函数、basename [string / pathname] [suffix] 可以理解为取路径里的文件名称 、dirname 文件绝对路径、自定义函数
Kotlin - 协程上下文 CoroutineContext
81. (cesium home) cesium modifies the gray background (default blue)
confd+etcd实现高可用自动发现
执行上下文与词法环境
BGP的路由黑洞和防环