Git Product home page Git Product logo

memory-game's Introduction

Hello, I'm Zak! ๐Ÿ‘‹

JavaScript | TypeScript | React.js | GraphQL


You can learn more about me on my website, Twitter, or LinkedIn

memory-game's People

Contributors

zaklaughton avatar

Watchers

 avatar  avatar

Forkers

jpenney1

memory-game's Issues

Refactor endGameFlip

There's a lot of redundancy in the endGameFlip function. This could be simplified by putting redundant code in a function.

function endGameFlip () {
  let cards = document.querySelector('.deck').childNodes;
  animateAction = 'bounceIn'
  setTimeout(function () {
    animate(cards[0], animateAction);
  }, 100);
  setTimeout(function () {
    animate(cards[1], animateAction);
    animate(cards[4], animateAction);
  }, 200);
  setTimeout(function () {
    animate(cards[2], animateAction);
    animate(cards[5], animateAction);
    animate(cards[8], animateAction);
  }, 300);
  setTimeout(function () {
    animate(cards[3], animateAction);
    animate(cards[6], animateAction);
    animate(cards[9], animateAction);
    animate(cards[12], animateAction);
  }, 400);
  setTimeout(function () {
    animate(cards[7], animateAction);
    animate(cards[10], animateAction);
    animate(cards[13], animateAction);
  }, 500);
  setTimeout(function () {
    animate(cards[11], animateAction);
    animate(cards[14], animateAction);
  }, 600);
  setTimeout(function () {
    animate(cards[15], animateAction);
  }, 700);
}

Add animations

Add animations to make the game feel more immersive.

Including:

  • Flip card open
  • Flip card closed
  • Confirm matched pair
  • Unmatched pair
  • Fade in end game screen
  • Fade out end game screen

Change from entrance animations

Animations for matches and the endGame flip use entrance animations, causing the cards to briefly disappear, then animate. This will have a smoother feel if an animation is used that is not an "entrance" animation. (e.g. "bounce" instead of "bounceIn")

End game animation

Have some special animation after winning that animates all the cards.

Dynamically generate board

The cards are currently hard-coded into the HTML. It would be better to have the cards dynamically generated via javascript and placed on the page.

Matching issue bug

If two matching cards are selected, and a third card is selected immediately after, it will register visibly as 3 matched cards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.