In this post, I will point out some techniques or difficulties I had to deal with:
- Scrolling: I used a personalized CCScrollView with Parralax effect. Scroll view had to be resizable (to create 3 distinct areas: left/middle/right). It had to use bounce or not, swipe effect (with decreased speed) or not (for camera mode). Gesture recognition was a problem with children's small and imprecise finger: they need to scroll and touch animals. So i had to deal with the speed of gesture and speed of scroll (if the scroll is near stopping, touching an animal is treated).
- Engine: our first idea was to integrate an editor to the game to allow children to create their own levels. So a level is an xml file that contains position and properties (z-order, mirror, size,…) of each item on scene (trees, grass, animals, walls…).
We used flash to generate this xml: we placed items on the main timeline, then we used actionscript to export the xml (and JSFL was used to reload it).
This engine had to deal with memory management and performance: a lot of items have to be simultaneously on scene: 30-40 animals, a lot of things like trees, grass, walls, vehicles… And all of this had to scroll fluently (the game run at 60 fps on Iphone 3GS in SD mode, 50 on Iphone 3G, 55 fps on Iphone 4/Ipad on HD mode). For older devices (3G), I made some optimizations (each animal have a big and a small sprite sheet to deal with memory problems, no parralax effect, less animals).
Tip: when an item is out of the visible area, just hide it (visible=no) to improve a lot scrolling performance! And stop individual animations during fast scrolling.
We couldn’t use CCSpriteBatchNode because each item has its own sprite sheet and its own z-order (a tree can be in front and behind an animal for example). - Level selection: use of CCBezier/CCEase action to achieve the rotating effect.
- Camera: use of CCRenderTexture to make and save screenshot. Zooming is made by changing scale factor on the underlaying CCScrollView.
- Jigsaw piece: use of CCRenderTexture with the complete image as texture and an image file as mask with blendFunction.
- Update of available content is made by uploading a zip file from our server (when wifi is on). No need to update the app via the AppStore when a new world is ready.
- Spoken instruction needs a lot of work: you have to deal with synchronization and temporization. So we used CDSoundSource to be informed of the end of a sound with a manager to play queued sound files and inform the delegate of the end of queue.
- Promote with Facebook: the idea was to promote our Facebook page by offering the “Animals of Africa” world to each user that become a fan. But the Facebook sdk for IOS doesn’t allow becoming a fan of a page. So we use Safari to open a page that allows becoming fan, then JavaScript and PHP to detect the action and finally a custom url scheme to go back to the game and allow downloading…
- In-app purchase: use of the MKStoreKit
- Push notification : use of easyApns scripts