Angular
Let's Code Together - Flopnames

Move Game Grid Display to new Child Component

Mute
Current Time 0:00
/
Duration Time 0:00
Loaded: 0%
Progress: 0%
Stream TypeLIVE
Remaining Time -0:00
 
PRO

In this video

We move the HTML and functionality of the game grid into the new gamegrid child component

Assignment:
  1. Start the initial code to determine if the game is over.
  2. Create a new method that will be called by the selectTile method in the gamegrid component that will check for the end condition.
  3. Name this method checkForWinner.
  4. The end condition is if either both red or both blue tiles are selected, or if the assassin tile is selected.
  5. Determine if both blue or both red are selected by simply keeping count of when a blue or red tile is selected (in two different properties) and when either of those properties reaches 2, then the game is over.
  6. Name those properties blueTilesSelected and redTilesSelected. Default those properties to zero. Increment them when either a blue or red tile is selected.
  7. Just log out to the console that the game is over in any of the 3 cases.
 

I finished! On to the next chapter