Combined Code
movieClip 10 still_10 {
}
movieClip 11 still_09 {
}
movieClip 12 still_08 {
}
movieClip 21 still_07 {
}
movieClip 23 tits_02 {
}
movieClip 31 still_06 {
}
movieClip 38 still_05 {
}
movieClip 46 still_04 {
}
movieClip 52 still_03 {
}
movieClip 62 still_02 {
}
movieClip 75 still_01 {
}
// unknown tag 88 length 63
movieClip 79 still1 {
}
movieClip 82 still {
}
movieClip 115 Deck {
frame 1 {
stop();
}
}
frame 1 {
stop();
}
movieClip 126 {
}
movieClip 131 {
}
// unknown tag 88 length 77
button 144 {
on (release) {
gotoAndPlay(3);
}
}
frame 2 {
stop();
}
movieClip 146 {
}
button 149 {
on (release) {
gotoAndPlay(1);
}
}
frame 3 {
function initGame() {
cash = 100;
showCash();
bet = 100;
showBet();
_global.lvl = 0;
updateLevel();
}
function createDeck() {
suits = ['c', 'd', 's', 'h'];
temp = new Array();
i = 0;
while (i < 6) {
suit = 0;
while (suit < 4) {
num = 1;
while (num < 14) {
temp.push(suits[suit] + num);
++num;
}
++suit;
}
++i;
}
deck = new Array();
while (temp.length > 0) {
r = int(Math.random() * temp.length);
deck.push(temp[r]);
temp.splice(r, 1);
}
}
function initHand() {
playerHand = new Array();
dealerHand = new Array();
showDealerFirstCard = false;
}
function addToBet() {
bet += 100;
if (bet > cash) {
bet = 100;
}
showBet();
}
function makeBet() {
cash -= bet;
showCash();
}
function dealCard(hand) {
hand.push(deck.pop());
}
function showCash() {
cashDisplay = '$' + cash;
}
function showBet() {
betDisplay = '$' + bet;
}
function showCards() {
if (showDealerFirstCard) {
_root.dealer0.gotoAndStop(dealerHand[0]);
} else {
_root.dealer0.gotoAndStop(2);
}
i = 1;
while (i < dealerHand.length) {
_root['dealer' + i].gotoAndStop(dealerHand[i]);
++i;
}
i = 0;
while (i < playerHand.length) {
_root['player' + i].gotoAndStop(playerHand[i]);
++i;
}
playerValue = handValue(playerHand);
dealerValue = handValue(dealerHand);
}
function checkForBlackjack() {
if (playerHand.length == 2 and playerValue == 21) {
cash += bet * 3;
showCash();
result = 'Blackjack!';
gotoAndPlay('Done');
} else {
if (dealerHand.length == 2 and dealerHand == 21) {
result = 'Dealer has blackjack!';
gotoAndPlay('Done');
}
}
}
function hit() {
dealCard(playerHand);
showCards();
playerValue = handValue(playerHand);
if (playerValue >= 21) {
startDealer();
}
}
function startDealer() {
showDealerFirstCard = true;
showCards();
gotoAndPlay('Dealer');
}
function dealerMove() {
if (handValue(dealerHand) < 17) {
dealCard(dealerHand);
showCards();
gotoAndPlay('Dealer');
} else {
decideWinner();
}
}
function handValue(hand) {
total = 0;
ace = false;
i = 0;
while (i < hand.length) {
val = Number(hand[i].substr(1, 2));
if (val > 10) {
val = 10;
}
total += val;
if (val == 1) {
ace = true;
}
++i;
}
if (ace and total <= 11) {
total += 10;
}
return total;
}
function decideWinner() {
showCash();
if (playerValue > 21) {
result = 'You Busted!';
} else {
if (dealerValue > 21) {
cash += bet * 2;
result = 'Dealer Busts. You Win!';
} else {
if (dealerValue > playerValue) {
result = 'You Lose!';
} else {
if (dealerValue == playerValue) {
cash += bet;
result = 'Tie!';
} else {
if (dealerValue < playerValue) {
cash += bet * 2;
result = 'You Win!';
}
}
}
}
}
showCash();
gotoAndPlay('Done');
if (cash < -350) {
gotoAndPlay('next');
}
}
function newDeal() {
if (cash >= 1000 or cash < -450) {
if (cash < -450) {
_root.endText = 'You lose!';
} else {
_root.endText = 'You win!';
}
showEndScreen();
} else {
resetCards();
if (deck.length < 26) {
gotoAndPlay('shuffle');
} else {
initHand();
gotoAndPlay('Bet');
}
}
}
function resetCards() {
i = 0;
while (i < dealerHand.length) {
_root['dealer' + i].gotoAndStop(1);
++i;
}
i = 0;
while (i < playerHand.length) {
_root['player' + i].gotoAndStop(1);
++i;
}
}
function showEndScreen() {
gotoAndPlay(64);
}
function updateLevel() {
_global.lvl = Number(_root.cashDisplay.substr(1, _root.cashDisplay.length - 1));
if (bet > cash) {
bet = 100;
showBet();
}
}
initGame();
}
frame 3 {
var snd = new Sound();
snd.attachSound('mysound');
volume = 100;
play();
}
movieClip 154 {
frame 1 {
if (_global.lvl < -450) {
_root.square.attachMovie('end', 'x', 'x');
}
if (_global.lvl > -450 && _global.lvl <= 100) {
_root.square.attachMovie('still_01', 'x', 'x');
}
if (_global.lvl > 100) {
_root.square.attachMovie('still_02', 'x', 'x');
}
if (_global.lvl > 200) {
_root.square.attachMovie('still_03', 'x', 'x');
}
if (_global.lvl > 300) {
_root.square.attachMovie('still_04', 'x', 'x');
}
if (_global.lvl > 400) {
_root.square.attachMovie('still_05', 'x', 'x');
}
if (_global.lvl > 500) {
_root.square.attachMovie('still_06', 'x', 'x');
}
if (_global.lvl > 600) {
_root.square.attachMovie('still_07', 'x', 'x');
}
if (_global.lvl > 700) {
_root.square.attachMovie('still_08', 'x', 'x');
}
if (_global.lvl > 800) {
_root.square.attachMovie('still_09', 'x', 'x');
}
if (_global.lvl > 900) {
_root.square.attachMovie('still_10', 'x', 'x');
}
}
frame 60 {
gotoAndPlay(1);
}
}
movieClip 156 {
}
movieClip 158 {
frame 1 {
}
frame 3 {
gotoAndPlay(1);
}
}
button 166 {
on (release) {
$ = '$+100';
}
}
movieClip 169 {
}
instance of movieClip 169 {
onClipEvent (release) {
_root.snd.start(0, 10);
}
}
movieClip 171 {
}
instance of movieClip 171 {
onClipEvent (release) {
_root.snd.stop();
}
}
button 173 {
on (press) {
volume += 10;
if (volume > 100) {
volume = 100;
}
snd.setVolume(volume);
}
}
button 175 {
on (press) {
volume -= 10;
if (volume < 0) {
volume = 0;
}
snd.setVolume(volume);
}
}
button 178 {
on (press) {
gotoAndPlay(3);
}
}
button 180 {
on (press) {
gotoAndPlay(1);
}
}
frame 34 {
}
frame 35 {
createDeck();
}
frame 37 {
initHand();
stop();
}
// unknown tag 88 length 68
button 192 {
on (press) {
makeBet();
gotoAndPlay('Deal1');
}
}
button 196 {
on (press) {
addToBet();
}
}
frame 40 {
dealCard(dealerHand);
showCards();
}
frame 43 {
dealCard(playerHand);
showCards();
}
frame 46 {
dealCard(dealerHand);
showCards();
}
frame 49 {
dealCard(playerHand);
showCards();
}
frame 52 {
checkForBlackjack();
stop();
}
button 206 {
on (press) {
hit();
}
}
// unknown tag 88 length 68
button 214 {
on (press) {
startDealer();
}
}
frame 58 {
dealerMove();
}
frame 59 {
updateLevel();
stop();
}
button 221 {
on (press) {
newDeal();
}
}
frame 62 {
stop();
}
button 225 {
on (release) {
stopAllSounds();
}
}
frame 63 {
gotoAndStop(65);
}
frame 64 {
stop();
}
movieClip 241 {
}
instance of movieClip 169 {
onClipEvent (release) {
_root.snd.start(0, 10);
}
}
instance of movieClip 171 {
onClipEvent (release) {
_root.snd.stop();
}
}
frame 65 {
stop();
}
movieClip 253 {
}