I am trying to modify a blackjack game and change the way the cards are dealt. I want to be able to show or hide the card, which I have achieved with the showCard function below and a button using showCard(cardNum), but when the showCards function runs it overwrites the initial value for the playerHand array.
Anyone have an idea of how I could change this?
playerHand = new Array();
show= [true];
function showCards() {
this[“playerCard0”].gotoAndStop(“back”);
this[“playerCard1”].gotoAndStop(“back”);
this[“playerCard2”].gotoAndStop(playerHand[2]);
}
function showCard(cardNum) {
if (show[cardNum]) {
this[“playerCard”+cardNum].gotoAndStop(playerHand[cardNum]);
show[cardNum] = false;
} else {
this[“playerCard”+cardNum].gotoAndStop(“back”);
show[cardNum] = true;
}
}