O'Reilly logo

Cocos2d-x Game Development Essentials by Gareth Jones, Arutosh Gurung, Frahaan Hussain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding the Pause sprites

The only sprite that needs to be displayed in the Pause scene is the background. Add the following code below the menu code in the init() method within the PauseScene.cpp file, as we did in the previous section:

auto backgroundSprite = Sprite::create("PauseScreen/Pause_Background.png");

backgroundSprite->setPosition(Point((visibleSize.width / 2) + origin.x, (visibleSize.height / 2) + origin.y));

this->addChild(backgroundSprite, -1);

The GUI after adding the Pause sprites should look like what is shown in the following screenshot:

Adding the Pause sprites

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required