You don’t want to pause the node that you are trying to run an action on. So you don’t want to pause the scene if you are running the action on the scene. Pausing the director halts everything.
Depending on whether you use scheduleUpdate or actions or both you will probably have to pause all nodes that are children your scene, recursively, then run the action on your scene.
Other similar discussions:
- How to pause and resume my game?
- Ask node if it is active?
- Get all children from the Node
- Display pause menu before entering background?
- What's the proper way to implement pause screen?
// pause nodes
void Game::pauseNodeAndDescendants(Node *pNode)
{
pNode->pauseSchedulerAndActions();
for(const auto &child : pNode->getChildren())
{
this->pauseNodeAndDescendants(child);
}
}
// resume nodes
void Game::resumeNodeAndDescendants(Node *pNode)
{
pNode->resumeSchedulerAndActions();
for(const auto &child : pNode->getChildren())
{
this->resumeNodeAndDescendants(child);
}
}