猫史档案馆


给大家看一看《黑暗森林》里面的代码

用户:梦之思梦之思查看:0 回复:2 评论:0 创建时间:2022-05-15T11:16:12


以下是代码: console.clear() constCSD=world.querySelector('#重生点-1') CSD.collides=true CSD.fixed=true CSD.onEntityContact(({other})=>{ other.hp=other.maxHp other.player.directMessage(`你恢复了所有的生命值`) }) constSWD=world.querySelector('#重生点-2') SWD.collides=true SWD.fixed=true SWD.onEntityContact(({other})=>{ other.hp=0 }) world.onPlayerJoin(async({entity})=>{ entity.player.enableDoubleJump=true constplayer=world.querySelectorAll('player').length world.say(`@${entity.player.name}进入了黑暗森林,现在地图内一共有${player}人`) entity.player.spawnPoint.set(Math.random()*126,15,Math.random()*126) entity.player.forceRespawn() constdialog=awaitentity.player.dialog({ type:Box3DialogType.TEXT, content:('你好,勇士,你代表一个文明进入了战斗地带,注意下面这段话:') }) constdialog2=awaitentity.player.dialog({ type:Box3DialogType.TEXT, content:('宇宙就是一座黑暗森林,每个文明都是带喵的猎人,他必须小心,不能喵自己的行踪。因为当一个文明发现另一个文明时,他能做的,只有一件事:喵消灭之') }) constdialog3=awaitentity.player.dialog({ type:Box3DialogType.TEXT, content:('请注意,不要喵自己的行踪,否则会有被击杀的危险') }) entity.enableDamage=true entity.enableInteract=true entity.interactRadius=9 }) world.onInteract(async({entity,targetEntity})=>{ if(entity.hp>0){ if(targetEntity.isPlayer){ targetEntity.hurt(10) awaitsleep(1000) } } }) world.onDie(async({entity})=>{ world.say(`@${entity.player.name}喵了`) awaitsleep(5000) entity.player.forceRespawn() }) world.onPlayerLeave(({entity})=>{ world.say(`@${entity.player.name}离开了黑暗森林`) }) world.onPlayerJoin(({entity})=>{ entity.player.addWearable({ bodyPart:Box3BodyPart.RIGHT_HAND, mesh:'mesh/喵[精美].vb', orientation:newBox3Quaternion(0,1,0,0).rotateY(Math.PI), offset:newBox3Vector3(-0.05,-0.1,0.5), scale:Box3Vector3=newBox3Vector3(0.3,0.3,0.3), }); console.clear() })


回复

上一页1 页 / 共 1下一页
梦之思梦之思

const Popularity = 100

点赞0


评论


YDS尹子YDS尹子

啊这

点赞1


评论