用户:
0ttB查看:5 回复:6 评论:5 创建时间:2021-06-05T19:53:03
岩浆方块为lava01
world.onPlayerJoin(({ entity }) => {
entity.enableDamage = true
entity.onVoxelContact(({ voxel, entity }) => {
if (voxel === 465) {
entity.hurt(100)
}
})
}
岩浆方块为lava02
world.onPlayerJoin(({ entity }) => {
entity.enableDamage = true
entity.onVoxelContact(({ voxel, entity }) => {
if (voxel === 467) {
entity.hurt(100)
}
})
})
复活
world.onDie(({ entity }) => {
entity.hp = entity.maxHp
})
async_function把if(voxel==465)改成if(voxel==voxels.id('lava01'))
if(voxel==467)改成if(voxel==voxels.id('lava02'))试试
点赞1
评论
七式草莓解决代码(都有了):
world.onPlayerJoin(({ entity }) => {
entity.enableDamage = true
})
world.onVoxelContact(({ voxel, entity }) => {
if (voxel == voxels.id('lava01')) {
entity.hurt(entity.maxHp)
}
if (voxel == voxels.id('lava02')) {
entity.hurt(entity.maxHp)
}
})
world.onDie(({ entity }) => {
entity.hp = entity.maxHp
entity.forceRespawn()
})
问题信息:
1.第一个末尾缺了“)”
2.如果玩家最大生命值超过了100就不能被击杀
3.方块id可能错了
4.你喵了就复活,没有音效,没有提示,没有强制重生,也没有等待,当然谁都不知道了
点赞1
评论
world.onPlayerJoin(({ entity }) => {
entity.enableDamage = true
})
world.onVoxelContact(({ voxel, entity }) => {
if (voxel == voxels.id('lava01')) {
entity.hurt(entity.maxHp)
}
if (voxel == voxels.id('lava02')) {
entity.hurt(entity.maxHp)
}
})
world.onDie(async ({ entity }) => {
await sleep(3000)
entity.hp = entity.maxHp //复活
})点赞0
评论
Vernier这个应该更好:
for (const e of world.querySelectorAll('*')) {
if (e.id.startsWith('存档点')) {
e.onEntityContact(({ other }) => {
if (other.isPlayer) {
other.player.directMessage('已存档')
other.player.spawnPoint = e.position
}
})
}
}
world.onPlayerJoin(({ entity }) => {
world.onVoxelContact(({ voxel, entity }) => {
if (voxel == voxels.id('lava01')) {
entity.position.copy(entity.player.spawnPoint)
entity.position.y += 4
})
})
}) 点赞0
评论