cocos2d的场景之间传递音频 [英] Passing audio between scenes cocos2d

查看:184
本文介绍了cocos2d的场景之间传递音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚开始使用cocos2d的工作,到目前为止,香港专业教育学院设立了不同的场景,例如主菜单,设置和左右。香港专业教育学院增加了一些背景音乐到主菜单的场景,像这样:

Just started working with cocos2d, so far ive set up different scenes eg main menu, settings and about. Ive added some background music to the main menu scene like so:

    [[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"TileMap.caf"];

音乐贯穿于其他场景,但是当我回到主菜单现场的声音重新启动。

The music passes through to the other scenes, but when i go back to the main menu scene the sound restarts itself.

我只一直在做这3周左右,所以很容易对我道:)

I have only been doing this about 3 weeks now, so be easy on me :)

先谢谢了。

推荐答案

您应该检查的背景音乐正在摆弄 [SimpleAudioEngine sharedEngine] isBackgroundMusicPlaying] ,如果它目前只打了什么都不做,而不是调用的 playBackgroundMusic 在主菜单中的场景再次

you should check if background music is currently playing with [[SimpleAudioEngine sharedEngine] isBackgroundMusicPlaying], and if its currently playing just do nothing instead of calling playBackgroundMusic again in your main menu scene

这篇关于cocos2d的场景之间传递音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆