Writing our Blueprints
Now, we need to add some logic to this project. In order to achieve the tic-tac-toe mechanics and develop speaking, we need to do the following:
- Handle a turn-based mechanic
- Know when someone wins
- Show the state of the game
- Store a winning counter for each player
- Handle the restart
Open PuzzleBlock and PuzzleBlockGrid Blueprints as we are going to frequently switch between them.
First of all, we need to know which player has to move: the X or the O. In order to achieve this, also since this is a two-player game, we can use a simple Boolean variable that is stored on the PuzzleBlock grid class and grant it accessibility through the single block class.
Go to the grid class and add a new variable, call it
IsX, and ...
Get Unreal Engine Game Development Blueprints 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.