用户:
沐夏_IMuXia查看:0 回复:0 评论:0 创建时间:2020-04-29T19:51:16
world.say("hi,欢迎来到小镇之战")
sleep(5)
world.say("你可以在这里随便喵")
sleep(5)
world.say("还可以变成物体的样子")
sleep(8)
world.say("现在,尽情的打吧!")
//一个简单的射击PvP
world.onPlayerJoin(({ entity }) => {
entity.enableDamage = true;
entity.player.onPress(({ button, raycast:{ hitEntity, direction } }) => {
if (button !== 'action0' || !hitEntity) {
return;
}
hitEntity.velocity.x += direction.x;
hitEntity.velocity.y += 0.5;
hitEntity.velocity.z += direction.z;
hitEntity.hurt(20 * Math.random() + 5, {
attacker: entity,
});
});
});
world.onDie(({ entity, attacker }) => {
if (attacker) {
world.say(attacker.player.name + ' 击杀了 ' + entity.player.name)
}
entity.player.forceRespawn();
});world.onPlayerJoin(({ entity }) => {
entity.enableDamage = true;
entity.player.onPress(({ button, raycast:{ hitEntity, direction } }) => {
if (button !== 'action0' || !hitEntity) {
return;
}
hitEntity.hurt(2 * Math.random() + 1, {
attacker: entity,
});
});
});
//选中所有带有标签target的实体,并遍历循环.
world.querySelectorAll('.target').forEach((e)=>{
e.onEntityContact(({entity,other})=>{ //设置目标模型的碰撞事件。
if(!other.isPlayer){return} //防止非玩家实体参与检测。
other.mesh=entity.mesh; //设置玩家的外观。
other.meshScale=entity.meshScale; //设置玩家外观缩放比例。
other.player.invisible=true; //如果模型比玩家小,就需要隐藏玩家的皮肤。
})
})
undefined;
world.querySelectorAll('player').forEach((x) => {if (x.player.name == "cangshu") {x.say("指定说问问句")}});
function opgurpe(){
world.say("We go to the park? OK?")
while (true){
//Car To these{
}
}