猫史档案馆


望给出攻击与回血代码感谢

用户:某只屑虎_一只小老虎_佛_本_修_禅_某只屑虎_一只小老虎_佛_本_修_禅_查看:1 回复:2 评论:1 创建时间:2020-08-13T11:46:30


望给出攻击与回血代码感谢

在这里

https://box3create.codemao.cn/games/0af4ae4a25df44eb3917

 


回复

上一页1 页 / 共 1下一页
SCS_user_i1eril0dUySCS_user_i1eril0dUy

挖)((

点赞0


评论


白云上的刺客白云上的刺客

  //一个简单的射击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 + ' 喵ed ' + entity.player.name)
    }
    entity.player.forceRespawn();
});
world.onPlayerJoin(async({entity})=>{
    while(!entity.player.dead){
        if(entity.hp < entity.maxHp){
            entity.hp+=10
            await sleep(5000)
        }else if(entity.hp >= entity.maxHp){
            entity.hp = entity.maxHp
        }
    }
})

网站无法打开,只能写在这了(有BUG跟我说)

点赞0


评论