1.ios退出游戏和android不同

Director::getInstance()->end();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    exit(0);
#endif

2.游戏卡顿?
1)大量的粒子同时播放,需要尽量减少同时播放的可能性;
2)每帧刷新的东西过多,使用逻辑判断,减少刷新数量;
3)内存泄漏;

3.加载加载csb动画

Node* aniPengNode = CSLoader::createNode("xxx.csb");
addChild(aniPengNode, 16);

cocostudio::timeline::ActionTimeline* action = CSLoader::createTimeline("xxx.csb");
action->gotoFrameAndPlay(0, false);//是否循环播放
aniPengNode->runAction(action);
aniPengNode->setPosition(Vec2(visibleSize.width / 2, visibleSize.height / 2));

action->setLastFrameCallFunc([=]() {
    this->removeChild(aniPengNode);
});

4.播放帧动画


    SpriteFrameCache::sharedSpriteFrameCache()->removeSpriteFrames();
    SpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("qiangzhuang_shing.plist");

    Animation* m_pAnimateShunzi = Animation::create();

    for (int i = 1; i < 22; i++)
    {
        SpriteFrame* pSpriteFrame = SpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(__String::createWithFormat("tx7_%d.png", i)->getCString());
        m_pAnimateShunzi->addSpriteFrame(pSpriteFrame);
    }
    m_pAnimateShunzi->setDelayPerUnit(1.5f / 13.0f);
    m_pAnimateShunzi->setRestoreOriginalFrame(false);
    CC_SAFE_RETAIN(m_pAnimateShunzi);


    Animate* m_pAniShunzi = Animate::create(m_pAnimateShunzi);
    Sprite* m_pSpriteShunzi = Sprite::create();
    m_pSpriteShunzi->setPosition(Vec2(200, 200));
    this->addChild(m_pSpriteShunzi);
    m_pSpriteShunzi->runAction(Sequence::create(
        Repeat::create(m_pAniShunzi, 2),//次数
        RemoveSelf::create(),
        NULL
    ));

5.生成android keystore

keytool -genkey -alias XXX -keyalg RSA -validity 20000 -keystore XXX.keystore

6.list、layout

View->setScrollBarEnabled(false);//隐藏滑动条
View->setBackGroundColorType(cocos2d::ui::Layout::BackGroundColorType::NONE);//设置背景填充颜色

7.androidP 系统集成时发现部分应用初次打开时提示此应用专为低版本Android打造问题解决
参考:https://blog.csdn.net/fuyunfengfan/article/details/88393106
修改方法:
app修改 android:targetSdkVersion 修改值为 17以上
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="28" />

8.cocosStudio中Node添加特性属性方法:
打开对应的csd文件,找到节点

ctype="SingleNodeObjectData"

改为

ctype="ProjectNodeObjectData"

点赞(0)

微信小程序

微信扫一扫体验

微信公众账号

微信扫一扫加关注

返回
顶部