Handling user input (Must know)
This task will outline and demonstrate the necessary steps required to handle the keyboard input in order to move the player sprite around the canvas. This will be done by looking at how to handle different states of any given key on the keyboard and updating the players position each frame by modifying both the
ObjectManager objects in order to do so.
- To support keyboard input within our application, we firstly need to modify the player object to monitor the state of each key pressed as well as updating the position of the player in each frame.
- To begin with, we will outline a series of variables that will be used to determine the velocity of the player, that is, the direction and speed ...