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.
We will declare the
score
andlife
variables, which will act as the very basic elements of the gameplay. And...