[h=2]Score board for BlackJack Game Points trouble.[/h] [INDENT] I am creating a blackjack game and almost have it all figured out besides the scoreboard. When I win the game it adds the 25 points and when I loose it subtracts the 25 points from the starting score = 200. The problem is that if you win multiple times in a row or lose multiple times in a row the score doesn’t keep adding up. It only adds or subtracts the score once. I tried using a boolean code but can’t get it to work right. Now I am using this set up. Any Ideas??
var playerMoney:Number;
function showScore():void
{
player_txt.text = "Player: " + playerMoney;
}
function initializeGame():void
{
playerMoney = 200;
}
function checkWin():void
{
var tempCard:MovieClip;
playerScore = calculateScore(playerCards);
if(playerScore <= 21 && message_txt.text == “”)
{
dealerScore = calculateScore(dealerCards,true);
}
for(var i:uint = 0; i < dealerCards.length; i++)
{
tempCard = MovieClip(dealerContainer.getChildAt(i));
tempCard.gotoAndStop(dealerCards*.cardType);
tempCard.value_mc.gotoAndStop(dealerCards*.cardName);
}
if(playerScore == dealerScore)
{
message_txt.appendText("It's a tie!");
}
else if(playerScore <= 21 && (playerScore >= dealerScore || dealerScore > 21))
{
message_txt.appendText("Player Wins!");
playerMoney +=25;
showScore();
}
else
{
message_txt.appendText("Dealer Wins!");
playerMoney -=25;
showScore();
}
hit_btn.removeEventListener(MouseEvent.CLICK, hitMe);
stay_btn.removeEventListener(MouseEvent.CLICK, stay);
deal_btn.addEventListener(MouseEvent.CLICK, startGame);
}
[/INDENT]