Go ahead and start the Tic-Tac-Toe project in Unit 9. You only need to spend about 20 mins a day on this. You can submit help questions to me through CodeHS, or email me directly. I will grade your work as you submit it to me on CodeHS
9.1.1 Draw the Tic Tac Toe Lines
In this project, we will be writing the game of tic tac toe as shown here. The first part is to draw the board.
Start by drawing the four lines that divide the grid into 9 squares.
9.1.2 Tic Tac Toe: Responding to Mouse Events and Using a Grid
We are writing the game of tic tac toe as shown here. In this part we will handle mouse clicks and draw the Xs and Os, and also use the grid data structure to keep track of the game.
9.1.3 Tic Tac Toe: The Full Game
Write the game of tic tac toe as shown here.
In this part we will complete the game of tic tac toe by determining the winner, and drawing a line to show who won.
The last part of the game is to get collisions working. You should remove bricks when the balls collide with them. This is VERY similar to bouncing the ball.
You just need to use the
getElementAt(x, y) function to see if there is an element where the ball is. If the element is not null, then you can remove it with the remove function.
You also need the ball to bounce up if it collides with the paddle
You want to check the four corners around the ball to see if there is an element there.
Last, there are just some miscellaneous things you can do:
- Pause the ball when it gets reset until you click. Kind of like the Pause Ball exercise.
- Stop the game after the ball falls to the bottom 3 times.
- Stop the game when all the bricks are removed.
- Display messages on the screen when you win or lose.
Then, you can just go crazy with extensions like these, if you’re feeling up to it.
- Display a score.
- Add power ups.
- Add cheat codes.
- Add multiple difficulty levels.
- Anything else that you can think of