-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Unity 4.x Game Development by Example: Beginner's Guide
By :

That leaves us with four more functions to write: Win()
, Block()
, CreateTrap()
, and PreventTrap()
. Note that for the remainder of the chapter, we'll be using the word "row" to refer both to a horizontal line, and to three squares in a line regardless of their orientation, as in "in-a-row".
A very interesting thing happens if we carefully work out what needs to happen in each of these functions. Take the Win
and Block
functions first.
To determine whether we can win , we need to look at three spaces in a row. If two of the spaces in a row contain our piece, and the third is empty, we can win the game.
To determine whether we can block , we need to look at three spaces in a row. If two of the spaces contain the opponent's piece, and the third is empty, we can block.
Change the font size
Change margin width
Change background colour