Game Development Reference
In-Depth Information
Figure 9-13 . Mouse-over the import EventHandler warning highlight, and display the pop-up “Unused Import”
warning
Next, let's add the traditional ASDW game play key event handling, to give our
users an option to use those keys or to use two hands for their game play! This will
show you how to add alternate key mapping support to your existing event handling
code, using only a few more lines of code in the highly efficient switch-case statement.
Adding Alternate KeyEvent Mapping:
Using A-S-D-W
Now that we have these KeyEvent handling structures in place, let's take a look at how
easy it is to add an alternate key mapping to the ASDW keys often used for game play.
This is done by adding in a few more case statements for the A, S, D, and W characters
on the keyboard, and setting them to the UP, DOWN, LEFT, and RIGHT Boolean equi-
valents that we have set up already. This will allow users to use the A and D characters
with their left hand and the UP and DOWN arrows with their right hand for easier
game play, for instance.
 
Search WWH ::




Custom Search