用户:
小宏XeLa查看:13261 回复:24 评论:25 创建时间:2023-06-18T18:11:15
world.onPlayerJoin(({ entity }) => {
entity.point = new GameVector3(0, 0, 0);
entity.player.onPress(({ raycast, button }) => {
if (button === "action0")
entity.point = raycast.voxelIndex.clone();
});
entity.player.enable3DCursor = true;
gui.init(entity, {
"panel": {
display: true,
data: `<dialog width="300" percentHeight="100" top="60" right="20" id="">
<group percentWidth="100" height="120" y="0">
<label text="玩家坐标" height="35" y="5" x="10" percentWidth="100" color="#fff" fontSize="20"></label>
<label text="" height="25" y="35" x="10" percentWidth="100" color="#fff" id="positionshowdx"></label>
<label text="" height="25" y="60" x="10" percentWidth="100" color="#fff" id="positionshowdy"></label>
<label text="" height="25" y="85" x="10" percentWidth="100" color="#fff" id="positionshowdz"></label>
</group>
<group percentWidth="100" height="120" y="130">
<label text="记录点坐标" height="35" y="5" x="10" percentWidth="100" color="#fff" fontSize="20"></label>
<label text="" height="25" y="35" x="10" percentWidth="100" color="#fff" id="pointshowx"></label>
<label text="" height="25" y="60" x="10" percentWidth="100" color="#fff" id="pointshowy"></label>
<label text="" height="25" y="85" x="10" percentWidth="100" color="#fff" id="pointshowz"></label>
</group>
</dialog>`
}
})
var recordY = entity.position.y;
world.onTick(() => {
var space = entity.position.y - recordY;
var isup = space > 0;
var isdown = space < 0;
var Ystatus = `${isdown ? "下降" : (isup ? "上升" : "")}中,变化幅度:`;
recordY = entity.position.y;
gui.setAttribute(entity, "#positionshowdx", "text", `X:${~~entity.position.x}`);
gui.setAttribute(entity, "#positionshowdy", "text", `Y:${~~entity.position.y}` + (Ystatus.length > 7 ? `(${Ystatus}${(space).toFixed(2)})` : ""));
gui.setAttribute(entity, "#positionshowdz", "text", `Z:${~~entity.position.z}`);
gui.setAttribute(entity, "#pointshowx", "text", `X:${~~entity.point.x}`);
gui.setAttribute(entity, "#pointshowy", "text", `Y:${~~entity.point.y}`);
gui.setAttribute(entity, "#pointshowz", "text", `Z:${~~entity.point.z}`);
gui.setAttribute(entity, "#flystatus", "text", `状态:${entity.player.canFly ? "启用" : "禁用"}`);
});
})
加一句:while(1){}
点赞0
评论
哇~您真是知识渊博啊~
哇~您真是知识渊博啊~
()()()
作者表示:你礼貌吗?
while(1){}会卡死()(
哇,您真是知识渊博啊~for(;;){}可以解决卡死的问题。
大家不要听作者的,他的代码会卡死,for(;;){}可以解决卡死的问题
for(;;){}是卡死上+卡死 [doge]
[doge]
温馨提示:这是xml
点赞1
评论
为什么我在岛三见到了xml(
我是已经落后时代了吗???新编辑器支持xml和html?
只支持xml
很好上手的()只要有示例就可以当API用的那种)
你死哪里去了?(复古2个月前的话)
6()