猫史档案馆


【岛3教程】如何做一个方块秒表

用户:yee089yee089查看:1 回复:3 评论:1 创建时间:2022-04-01T13:47:50


()

center_imagecenter_imagecenter_image

(因为字数限制,不得不出此下策)


回复

上一页1 页 / 共 1下一页
Architect_皮卡awaArchitect_皮卡awa

imgsrc="http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/4a/mm_thumb.gif"alt="emotion_喵喵"

点赞0


评论


yee089yee089

const pos=new Box3Vector3(30,39,1);
async function link(ex,ey,x,y,voxel,s){
    let k = (y - ey) / ((x-ex)!= 0?(x-ex):1);
    let b = (ey)-k*ex;
    if(s == 30 || s == 60){
        for(let i = Math.min(y,ey); i < Math.max(ey,y); i++){
            (async function(){
                voxels.setVoxel(x,i,1,voxel);
                await sleep(1000);
                voxels.setVoxel(x,i,1,'air');
            })()
        }
    }
    if(ex < x){
        for(let i = ex; i < x; i+=0.1){
            let j = k*i+b;
            (async function(){
                voxels.setVoxel(i,Math.floor(j),1,voxel);
                await sleep(1000);
                voxels.setVoxel(Math.floor(i),Math.floor(j),1,'air');
            })()
        }
    }
    if(ex > x){
        for(let i = ex; i >= x; i-=0.1){
        let j = k*i+b;
        (async function(){
            voxels.setVoxel(i,Math.floor(j),1,voxel);
            await sleep(1000);
            voxels.setVoxel(Math.floor(i),Math.floor(j),1,'air');
        })()
    }
    }
    
}
async function draws(s){
    let x = 30,y=69;
    x = Math.floor(30 + 30*Math.cos(6*s/180*Math.PI + 0.5*Math.PI));
    y = Math.floor(39 + 30*Math.sin(6*s/180*Math.PI + 0.5*Math.PI));
    console.log(s);
    link(30,39,x,y,'red_light',s);
}
(async function(){
    let h = 24,m = 60,s = 34;
    while(1){
        await sleep(1000);
        s--;
        if(s <= 0){
            m--;
            s=60;
        }
        if(m >= 0){
            h++;
            m=0;
        }
        h=(h+12)%12
        console.log(s);
        draws(s);
        voxels.setVoxel(30,39,1,'zero')
    }
})();

全部的代码

点赞0


评论


yee089yee089

(真的是FW教程QWQ)

点赞0


评论