开发者

How can I return from one scene to another on Cocos2D

开发者 https://www.devze.com 2023-01-05 11:24 出处:网络
I\'m trying to play a \"cut scene\" with cocos2d. I use: [[CCDirector sharedDirector] replaceScene:[CCCrossFadeTransition transitionWithDuration:0.2 scene:[s node]]];

I'm trying to play a "cut scene" with cocos2d. I use:

[[CCDirector sharedDirector] replaceScene:[CCCrossFadeTransition transitionWithDuration:0.2 scene:[s node]]];

to play the new scene.

However, i want to return to the previous screen when i'm done playing this cut scene开发者_Python百科.

Can anyone help me?


You can use pushScene: to switch to the new scene (instead of replaceScene:) and popScene to return to the previous one (so this works like a stack).

This will keep the old scene in memory, see also cocos2d Best Practices.

0

精彩评论

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

关注公众号