开发者

sound is freezing the cocos2d/box2d scene

开发者 https://www.devze.com 2023-03-17 14:52 出处:网络
my contact listener should play a sound when it feels hit, but if i开发者_运维知识库 put this line on the detection part of the listener in my tick method like this:

my contact listener should play a sound when it feels hit, but if i开发者_运维知识库 put this line on the detection part of the listener in my tick method like this :

[[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"boom.m4a"];

the scene is freezing on start for 1 sec, and then all the forces that should be applied on start are gone,and all balls fall down to earth because of gravity, what would not happen if were no freezing,because they have initial impulse that turned off due to freezing..

why my sound freeze the scene ? how can i pre-loading main game effects before the game starts ??

thanks


Looks like you are not using fixed time step when updating b2World. To preload background music use preloadSoundEffect method of SimpleAudioEngine.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号