猫史档案馆


【实体的血量】

用户:牛升升魔王牛升升魔王查看:1 回复:2 评论:1 创建时间:2022-08-13T21:33:24


为何在编辑界面时,实体血量被扣为0时,会显示报错呢?哪位大神能解答一下(最好支支招)

代码如下:

 

{ const npc = world.querySelector('#门'); npc.enableInteract = true;   // 开启实体互动功能 npc.interactHint = '挡路的门';    // 进入互动范围时提示的文字 npc.interactColor = new Box3RGBColor(1,1,0); npc.interactRadius = 4;     // 互动范围大小




// 场景中所有可以互动的实体,互动时都会触发此事件 world.onInteract( ({entity, targetEntity}) => {     targetEntity.say( entity.player.name+'对门造成了5点伤害');     npc.hp -= 20  if (npc.hp <= 0) { 

 

    npc.destroyed = true

 

   }

 

}); }




回复

上一页1 页 / 共 1下一页
堂主の犬堂主の犬

因为你在编辑界面()()()

你去游玩界面就不会报错了()()()

点赞0


评论


堂主の犬堂主の犬

链接,我来帮你修()

点赞0


评论