Book Image

Augmented Reality with Kinect

By : Rui Wang
Book Image

Augmented Reality with Kinect

By: Rui Wang

Overview of this book

Microsoft Kinect changes the notion of user interface design. It differs from most other user input controllers as it enables users to interact with the program without touching the mouse or a trackpad. It utilizes motion sensing technology and all it needs is a real-time cameras, tracked skeletons, and gestures. Augmented Reality with Kinect will help you get into the world of Microsoft Kinect programming with the C/C++ language. The book will cover the installation, image streaming, skeleton and face tracking, multi-touch cursors and gesture emulation. Finally, you will end up with a complete Kinect-based game. Augmented Reality with Kinect will help you get into the world of Kinect programming, with a few interesting recipes and a relatively complete example. The book will introduce the following topics: the installation and initialization of Kinect applications; capturing color and depth images; obtaining skeleton and face tracking data; emulating multi-touch cursors and gestures; and developing a complete game using Kinect features. The book is divided in such a way so as to ensure that each topic is given the right amount of focus. Beginners will start from the first chapter and build up to developing their own applications.
Table of Contents (14 chapters)
Augmented Reality with Kinect
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Playing the game


The last example in this chapter is to design a simple gameplay. We now have the interaction driven by Kinect, and fruit objects that intersect with handtrails, but we don't have any rules yet. The gameplay will specify how to win or lose the game and how to set challenges for the player to overcome. A good gameplay is the base of the playability of a game.

We have four rules for the Fruit Ninja game here to follow:

  • Our goal is to cut as many fruits as possible to earn higher scores.

  • The higher the points we earn, the faster and more in number the fruits appear.

  • The player has a life value (initially 100). The game finishes when it becomes zero.

  • If a fruit is not sliced, the life will be decreased by 5 points. If a bomb is sliced, the life will be decreased by 20 points.

And these rules will be implemented in the following section.

Adding simple game logic

Let's start now.

  1. We will declare the score and life variables, which will act as the very basic elements of the gameplay. And...