From be757c987962caa840b5c6c6091060d85201eefb Mon Sep 17 00:00:00 2001 From: scottwestover Date: Tue, 3 Sep 2024 16:30:34 +0000 Subject: [PATCH] Publishing Site scottwestover.dev at 84489cef672758b342f9aff87233998ea229f1fc on Tue Sep 3 16:30:33 UTC 2024 --- post/2024/08/solitaire-phaser-3-tutorial-5/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post/2024/08/solitaire-phaser-3-tutorial-5/index.html b/post/2024/08/solitaire-phaser-3-tutorial-5/index.html index 6739f377..4fc318d9 100644 --- a/post/2024/08/solitaire-phaser-3-tutorial-5/index.html +++ b/post/2024/08/solitaire-phaser-3-tutorial-5/index.html @@ -529,7 +529,7 @@ this.#foundationPileCards[pileIndex].setVisible(true).setFrame(this.#getCardFrame(pile)); }); -

In the code above, we are looping through each of the foundation piles in our Solitaire game instance, and as long as the value on the pile is not 0, which means the pile is empty, we then update the Card Image game object to be visible and to have the correct frame.

If you save your code changes and view the game in the browser, if you add a valid card to the foundation pile, you should see that the texture on the foundation pile is updated.

Updated foundation piles

Finally, one last change we need to make is we need to add the logic to the #handleRevealingNewTableauCards method. In this method, we need to update the depth on our tableau container game object to be 0, that way our depth is reset properly. Then, we need to check and see if we need to flip over the next card in the tableau pile that a card was just moved from. To do this check, we will call the flipTopTableauCard method on our Solitaire class, and if a card is flipped over, then we update the relevant Card Image game object to have the correct texture and update that game object to be draggable. To make these code changes, replace the code in the #handleRevealingNewTableauCards method with the following code:

// update tableau container depth
+

In the code above, we are looping through each of the foundation piles in our Solitaire game instance, and as long as the value on the pile is not 0, which means the pile is empty, we then update the Card Image game object to be visible and to have the correct frame.

If you save your code changes and view the game in the browser, if you add a valid card to the foundation pile, you should see that the texture on the foundation pile is updated.

Updated foundation piles

Finally, one last change we need to make is we need to add the logic to the #handleRevealingNewTableauCards method. In this method, we need to update the depth on our tableau container game object to be 0, that way our depth is reset properly. Then, we need to check and see if we need to flip over the next card in the tableau pile that a card was just moved from. To do this check, we will call the flipTopTableauCard method on our Solitaire class, and if a card is flipped over, then we update the relevant Card Image game object to have the correct texture and update that game object to be draggable. To make these code changes, replace the code in the #handleRevealingNewTableauCards method with the following code:

// update tableau container depth
 this.#tableauContainers[tableauPileIndex].setDepth(0);
 // check to see if the tableau pile card at the bottom of the sack needs to be flipped over
 const flipTableauCard = this.#solitaire.flipTopTableauCard(tableauPileIndex);