Combined Code
movieClip 7 {
}
// unknown tag 88 length 63
movieClip 17 still_10 {
}
movieClip 19 still_09 {
}
movieClip 21 still_08 {
}
movieClip 22 still_07 {
}
movieClip 24 tits_02 {
}
movieClip 41 still_06 {
}
movieClip 53 still_05 {
}
movieClip 72 still_04 {
}
movieClip 87 still_03 {
}
movieClip 100 still_02 {
}
movieClip 117 still_01 {
}
movieClip 120 still1 {
}
movieClip 123 still {
}
movieClip 156 Deck {
frame 1 {
stop();
}
}
frame 1 {
stop();
}
movieClip 174 {
}
movieClip 179 {
}
// unknown tag 88 length 77
button 191 {
on (release) {
gotoAndPlay(3);
}
}
button 193 {
on (release) {
gotoAndPlay(2);
}
}
frame 2 {
stop();
}
movieClip 204 {
}
button 206 {
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 212 {
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 30 {
gotoAndPlay(1);
}
}
movieClip 214 {
}
movieClip 216 {
frame 1 {
}
frame 3 {
gotoAndPlay(1);
}
}
button 224 {
on (release) {
$ = '$+100';
}
}
movieClip 227 {
}
instance of movieClip 227 {
onClipEvent (release) {
_root.snd.start(0, 10);
}
}
movieClip 229 {
}
instance of movieClip 229 {
onClipEvent (release) {
_root.snd.stop();
}
}
button 231 {
on (press) {
volume += 10;
if (volume > 100) {
volume = 100;
}
snd.setVolume(volume);
}
}
button 233 {
on (press) {
volume -= 10;
if (volume < 0) {
volume = 0;
}
snd.setVolume(volume);
}
}
button 236 {
on (press) {
gotoAndPlay(3);
}
}
button 238 {
on (press) {
gotoAndPlay(1);
}
}
frame 34 {
}
frame 35 {
createDeck();
}
frame 37 {
initHand();
stop();
}
// unknown tag 88 length 68
button 250 {
on (press) {
makeBet();
gotoAndPlay('Deal1');
}
}
button 254 {
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 264 {
on (press) {
hit();
}
}
// unknown tag 88 length 68
button 272 {
on (press) {
startDealer();
}
}
frame 58 {
dealerMove();
}
frame 59 {
updateLevel();
stop();
}
button 279 {
on (press) {
newDeal();
}
}
frame 62 {
stop();
}
button 283 {
on (release) {
stopAllSounds();
}
}
frame 63 {
gotoAndStop(65);
}
frame 64 {
stop();
}
movieClip 299 {
}
instance of movieClip 227 {
onClipEvent (release) {
_root.snd.start(0, 10);
}
}
instance of movieClip 229 {
onClipEvent (release) {
_root.snd.stop();
}
}
frame 65 {
stop();
}
movieClip 317 {
}