When developing two-dimensional games, you will come across a problem that traditional animators have been facing since the development of the cartoon, which is the difficulty of providing their creations with depth and the sensation of motion.
The technique used by animators to solve this problem is the one known as parallax effect, which involves the separation of scenes onto different layers and moving the background ones slower than the layers in the foreground.
This is something that is similar to what happens when you are traveling in an automobile. If you look at one side, you will see trees on the edge of the road passing by swiftly. If you then look a little further at a static object, you will see that it moves slower than the trees. Furthermore, if you look at the horizon, you will see that mountains almost seem static.
By applying the parallax effect, we make our brain think that there is depth in the scene (we achieve a three-dimensional effect) and movement...