Cocos2d-x has transition effects for pushing a scene. For some reason, it does not have transition effects for popping scenes. We'd like to transition with an effect for popping scenes after pushing scenes with effects. In this recipe, we will explain how to create an original transition for popping scenes.
In this recipe, you will understand how to pop a transition scene with effects. You will need a new class, so you have to make new class files called DirectorEx.h
and DirectorEx.cpp
and add them to your project.
Cocos2d-x has a transition scene with effects for pushing scenes. However, it does not have transition effects for popping scenes. Therefore, we create an original class called DirectorEx
to create a transition effect for popping scenes. The code snippet is given next.
DirectorEx.h
has the following code:
class DirectorEx : public Director { public: Scene* previousScene(void); void popScene(Scene* trans...