Skip to content

lucfercas/Card-Game

Repository files navigation

Card Game

About

The game has 16 cards, and when the game starts they are all facing down. The cards flip when clicked, and must be paired to their equal. When the wrong card is flipped, both selected cards return to their initial state (backwards). The cards are randomly shuffled each time the page is refreshed.

Planning

In order to write this game, I started drawing wireframes in paper, connecting elements by actions in a chronological order. I also checked tutorials and videos that also build this type of game, in order to improve my initial sketches.

Building

The fist step was to create all elements in HTML, then I would go on to styling using CSS, showing and hiding the img of .card based on (‘click’) event listeners. Then I would move to style the board, and would start building its functionality with function and if else arguments.

Debugging

Besides a few syntax errors and typos, I struggled to make the flipCard() function work, as I was not using the if statements correctly. Once I solved it, I had to re-format the shuffle() function.

I found these issues using console.log on a regular basis.

These mistakes made me deepen my knowledge of complex javascript functions.

About

5th FAC Application project

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published