O'Reilly logo

Mastering Cocos2d Game Development by Alex Ogorek

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

Slide transition

Although it's fine for testing purposes, instant transitions between our scenes (as well as the game suddenly showing up when it first loads) are bad. We're going to add a nice quick slide between each scene. In other words, when the user taps a button or an event happens that's supposed to replace the scene with a new scene, we're going to make it seem as if all the scenes are on one giant white sheet, just out of view of the user.

Creating a generic slide function

Since we're going to be doing this all over the place, we need a function that's generic enough for us to pass to it any scene from any location, and it will do exactly what we want it to do.

So again, since MainScene.h is imported everywhere, we're going to create our ...

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