Scripting the player movement
The game so far features an environment with collision data and a multipart player object that interacts and responds to this environment. The player, however, cannot yet be controlled, and this section explores controller functionality further. The user will have two main input mechanics, namely, movement (walking left and right) and jumping. This input can be read seamlessly and easily using
CrossPlatformInputManager, which is a native Unity asset package. This package was imported at the project creation phase, but it can be imported now via the application menu with Assets | Import Package | CrossPlatformInput. Once imported, open the
Standard Assets |
Prefabs folder and drag and drop the ...