Game Development Reference
In-Depth Information
Let's now write the script that controls the character. This script has several tasks to do:
firstly, it ensures the application of gravity by dragging the object towards the ground if
its y position is higher than the ground level. Secondly, it must not allow the character to
sink below the ground level. Finally, and most importantly, it should allow the player to
control the character by using keyboard keys. Listing 6 shows PlatformerControl script,
which performs all of the above-mentioned tasks.
Search WWH ::




Custom Search