Game Development Reference
In-Depth Information
The Gesture project
This project demonstrates the use of the s3ePointer API by showing the screen
coordinates pointed at by the user. If a multi-touch display is available, it will show
multiple touch points.
The project also demonstrates a simple approach for detecting swipes and pinches
and how it is possible to use the same gesture detection code with both single- and
multi-touch capable displays.
The Slide project
The Slide project shows how to use the s3eAccelerometer API to read the current
accelerometer values, apply a smoothing algorithm to them, and generate the angles
of tip around the X- and Y-axes.
It also demonstrates something a little more game-like by allowing you to move a
little red box around the screen by tipping the device.
The Skiing project
Our skiing game becomes interactive in this chapter, allowing you to rotate the
skier left and right and have him move across the screen and affect the speed of
scrolling. The skier can be controlled either by key presses and touch screen or
accelerometer input.
We also have more of a game-like flow with the addition of a title screen mode that
allows the input method to be selected, and a game over mode, which is triggered
when the player goes into the trees at the edge of the game world.
The following sections highlight some of the new classes added to the project.
Player rotation
Rotation of the player has been achieved by including a number of different
animation frames, each showing the player at a different angle of rotation. This
makes it easy to slot into our existing GameObject code, which expects to draw a
square image that is not rotated.
While this solution is very simple, it is perhaps not the best option. We could instead
have extended GameObject to support rotated images, which would have both
saved memory (we would not have needed to store all the extra animation frames)
and yielded smoother rotation results, as the skier currently steps between frames at
10-degree rotation increments.
 
Search WWH ::




Custom Search