![]() ![]() ![]() I think I'm figuring it out how to make all the checks. This will be my next step, now that I can detect the kind of movement is being made.Ĭheck if movement is valid based on number onlyĭepending the pile, the number must be one bigger or smaller Descending numbers on tableau, ascending numbers on foundation, moving out and not in from the waste pile, etc. NOW is when I should check if the card can be moved over another. If the movement is valid, it will show a message in the console. So I left the validation function alone and wrote another one to check if the card can be moved to another pile. I almost delete everything and start from scratch, because I forgot a few important things, like the cards don't only move from tableau pile to tableau pile! Also didn't find a way to place a child to all the other divs in the table, but after testing and testing found a way to make it work. The next step should be to move those cards when the validation function confirms that the move is valid.ĭetect valid card moves from pile to pile It still needs to check if those two cards aren't the same color and if the destination card is flipped, but I think I can work with this as is and leave it for later. Here is a little gif showing in console if the movement is valid: the dragged card is one number less than the destination card.the destination card is the last card in the pile.if those two spaces have a card, another function will run to check movement validation.same with "mouseup" but in another auxiliary variable.when a space receives a "mousedown", it's card will be stored in an auxiliary variable.It was a little hard, but I managed to make a function to check if a movement is valid (or "legal"). Function placeCardsDom ( ) Įach card name is now placed on each divisionįunction to store moving card and destination card ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |