h5p/h5p-memory-game

Clicking three cards

Opened this issue · 7 comments

I have noticed that, if you do fast enough, click not two but three cards so, when game checks result, if you fail, if just flips back two of the three cards.

Easy solution could be disable click event on every card when two cards are clicked.

icc commented

Ah, yes that is because of the animation delay. The checking should still work in the correct order though. Yes we could disable clicking or we could also add a fix that turns the two cards back when you click on a third. I'm not sure what is best, but with the latter solution the really fast people won't be bothered.

Let me know what you think and thank you for reporting the issue.

I would prefer disabling the click when two cards are selected and then enabling the click event again when the result gets calculated, but yes, both solutions could work.

Let me know if you want me to look into it and fix it :)

icc commented

I've been planning to have a look at memory game and its responsive design, but it won't be until I have some spare time.
You are more than welcome to have a go at this :-)

There you go, I am closing that issue since I already submitted a patch for it via pull request.
Cheers!

Hi
I have been looking at it and I think we should have a variable that says how many cards are flipped, so nobody can flip more than two at once. So, probably counting +1 every time someone click on '.h5p-memory-card' could be a good approach. Let me know.
Cheers

icc commented

Added some code for turning back cards when the next card is clicked. 83c278a