This chapter was previously labelled as "NUI Chapter 16.6".
It's game time! I'll be reusing the hand tracking code of the previous chapter as the user interface for a simple version of the classic Breakout game. Kinect Breakout is shown in the screenshot on the right.
The aim is to move the wheeled carriage at the bottom of the screen to the left and right, so the tennis ball bounces off it and into the bricks. When the ball hits a brick, that brick disappears. The ball rebounds off bricks, the top of the screen, and the sides, but drops through the floor. When that happens, the user loses a 'life', and the ball reappears in the center of screen, moving downwards to the left or right. The ball's speed and direction can be adjusted by how you hit it with the carriage.
The Kinect's connection to all this is that it converts my hand movements into left and right shifts of the carriage. No mouse or keyboard input is necessary.
The game's background is the Kinect's camera display, enlarged to fill the screen. This gives me some feedback on my hand position although the carriage deliberately doesn't move in exact unison with my hand. If it did, I'd have to run backwards and forwards in my room to reach the left and right boundaries of the display area, which is too much like serious exercise.
There's a lot missing from this application to make it into a real game, but it illustrates how the Kinect can be utilized as a gaming input device.