Game Development Reference
In-Depth Information
It also would be possible to extend this system further so that arbitrary functions
could be mapped to the bindings, perhaps with the option of either registering
through the UI or the game. But in the particular case of the tower defense game,
doing so would be an example of over-architecting a system. If it's not really ne-
cessary for a game to have so much flexibility, there's no reason to add further
complication to the code for the input manager.
Mobile Input
Most smartphones and tablets have input mechanisms that differ from the tradi-
tional keyboard, mouse, or controller. Because of this, it is fitting to have a section
focused on the input varieties typically encountered on mobile devices.
Note that simply because amobile device hasalargenumber ofinput options at its
disposal does not mean that most games should use them. Mobile games must be
very careful not to have an overly complex control scheme, which may turn away
potential players.
Touch Screens and Gestures
Touch screens enable players to interact with the device's screen using their fin-
gers. At a basic level, if only single finger tapping is allowed in the game, it could
be implemented in the same manner as mouse clicking. However, most touch
devices support the idea of multi-touch , which means multiple fingers can be act-
ive on the screen at the same time.
Some mobile games use multi-touch to implement a virtual controller , which has
a virtual joystick and virtual buttons that the player can interact with. This is es-
pecially popular for mobile games that are a version of an existing console game,
but it can sometimes be a frustrating experience for the player because a virtual
controller doesn't have the same tactile feedback as an actual controller.
Something that can only be done with a touch screen, though, is a gesture , which
is a series of touch actions that cause a specific behavior. An example of a gesture
would be the very popular “pinch-to-zoom” on iOS devices, where the user can
pinch her index finger and thumb together to zoom in, or pull them apart to zoom
out.
Thankfully, both the iOS and Android SDKs provide ways to easily detect system-
supplied gestures, including pinch-to-zoom. In iOS, there is a set of classes that
inherits from UIGestureRecognizer , and a function to handle said gestures
Search WWH ::




Custom Search