Creator使用遇到的问题总结

Creator使用遇到的问题总结

tips1:js的数值格式是浮点数,对数值的操作次数过多或者使用convertToWorldSpace等方法,需要Math.ceil一下。否则会导致数据的偏差越来越大,运气好的可以正负抵消哦!祝你好运

Tips2:简单记录下跳转scene的进度条使用

              cc.director.preloadScene(“scene名字”,

        function (completedCount, totalCount, item) {

            var pShow = (completedCount / totalCount).toFixed(2);

            cc.log("onProgress completedCount = "+completedCount+",totalCount="+totalCount+",pShow="+pShow+",item="+item);

            if(item){

                cc.log("onProgress dothis");

                //设置进度条的进度;

            }

        },function () {

            cc.log("go scene do");

            cc.director.loadScene("scene名字");

        });

Tips3:js中的if语句的判断 if(0)返回的是false

Tips4:使用物理引擎需要注意,物理的刚体所在的node不会跟随父node的移动而移动。如果可以的话,直接使用碰转系统不会存在这个问题

 

Tips5:https://blog.csdn.net/zzx023/article/details/85318028,creator 加载优化,挺好的文章

Tips6:spine动画自定义事件的监听

     this.cardSke.setEventListener((trackIndex,event)=> {
                cc.log("setEventListener >>>>>>>", trackIndex, event.data.name);
                if(event.data.name == "事件名"){
                    //操作
                }
     });

Tips7:按钮下图片的状态设置问题(注意这边的调用顺序)

   this.btn.getComponent(cc.Button).interactable = true;//回重置按钮的图片状态
   this.btn.getComponent(cc.Sprite).setState(0);//设置灰显0或者1

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值