O'Reilly logo

Practical Game Design with Unity and Playmaker by Sergey Mohov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Win/Lose conditions

While there are games where win/lose conditions are not necessary, air hockey is definitely not one of them. In classic air hockey, there are two goal slots on the opposite sides of the table. If the puck gets into the goal of player 1, then player 2 gets a point and vice versa. The game ends when one of the players has 7 points.

There is the short-term win condition (score once) and the long-term win condition (score seven times before your opponent does). We will only implement the short-term win condition, although you are highly encouraged to try and implement the long-term one once you are done with this chapter.

Before we start implementing the win/lose conditions, let us make sure that the puck cannot get stuck in the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required