0

Using `cocos2d-x, say I am on Scene 1 and I add a new scene (Scene 2), but I later pop that scene:

CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->popScene();

How do I know when Scene 1 has appeared again? Is there any sceneDidAppear method or something similar?

Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412

2 Answers2

1

CCScene is derived from CCNode, therefore you can override onEnter() and onExit() method to know when a scene is pushed or poped.

Vikas Patidar
  • 42,865
  • 22
  • 93
  • 106
  • But would I implement the `onEnter()` method in my class? I tried and I get the error "Out-of-line definition of onEnter does not match and declaration" – Nic Hubbard May 29 '14 at 21:03
1

Adding to @Vikas Patidar answear : you can override onEnterTransitionDidFinish() - this will fire after the transition animation is complete. Docs : link

Losiowaty
  • 7,911
  • 2
  • 32
  • 47