roloenusa
roloenusa

Reputation: 11

How can I return from one scene to another on Cocos2D

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.

Can anyone help me?

Upvotes: 1

Views: 585

Answers (1)

Felix Kling
Felix Kling

Reputation: 817208

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.

Upvotes: 5

Related Questions