Implementing the parallax effect in Cocos2d
The parallax effect is a scrolling technique used in 2D games that simulates depth and displacement by moving the foreground layers faster than background layers. This technique was developed initially to be used in traditional animation in the 1930s and was first used in computer games in the early 80s.
This effect consists of making our brain think that we are looking at displacement similar to what happens when we are traveling on a train: we can see the trees near the railway passing fast, but if we look to the houses placed further away, they pass a little slower, and if you look at the mountains in the background, they look almost immobile. If we place our scientist over a ground layer that will displace slowly and above this layer we scroll a clouds layer from the top to the bottom of the screen, our brain will think that Dr. Fringe is flying over the clouds thanks to his amazing backpack-reactor.
CCParallaxNode
As the parallax effect is a...