@leofavre/memory-game-component
Version:
A memory game web component.
50 lines (33 loc) • 956 B
Markdown
A memory game web component that receives an array of objects describing cards with images and names. The cards are duplicated and randomly distributed facing down. The goal of the game is to reveal matching cards two by two.
```html
<memory-game></memory-game>
```
```javascript
import '@leofavre/memory-game-component';
const $memoryGame = document.querySelector('memory-game');
$memoryGame.cards = [{
img: 'isle-of-dogs/chief.png',
name: 'Chief'
}, {
img: 'isle-of-dogs/duke.png',
name: 'Duke'
}, {
img: 'isle-of-dogs/king.png',
name: 'King'
}, {
img: 'isle-of-dogs/boss.png',
name: 'Boss'
}]
```
An arrays of objects representing the cards to be rendered. See [Usage](
- Default: 6
The number of cards per line.
- Default: 20px
The distance between cards.