Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. if (this.tilesChecked.length === 2) {
  2. this.canGet = false;
  3.  
  4. if (
  5. this.tilesChecked[0].dataset.cardType ===
  6. this.tilesChecked[1].dataset.cardType
  7. ) {
  8. setTimeout(this.deleteTiles.bind(this), 500);
  9. } else {
  10. setTimeout(this.resetTiles.bind(this), 500);
  11. }
  12.  
  13. this.moveCount++;
  14. this.divScore.innerText = this.moveCount;
  15. }
  16. }
  17. },
  18.  
  19. deleteTiles: function() {
  20. this.tilesChecked[0].remove();
  21. this.tilesChecked[1].remove();
  22.  
  23. this.canGet = true;
  24. this.tilesChecked = [];
  25.  
  26. this.tilePairs++;
  27. if (this.tilePairs >= this.tileCount / 2) {
  28. alert('gameOver!');
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement