
Lv.1
QQ:3346223415
签名:我正在做‘原始枪战’这个可能会上首页但是没有联机可能需要花费好几天的时间希望大家可以喜欢!这个作品点赞过10更新,点赞过100开源全代码(或者收藏过50),这个作品我换了2次才可以的,球球了! (*╯3╰)把你们手上的赞都给我吧!点赞收藏过500或者关注我就把我的所有粉丝关注一遍!FQ不可能(╯▽╰)我的点赞不可能那么多我可能想多了……我现在长期在box3代码岛里玩所以我可能以后的作品会拖更的...
在 令人跑酷 代码 中回复
console.clear()
var Quat = new Box3Quaternion(0,0,0,1)
var w = 0
var x = 0
const COLOR = [new Box3RGBAColor(0,0,0,1),new Box3RGBAColor(1,1,1,1),new Box3RGBAColor(0.968,0.702,0.392,1)]
world.onPlayerJoin(async({ entity,tick }) => {
console.log(entity.player.url.searchParams)
user = entity.player.userKey
while(true){
await sleep(1000)
var w = Quat.w
var x = Quat.x
if(x >= 10){
x = 0
w += 1
}
x ++
Quat = new Box3Quaternion(w,x,0,0)
}
})
for(const e of world.querySelectorAll('*')){
if(e.id.startsWith('复活')){
e.collides = true
e.fixed = true
e.meshColor.set(0,1,0)
e.meshScale = e.meshScale.scale(2)
e.onEntityContact(({ other }) => {
if(other.isPlayer){
if(e.position !== other.player.spawnPoint){
other.player.directMessage(`存档成功!`)
other.player.spawnPoint = e.position
}
}
})
}
}
/* 按下左键时,在控制台输入记录 */
world.onPress(({ button, entity }) => {
if(button === 'action0'){
entity.player.directMessage(` ${entity.player.name} 按下了左键`);
}
})
world.onPlayerJoin(({ entity }) => {
entity.enableInteract = true
entity.interactRadius = 4
entity.interactHint = 'HP:100'
entity.interactColor.set(0,0,1)
entity.onInteract(({targetEntity,entity}) => {
targetEntity.player.forceRespawn()
TEXT(entity,`成功复活${entity.player.name}!`,false,'系统')
entity.hp += 10
})
entity.onTakeDamage(() => {
entity.interactHint = `HP:${entity.hp}`
})
entity.player.crouchButton = false
entity.enableDamage = true
entity.onVoxelSeparate(({ voxel }) => {
if(voxel === voxels.id('lava02')){
entity.hurt(5)
}
})
entity.onVoxelContact(async({ x,y,z,voxel }) => {
if(voxel===voxels.id('stripe_04')){
await sleep(2000)
voxels.setVoxel(x,y,z,'')
await sleep(2000)
voxels.setVoxel(x,y,z,'stripe_04')
}
})
entity.onFluidEnter(({voxel}) => {
if(voxel===voxels.id('water')){
entity.position.copy(entity.player.spawnPoint)
entity.position.y += 4
}
})
})
function TEXT(entity,content,hasArrow,title){
return entity.player.dialog({
type: Box3DialogType.TEXT,
contentTextColor: COLOR[1],
contentBackgroundColor: COLOR[2],
content,
titleTextColor: COLOR[1],
titleBackgroundColor: COLOR[3],
title,
hasArrow,
})
}
for(const s of world.querySelectorAll('.S')){
s.enableInteract = true
s.interactRadius = 4.5
s.interactHint = s.id
s.interactColor.set(1,0,0,1)
s.onInteract(({ entity }) => {
if(s.id === '告示牌'){
TEXT(entity,'后面的几关都是模型跑酷,小心哟!',undefined,s.id)
}else if(s.id === 'NPC'){
TEXT(entity,'不错,不错,你完成了1.6半跑酷!',undefined,s.id)
}else{
entity.player.sound('audio/goal.mp3')
TEXT(entity,'你成功了!奖励:飞行+穿墙+变色',undefined,s.id)
world.say(`${entity.player.name}用时${Quat.w}${Quat.x}秒`)
entity.player.canFly = true
entity.player.spectator = true
entity.player.color.set(1,0,1)
}
})
}
world.onDie(async({ entity,tick }) => {
if(entity.isPlayer){
TEXT(entity,'你喵了,15秒后显示复活选项',true,'阵亡')
for(var i=15;i>0;i-=1){
await sleep(1000)
entity.player.directMessage(`还剩${i}秒`)
}
const amount = await entity.player.dialog({
type: Box3DialogType.SELECT,
contentTextColor: COLOR[1],
contentBackgroundColor: COLOR[2],
content: '请选择复活选项(自行复活血量初始值为20)',
titleTextColor: COLOR[1],
titleBackgroundColor: COLOR[3],
title: '阵亡',
options: ['自行复活','等待支援'],
})
if(amount){
if(amount.index === 0){
TEXT(entity,'OK',true,'阵亡')
entity.player.forceRespawn()
entity.hp = 20
}
}
}
})
world.onPress(({ button,entity }) => {
if(button === Box3ButtonType.ACTION1){
TEXT(entity,`name:${entity.player.name},userKey:${entity.player.userKey}\nHP:${entity.hp}`,undefined,`${entity.player.name}的状态`)
}
})
world.onChat(({ entity,message }) => {
if(message === '复活'){
entity.position.copy(entity.player.spawnPoint)
entity.position.y += 4
entity.hp = 100
}
})
world.onPlayerJoin(({ entity }) => {
TEXT(entity,`嗨!\n${entity.player.name}\n这是一个小小的跑酷\n功能等你来探索!`,undefined,entity.player.name)
})
for(const v of world.querySelectorAll('.V')){
v.enableInteract = true
v.interactRadius = 6
v.interactColor = new Box3RGBAColor(0,1,0)
v.enableDamage = true
v.onDie(() => {
v.destroy()
})
v.onInteract(async({ entity }) => {
if(v.id === '密码门'){
const amount = await entity.player.dialog({
type: Box3DialogType.INPUT,
titleTextColor: COLOR[1],
titleBackgroundColor: COLOR[3],
title: '密码门',
contentTextColor: COLOR[1],
contentBackgroundColor: COLOR[2],
content: '输入密码(你可别告诉我你不知道密码)',
placeholder: '在此处输入密码',
})
if(amount){
if(Number(amount) === 148526){
v.hurt(20)
TEXT(entity,`密码正确,再输入正确密码${v.hp / 20}次`,undefined,v.id)
}else{
TEXT(entity,'密码错误',v.id)
}
}
}
if(v.id === '纸'){
TEXT(entity,'你发现了1张纸',true,v.id)
TEXT(entity,'上面写着:148526',v.id)
}
if(v.id === '小箱子'){
entity.hp *= 300
world.say(`${entity.player.name}触发了最后一关的苹果!`)
}
})
}
world.addCollisionFilter('player','player');
function bubble_sort(list){
var i,j,temp;
for(i=0;i<list.length - 1;i++){
for(j=0;j<list.length - 1 - i;j++){
if(list[j] > list[j+1]){
temp = list[j]
list[j] = list[j + 1]
list[j + 1] = temp
}
}
}
return list
}
bubble_sort([喵])
const pad = world.querySelector('#弹射跳板-1')
pad.onEntityContact(({ other, axis }) => {
if (axis.y === -1) { // 如果是往下踩
other.velocity.y = 2 // 设置玩家的瞬时y轴速度为2
}
})
world.onPlayerJoin(({ entity:e }) => {
e.onVoxelContact(async({x,y,z,voxel})=>{
if(voxel===voxels.id('A')){
voxels.setVoxel(x,y,z,'')
await sleep(1000)
voxels.setVoxel(x,y,z,'A')
}
})
})
//一个简单的射击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,
});
});
});2021-07-15T14:13:33 点赞:0
在 【岛3-API教程3!】用方块检测,做一片刀山火海🌋 中回复
function cylinder(cx,cy,cz,vox,radius,height){
var xend = cx+radius
var yend = cy+height
var zend = cz+radius
for(var x=cx-radius;x<=xend;x++){
for(var z=cz-radius;z<=zend;z++){
var dx = x-cx;
var dz = z-cz;
if(Math.round(Math.sqrt(dx*dx+dz*dz))<=radius){
for(var y=cy;y<yend;y++){
voxels.setVoxel(x,y,z,vox)
}
}
}
}
}
for(var i=0;i<300;i++){ // 300个随机圆柱体构成场景
let x = Math.random() * 125 // x坐标
let z = Math.random() * 125 // z坐标
let r = 2 + Math.random() * 5 //半径 2~7
let h = Math.random() * 4 // 高 0~4
cylinder(x,9,z,'lava02',r,h)
}2021-07-23T18:01:09 点赞:0
在 【每日一个岛3建图小技巧】可穿戴设备教程,给自己在地图里换个装吧! 中回复
https://web.kandian喵tpl/sharePage?kandianshare.html5.qq.com=1&_bid=4563&pgyid=2008&rowkey=61960d4aad9329bw&enc_u=+8Ok2j+MRIbGv7uNNE2npA==
2021-07-23T21:07:19 点赞:0