Giter VIP home page Giter VIP logo

cocoscreator-q-a's Introduction

Creator微信小游戏开发问题收集整理

Q: 微信锁屏后卡死的问题

引擎代码中找到下面代码,并屏蔽掉,可以解决微信锁屏后卡死的问题
//opts["preserveDrawingBuffer"] = true;

Q: Sprite的filled模式出问题了?

在图集中禁用旋转
http://forum.cocos.com/t/sprite-filled/43661
补充:物理引擎生成多边形刚体时,也要禁止旋转

Q: 微信小游戏中超越好友出现不显示的问题?

wx.getFriendCloudStorage不能频繁调用,可以在游戏一开始调用一次,然后在游戏中直接用就可以了

Q: 图片加载

        this.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(cc.url.raw('resources/texture/icon-libao.png'));

        // 加载本地图片 SpriteFrame
        cc.loader.loadRes("texture/maxscore.png", cc.SpriteFrame, function (err, spriteFrame) {
            self.moreGame.spriteFrame = spriteFrame;
        });

    // 加载远程图片
        let self = this;
        let remoteUrl = Global.linkGames[this.linkGameIndex].linkImage;
        cc.loader.load(remoteUrl, function (err, texture) {
            self.moreGame.spriteFrame = new cc.SpriteFrame(texture);
        });

Q: ip定位

// 判断分享模式
getLocation: function () {
    let self = this;
    this.sendHttpRequest('http://api.map.baidu.com/location/ip?ak=ia6HfFL660Bvh43exmH9LrI6', (xhr) => {
        console.log('getIp', xhr);
        let data = JSON.parse(xhr.responseText);
        console.log('data ', data);
        console.log('获取的具体位置:', data.content.address_detail.province + "," + data.content.address_detail.city);
    }, (error) => {
        console.log('error', error);
    })
},

Q: 定制js引擎gulp build失败?

CLI version 3.9.1
Local version 3.9.1
这两个版本一定要一致

Q: A星寻路算法在cocoscreator里的用法?

首先选择JS版本的实现,也可以自己写,但是效率不一定高。
我找的JS版本的A星算法参考:https://github.com/bgrins/javascript-astar
在creator里选择作为插件导入js文件,即可使用。

Q: 2.0.9版本构建ios项目成功后,编译失败?

错误提示:tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
解决办法:因为mac中多个xcode存在,被重命名了

cocoscreator-q-a's People

Contributors

ray1024 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.