Game Development Reference
In-Depth Information
2.2 Implementing platformer input system
Platformer games are probably the most famous 2D games available, and they also have
some known titles among 3D games as well. Games such as Super Mario and Castlevania
belong to this category of games, in addition to known modern game titles such as Braid ,
FEZ , and Super Meat Boy . These games depend primarily on jump mechanic to move
between platforms, defeat enemies, and solve puzzles. They might also have other mechan-
ics such as shooting.
Since we are now able to read user input from the keyboard, we can make a basic input
system based on the arrow keys for movement and space bar for jumping. Since we have
not yet learned how to detect collisions between objects, we are not able to find out wheth-
er the player character is currently standing on a platform or it should fall down. Therefore,
we are going to consider that the character is standing on the ground as long as its position
has specific y value.
In the previous example, we have seen how to implement movement to right and left. So, we
are going now to implement the desired system to have gravity, and hence jumping and fall-
ing. We need also that the camera follows the player character as this character moves. Before
starting to write the platformer input system scripts, we have to construct a basic scene to
implement our work in it. Build a scene that is similar to Illustration 17 by making use of ba-
sic shapes, relations between objects, and appropriate textures. Notice that I have used Quad
basic shape to make the 2D player character.
Search WWH ::




Custom Search