In todays prac, i just continue to modify the code. Because the game is turn based, i need to somehow let players know the selected square is clicked by which player. I decided to use different colour to represent. So the orange colour boxes are selected by player 1 and the green colour boxes are selected by player 2.
First, i created 2 classes one for each player. These two classes will be similar, the only difference would be adding different child. Because player 1 should add child with orange square and player 2 should add green square. Then, I also add all the event listeners in the main. And i also created a function for tracking which players turn.
No comments:
Post a Comment