
Lv.1
如果让我重来那个号我一定创造奇迹
在 边跑边掉体力的代码 中回复
world.onPlayerJoin(({ entity }) =>{
let j=0
entity.player.runSpeed =100000
//可自调
world.onPress(({button})=>{
if(button=='action0'||button=='action1')return
j++
if(j>=1000){//可自调
entity.player.runSpeed =1
entity.player.runSpeed =false
let a = async function () {
await sleep(1000)
j++
}
}
})
})2023-05-21T14:17:39 点赞:0
在 【代码求助】如何制作循环动画 中回复
算了我直接给你发代码APl
有个代码是
iterations: Infinity,//无限循环
接着改进就成了
const elevator = world.querySelector('#冰雪公告牌') //获取电梯板实体
elevator.fixed = true //不可推移
elevator.collides = true //可碰撞
const pos = elevator.position//电梯板原本的位置
const ani = elevator.animate([// 1+5+1+2=9, 总时间被切成9份
{ position: pos, duration: 1 },// 1/9 的时间停留在地面
{ position: pos, duration: 0 },// 5/9 的时间用于地面往楼顶移动
{ position: pos.a喵({ x: 0, y: 1 , z: 0 }), duration: 1 },// 1/9 的时间停留在楼顶
{ position: pos.a喵({ x: 0, y: 2, z: 0 }), duration: 2 },// 2/9 的时间从楼顶回到地面
], {
duration: 16 * 9, //播放一个循环共用时9秒(系统默认每秒16帧)
iterations: Infinity,//无限循环
direction: Box3AnimationDirection.WRAP,//让动画实体从终点回到起点
})
2023-05-25T19:51:10 点赞:1