猫史档案馆


【给初学者看的JavaScript-第二期】第二章 · 基元类型 · 第一小节:Number

用户:NomenNomen查看:8 回复:8 评论:8 创建时间:2023-07-29T12:40:10


center_image

 


回复

上一页1 页 / 共 1下一页
NomenNomen

照例沙发

点赞0


评论


稳重的超能鸭KLY稳重的超能鸭KLY

肝帝

点赞0


评论


稳重的超能鸭KLY稳重的超能鸭KLY

const p_first = world.querySelector('#弹跳板-1')
p_first.onEntityContact(({ other, axis }) => {
       if (axis.y === -1) { 
        other.velocity.y =5 
    }
})
const p_Second = world.querySelector('#弹跳板-2')
p_Second.onEntityContact(({ other, axis }) => {
       if (axis.y === -1) { 
        other.velocity.y =5 
    }
})

这个怎么优化啊大佬?

点赞0


评论


NomenNomen

const ps = ['#弹跳板-1', '#弹跳板-2'];
ps.forEach(e => {
    world.querySelector(e).onEntityContact(({ other, axis }) => {
        if (axis.y === -1) {
            other.velocity.y = 5
        }
    })
})

点赞0


评论


囧仙_official囧仙_official

话说BigInt算不算整型(?)

点赞0


评论


稳重的超能鸭KLY稳重的超能鸭KLY

所以parseInt就是将非数值形式转成数值形式吗?

点赞0


评论


SCS_user_LoeheodVOQSCS_user_LoeheodVOQ

developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Number

点赞0


评论


稳重的超能鸭KLY稳重的超能鸭KLY

Nomen大佬,这个教程还会继续出吗?(催更,催更)太赞了,比开发API详细多了,并且更模块化了

点赞0


评论