Slowly building to a climax

What we very nearly have now is a functional Tic Tac Toe game for two players. Why waste money on a paper and pencil, when you can spend hundreds or thousands of dollars on a computer to play Tic Tac Toe?

Two human players can see for themselves whenever X or O gets 3-in-a-row and wins the game, but ideally, the game will be able to check for a win through code. We don't quite have the right elements in place to detect a win state, but we're going to spend the rest of the chapter getting there.

Have a go hero – think it through

Ask yourself: what does the code need to know in order to determine when a player has won? How would you go about figuring that out? Put the book down for a moment and puzzle through this question, ...

Get Unity 4.x Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.