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.
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 generic function in it. Open MainScene.h
and add this enumeration above the @interface
line:
NS_ENUM(NSInteger, kMoveDirection) { kMoveDirectionUp, kMoveDirectionDown, kMoveDirectionLeft, kMoveDirectionRight }; @interface MainScene :CCScene...