@left quiver
So I'm doing an assignment where I'm supposed to create a memory game with a minimum of 8 cards, using bootstrap, javascript, jQuery, anime.js, and maybe a little bit of angular thrown in (though we barely got to scratch the surface on angular). I've got the cards and shuffling logic done, I can hide the color of the cards, and they change color and rotate correctly when clicked - once. Unfortunately when I reset their color back to gray, they no longer respond to clicks. In some iterations of the code I've managed to make the color of the cards to reactivate, but never the rotation. Unfortunately I've gone through many iterations of the same code and I'm not sure if I've made progress in the last 4 hours.
It's possible this is partially a javascript issue, as I did my programming basics on C#, while the rest of the group did javascript, so I may be missing the small technical details. This is basically the second step after programming basics.
Probably the biggest issue I've got is that I can't seem to troubleshoot the logic I want for the pair checks. As said, I've gone through many iterations. The one I'm on right now involves 4 variables, one for each pair, with a 5th one being the sum of the other 4. When an user clicks a specific card, the code checks for the right pair, adds one to the correct variable. When sum reaches 2, it checks if any other variables have reached 2. If yes, it removes the cards from the pool, if not, it resets everything and animates everything back to grey. Right now it does nothing, usually it lets more than 2 through before resetting (and running into the animation issue), and at best It's managed to remove one pair in total. That iteration is lost though.
TL;DR: Animations don't repeat per click, and logic doesn't seem to work properly. It's "homework", or a final assignment for the course.
.kortti {
height: 220px;
width: 180px;
border-radius: 5px;
border: 2px solid black;
}
/* #Nappi{
position:absolute;
} */
#kortit{
display:none;
}