Frame 8
stop();
Instance of Symbol 64 MovieClip "slotmachine" in Frame 8
onClipEvent (load) {
this.isSpinning = false;
this.isAccelerating = false;
this.framecounter = 0;
this.sndSpinning = new Sound(this);
this.sndJingle = new Sound(_root);
this.sndJingle.attachSound("Slot Machine Jingle.wav");
this.roundcounter = 0;
this.lastRound = 1;
this.randint = function (n) {
return(Math.round(Math.random() * (n - 1)));
};
this.setRandomSymbols = function (slot) {
slot.symbols.gotoAndStop(Math.round(Math.random() * slot.symbols._totalframes));
};
this.doSlowing = function (slot) {
if (!slot.isSlowing) {
slot.speed = slot.speed - randint(3);
if (slot.speed <= 1) {
slot.speed = 1;
}
if (slot.speed == 1) {
if (roundcounter >= lastRound) {
slot.stopAtSymbol = 0;
slot.symbols.symbols1.gotoAndStop(2);
slot.symbols.symbols2.gotoAndStop(2);
slot.symbols.symbols3.gotoAndStop(2);
} else {
slot.stopAtSymbol = randint(9);
}
slot.stopAtFrame = (Math.round(slot.stopAtSymbol * 7.11111111111111) % 64) + 1;
slot.isSlowing = true;
sndSpinning.setVolume(sndSpinning.getVolume() * 0.666666666666667);
}
}
};
this.initSlotmachine = function () {
slot1.symbols.gotoAndStop(1);
slot2.symbols.gotoAndStop(2);
slot3.symbols.gotoAndStop(3);
slot1.gotoAndStop(slot1._currentframe);
slot2.gotoAndStop(slot2._currentframe);
slot3.gotoAndStop(slot3._currentframe);
slot1.symbols.symbols1.gotoAndStop(1);
slot1.symbols.symbols2.gotoAndStop(1);
slot1.symbols.symbols3.gotoAndStop(1);
slot2.symbols.symbols1.gotoAndStop(1);
slot2.symbols.symbols2.gotoAndStop(1);
slot2.symbols.symbols3.gotoAndStop(1);
slot3.symbols.symbols1.gotoAndStop(1);
slot3.symbols.symbols2.gotoAndStop(1);
slot3.symbols.symbols3.gotoAndStop(1);
isSpinning = false;
};
this.startSpinning = function () {
roundcounter = roundcounter + 1;
framecounter = 0;
slot1.speed = 1;
slot2.speed = 1;
slot3.speed = 1;
slot1.gotoAndPlay(slot1._currentframe);
slot2.gotoAndPlay(slot2._currentframe);
slot3.gotoAndPlay(slot3._currentframe);
slot1.stopAtSymbol = 0;
slot2.stopAtSymbol = 0;
slot3.stopAtSymbol = 0;
slot1.stopAtFrame = 1;
slot2.stopAtFrame = 1;
slot3.stopAtFrame = 1;
slot1.isSlowing = false;
slot2.isSlowing = false;
slot3.isSlowing = false;
isSpinning = true;
isAccelerating = true;
sndSpinning.attachSound("Slot Machine Spinning.wav");
sndSpinning.setVolume(35);
sndSpinning.start();
};
btnSpin.onPress = function () {
if ((!_root.slotmachine.isSpinning) && (_root.slotmachine.roundcounter < _root.slotmachine.lastRound)) {
_root.slotmachine.startSpinning();
_root.slotmachine.isSpinning = true;
_root.slotmachine.sndJingle.stop();
_root.slotmachine.sndJingle.setVolume(100);
_root.slotmachine.sndJingle.start();
_root.slotmachine.sndMusic01.start();
}
};
initSlotmachine();
lastRound = randint(3) + 2;
}
onClipEvent (enterFrame) {
if (isSpinning) {
slot1.gotoAndStop((((slot1._currentframe - 1) + slot1.speed) % 64) + 1);
slot2.gotoAndStop((((slot2._currentframe - 1) + slot2.speed) % 64) + 1);
slot3.gotoAndStop((((slot3._currentframe - 1) + slot3.speed) % 64) + 1);
if (slot1.isSlowing && (slot1._currentframe == slot1.stopAtFrame)) {
slot1.speed = 0;
}
if (slot2.isSlowing && (slot2._currentframe == slot2.stopAtFrame)) {
slot2.speed = 0;
}
if (slot3.isSlowing && (slot3._currentframe == slot3.stopAtFrame)) {
slot3.speed = 0;
}
if (((((slot1.isSlowing && (slot1.speed == 0)) && (slot2.isSlowing)) && (slot2.speed == 0)) && (slot3.isSlowing)) && (slot3.speed == 0)) {
isSpinning = false;
sndSpinning.stop();
if (roundcounter >= lastRound) {
btnSpin.enabled = false;
_parent.gotoAndPlay(_parent._currentframe + 1);
} else {
sndSpinning.attachSound(("_8bitMusicPattern0" + String(randint(5) + 1)) + ".wav");
sndSpinning.setVolume(100);
sndSpinning.start();
}
}
if (isAccelerating) {
if ((framecounter % 32) == 0) {
slot1.speed = slot1.speed + randint(3);
slot2.speed = slot2.speed + randint(3);
slot3.speed = slot3.speed + randint(3);
if (Math.max(Math.max(slot1.speed, slot2.speed), slot3.speed) >= 5) {
isAccelerating = false;
}
}
} else if ((framecounter % 64) == 0) {
doSlowing(slot1);
doSlowing(slot2);
doSlowing(slot3);
}
framecounter = framecounter + 1;
}
}
Instance of Symbol 64 MovieClip in Frame 90
onClipEvent (load) {
slot1.symbols.gotoAndStop(1);
slot2.symbols.gotoAndStop(2);
slot3.symbols.gotoAndStop(3);
slot1.gotoAndStop(slot1._currentframe);
slot2.gotoAndStop(slot2._currentframe);
slot3.gotoAndStop(slot3._currentframe);
slot1.symbols.symbols1.gotoAndStop(2);
slot1.symbols.symbols2.gotoAndStop(2);
slot1.symbols.symbols3.gotoAndStop(2);
slot2.symbols.symbols1.gotoAndStop(2);
slot2.symbols.symbols2.gotoAndStop(2);
slot2.symbols.symbols3.gotoAndStop(2);
slot3.symbols.symbols1.gotoAndStop(2);
slot3.symbols.symbols2.gotoAndStop(2);
slot3.symbols.symbols3.gotoAndStop(2);
btnSpin.enabled = false;
}
Frame 118
stop();
Symbol 25 Button
on (release) {
startMovie();
}
Symbol 26 MovieClip Frame 1
function timerHandler() {
if (!loadingComplete) {
var loaded = (_root.getBytesLoaded() / _root.getBytesTotal());
bar._xscale = 100 * loaded;
if (loaded == 1) {
loadingComplete = true;
if (AUTO_PLAY) {
startMovie();
} else {
gotoAndStop (2);
}
return(undefined);
}
}
dt = getTimer() - time;
time = time + dt;
frameAccum = frameAccum + dt;
var i = 0;
while ((frameAccum >= FRAME_TIME) && (i < MAX_FRAME_SKIP)) {
advanceFrame(tankLogo, true, true);
advanceFrame(barGfx, false, true);
if (loadingComplete) {
advanceFrame(this, false, false);
}
(frameAccum = frameAccum - FRAME_TIME);
i++;
}
updateAfterEvent();
}
function advanceFrame(clip, recurse, loop) {
if (!clip) {
return(undefined);
}
clip.stop();
if (clip._currentframe == clip._totalframes) {
if (loop) {
clip.gotoAndStop(1);
}
} else {
clip.nextFrame();
}
if (recurse) {
for (childName in clip) {
if (typeof(clip[childName]) == "movieclip") {
advanceFrame(clip[childName], recurse, loop);
}
}
}
}
function startMovie() {
clearInterval(intervalId);
_root.play();
}
_root.stop();
stop();
var FRAME_TIME = 33.3333333333333;
var AUTO_PLAY = false;
var MAX_FRAME_SKIP = 5;
var loadingComplete;
var intervalId;
var time;
var frameAccum;
loadingComplete = false;
intervalId = setInterval(this, "timerHandler", FRAME_TIME / 2);
frameAccum = 0;
time = getTimer();
timerHandler();
Symbol 26 MovieClip Frame 2
stop();
Symbol 52 MovieClip Frame 1
stop();
Symbol 52 MovieClip Frame 2
stop();
Symbol 53 MovieClip Frame 1
stop();
Symbol 53 MovieClip Frame 2
stop();
Symbol 54 MovieClip Frame 1
stop();
Symbol 54 MovieClip Frame 2
stop();
Symbol 55 MovieClip Frame 1
stop();
Symbol 82 MovieClip Frame 123
stop();