Page Controller

After seeing the pages in @Rodolphe’s game In Churning Seas, I set out to create a similar effect.

The result is my page controller class, which allows as many pages as you want and even supports touches.

You pass it a set of pages, which can be one of three things: 1) a table with a draw and touched function 2) a class 3) just a function (assumed to be the draw function) There is an example of all three in the code

For touching, just have it return true if you are touching something on the page, otherwise it will still scroll

I’ve even included a function pBackground which is called the same as background, but draws a rect so that each page can have an individual background

Here is the code:

Some screenshots:

@Fakattak Wow! very polished, good job! I love the ripple and the dots.

@Jmv38, thanks! I just threw in the ripple effect to demonstrate that classes work with all their self variables and everything (plus it looks cool) :slight_smile:

drags and drops UIPageController onto storyboard in SpriteKit app :wink: But actually, very nice.