【问题标题】:Pause the particular scene in cocos2d-x暂停 cocos2d-x 中的特定场景
【发布时间】:2014-07-07 09:05:43
【问题描述】:

我正在使用 cocos2d-x 开发游戏。当用户按下暂停按钮时,我想暂停特定场景。

谢谢。

【问题讨论】:

    标签: c++ xcode cocos2d-x


    【解决方案1】:

    您可以通过两种不同的方式暂停特定场景

    1.) 使用CCDirector::sharedDirector()->stopAnimation(); 暂停,使用CCDirector::sharedDirector()->startAnimation(); 继续。

    2.) 使用CCDirector::sharedDirector()->pause(); 暂停并 CCDirector::sharedDirector()->resume(); 继续。

    【讨论】:

    • Backgrounmusic 没有播放。当我按下keyMenuClicked 它将暂停并重新启动,背景音乐没有播放。我在 appdelegate.cpp CocosDenshion::SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); 中使用以下代码CocosDenshion::SimpleAudioEngine::sharedEngine()->resumeeBackgroundMusic();
    • 这里我也尝试过同样的方法,但它对我来说效果很好......在简历中请添加这段代码 CocosDenshion::SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(10);试一试
    • 我需要在哪里使用,在applicationdidenterforeground中。
    • 测试恢复背景音乐的音量
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多