Game Development Reference
In-Depth Information
Chapter 5. Tilting the World
We now have a game in place. The user can fly up and down the screen, shooting at
the enemies and destroying them for points. Barring some polish this could be con-
sidered complete; however, there are very many benefits that come with a Windows
Store app, so over the next few chapters we will take a look at some of them and con-
sider what we can use to improve our game and make it just a bit more unique.
Sensors such as the accelerometer , gyroscope , and GPS allow many new oppor-
tunities for games and applications in today's mobile world. By adding in GPS sup-
port you can give games the ability to know where the player is, enabling augmented
reality or location-based game design that enters new territory. Adding in orientation
sensors allows for richer input for games, and even new classes of games that take
advantage of the positioning of the device in newer ways.
Over the course of this chapter we will look at the different sensors available to you in
Windows 8, such as the following:
• Orientation
• Accelerometer
• Gyroscope (or gyrometer)
• Compass
• Inclinometer
We'll look at small code snippets to see how to access and use these sensors using
the WinRT libraries, and integrate the orientation sensors into our game as a new in-
put mechanism—allowing the players to tilt their devices to move their ships across
the screen.
Note
Before you begin, the event-based methods for accessing sensor and other
device readings may occur on a separate thread—if this is a potential issue for
your game, be sure to implement some form of synchronization.
Search WWH ::




Custom Search