Frame 1 (302 B)
bytes_loaded = Math.round(_root.getBytesLoaded());
bytes_total = Math.round(_root.getBytesTotal());
getPercent = bytes_loaded / bytes_total;
_root.loadBar._width = getPercent * 100;
_root.loadText = Math.round(getPercent * 100) + "%";
if (bytes_loaded == bytes_total) {
_root.gotoAndStop(3);
}
Frame 2 (17 B)
gotoAndPlay (1);
Frame 3 (17 B)
gotoAndPlay (4);
Frame 4 (74 B)
stop();
play_btn.onRelease = function () {
gotoAndPlay ("gameOn");
};
Frame 9 (2.22 KiB) ●
function moveCave() {
cave0_mc._x = cave0_mc._x - caveSpeed;
cave1_mc._x = cave1_mc._x - caveSpeed;
cave2_mc._x = cave2_mc._x - caveSpeed;
cave3_mc._x = cave3_mc._x - caveSpeed;
if (cave0_mc._x <= -550) {
cave0_mc._x = 550;
} else if (cave1_mc._x <= -550) {
cave1_mc._x = 550;
} else if (cave2_mc._x <= -550) {
cave2_mc._x = 550;
} else if (cave3_mc._x <= -550) {
cave3_mc._x = 550;
}
}
function moveRocks() {
rock1_mc._x = rock1_mc._x - caveSpeed;
rock2_mc._x = rock2_mc._x - caveSpeed;
if (rock1_mc._x <= -200) {
rock1_mc._x = 550;
} else if (rock2_mc._x <= -200) {
rock2_mc._x = 550;
}
}
function moveDiver() {
diverTarget_mc._y = diver_mc._y;
if (Key.isDown(40) && (diver_mc._y <= 320)) {
diver_mc._y = diver_mc._y + diverSpeed;
} else if (Key.isDown(38) && (diver_mc._y >= 0)) {
diver_mc._y = diver_mc._y - diverSpeed;
}
}
function moveBubbles() {
bubbles_mc._y = diver_mc._y - 5;
}
function moveShark() {
shark1_mc._x = shark1_mc._x - sharkSpeed;
shark2_mc._x = shark2_mc._x - sharkSpeed;
shark3_mc._x = shark2_mc._x - sharkSpeed;
if (shark1_mc._x <= -200) {
shark1_mc._x = 1000;
shark1_mc._y = random(100) + 50;
} else if (shark2_mc._x <= -200) {
shark2_mc._x = 1000;
shark2_mc._y = random(100) + 150;
} else if (shark3_mc._x <= -200) {
shark3_mc._x = 1500;
shark3_mc._y = random(100) + 150;
}
}
function deadDiver() {
if (diverTarget_mc.hitTest(shark1_mc) || (diverTarget_mc.hitTest(shark2_mc))) {
gotoAndStop ("gameOver");
delete _root.onEnterFrame;
} else if (diverTarget_mc.hitTest(rock1_mc) || (diverTarget_mc.hitTest(rock2_mc))) {
gotoAndStop ("gameOver");
delete _root.onEnterFrame;
}
}
function keepScore() {
counter = counter + 1;
if ((counter % 12) == 0) {
distance = distance + 1;
distance_txt.text = distance;
}
}
stop();
var caveSpeed = 5;
var diverSpeed = 5;
var sharkSpeed = 16;
var counter = 0;
var distance = 0;
diverTarget_mc._alpha = 0;
cave0_mc._x = 0;
cave1_mc._x = 550;
cave2_mc._x = 0;
cave3_mc._x = 550;
_root.onEnterFrame = function () {
moveCave();
moveRocks();
moveDiver();
moveBubbles();
moveShark();
deadDiver();
keepScore();
};
Frame 16 (79 B)
stop();
playAgain_btn.onRelease = function () {
gotoAndPlay ("gameOn");
};
Symbol 56 MovieClip Frame 6 (8 B)
stop();