Game Development Reference
In-Depth Information
Illustration 18: Implementing the platformer input system and performing jump
What we have to do now is to make the camera follow the player character as it moves. Up
to now, it is possible that the character leaves the field of view of the camera, which will
make it invisible and make your game impossible to play. We can implement this function
in two different ways: the first and the easiest method is to add the camera as a child to the
character, so it follows the character as it moves horizontally and vertically. In this case, the
relative position of the character inside game window will remain constant. The second and
more advanced implementation (which we are going to use) is to write a script that allows
the camera to follow the character, and gives the player a sort of margin in which he can
move the character before the camera starts to follow it. This margin is going to be dynam-
ically modifiable.
Search WWH ::




Custom Search