Functional effects show
Operating Environment
Win7,Win8,Win10
Reworld version trial version
vc_redist.x64 operating environment
For zero-based supplementary readers
Download and install the corresponding version Reworld
Reworld official website link : http://www.reworlder.com/
Creator of Reworld 'Forum: http://bbs.reworlder.com
After you install after downloading registered account open air map
Download and install vc_redist.x64.rar operating environment
Ideas analysis
Want to achieve brand features bright, first of all we need a trigger event, the hero league, Ctrl + 6 can reveal their own brand, Ctrl + 6 is a trigger event. In the restart World Editor, we can create a button control as a taunt, click the button to trigger the bright brand features. In addition, we also need to make your own brand icon, is making a 3D billboard container, create an image control in 3D billboard container, the icon will import our mocking it.
Function building
First, the process of building icons
First, we need a workspace created in a 3D billboard container , rename LaughUI. In 3D billboard container to create an image under control, we import the downloaded a brand icon. As shown below:
Second, sarcasm skills build process
1.在界面初始化下创建一个2D容器界面,重命名为LaughPanel,在2D容器界面下创建一个按钮控件,重命名为LaughBtn,在按钮控件创建一个文本控件,调整大小和位置。如下图所示:
2.在按钮控件下创建一个客户端脚本。如下图所示:
编写客户端脚本如下:
local btn=script.Parent
btn.OnClick:Connect(function()
MessageEvent.FireServer("嘲讽") --向服务器发送消息
end)
三、服务器脚本搭建过程
在服务器逻辑下创建一个服务器脚本。如下图所示:
编写服务器脚本如下:
local LaughUI = WorkSpace.LaughUI --嘲讽
local Yset = 0
local Sset = 0.1
local isUp = false
local isdown = false
Players.PlayerAdded:Connect(function(Uid) --玩家进入游戏时执行创建零件的方法
hero = Players:GetPlayerByUserId(Uid)--获取玩家实体
hero.AvatarAdded:Connect(function(avatar) -- 角色被加载事件
print(avatar.Name)
MessageEvent.ServerEventCallBack("嘲讽"):Connect(function()
isUp = true
LaughUI.图像控件.IsVisable = true
coroutine.start(function()
coroutine.wait(3.5)
isUp = false
isdown = true
end)
end)
--嘲讽UI跟随人物并实现动态效果
function follow()
if isUp and LaughUI.WorldSpaceOffset.y <2 then
Yset = Yset + 0.007
Sset = Sset + 0.0017
end
if isdown and LaughUI.WorldSpaceOffset.y > 1 then
Yset = Yset - 0.007
Sset = Sset - 0.0017
elseif LaughUI.WorldSpaceOffset.y < 1 and isUp == false then
isdown = false
LaughUI.图像控件.IsVisable = false
end
LaughUI.图像控件.LocalScale = Vector3.New(Sset,Sset,Sset)
LaughUI.WorldSpaceOffset = Vector3.New(hero.Avatar.Position.x,hero.Avatar.Position.y+Yset,hero.Avatar.Position.z)
end
GameRun.Update:Connect(function()
follow()
end)
--嘲讽技能回调
end)
end)
补充说明
1.什么是工作区?
工作区中的对象是会被可视化显示到3D场景中的,并且只有在工作区中的对象才会发生物理交互。
2.什么是服务器脚本?
只会在服务器运行的Lua脚本代码,用于编写服务器逻辑。
3.什么是客户端脚本?
只会在客户端执行的脚本,执行的逻辑和表现也只会在本地客户端展现;可在以下几个文件目录下自动执行,客户端脚本在“工作区”下不会自动执行,需要放在以下对象里面:
1. 客户端最先加载 。
2. 工作区中的角色模型。玩家初始化中的角色初始化脚本,在运行后会自动移动到角色模型下。
3. 玩家列表中的玩家。玩家初始化中的玩家初始化脚本,在运行后会自动移动到玩家下
4. 玩家的玩家界面。界面初始化的脚本,在运行后会自动移动到玩家界面下。
5. 玩家的背包,例如工具里面的。
4.什么是2D容器界面?
2D容器界面是显示在玩家屏幕上的2DUI对象的主要存储对象。UI对象若要显示在编辑器中,必须作为容器控件的子级。
游戏运行后,存放在界面初始化StarterUI下的界面会复制到玩家界面下,只有在玩家界面GameUI下的界面才能在游戏中显示。
5.什么是按钮控件?
按钮控件用于响应来自用户的事件,经常用于启动或者确认某项操作使用。
6什么是文本控件?
文本控件显示非交互文本,经常用于标题或者标签使用。
好了,接下来我们开始游戏,点击嘲讽这个按钮,我们控制的角色头上就会出现我们预先设定好的嘲讽图片啦。如果有什么问题或者有更好的实现方式,大家可以在下方积极交流讨论,我们也会参与进来和大家一起分享经验,期望能和大家共同进步~~