Frame 1
gotoAndStop (1);
counter = 0;
onEnterFrame = function () {
if (counter == 108) {
picGameFools._visible = false;
gotoAndStop (2);
}
counter++;
};
Frame 2
btnStartGame.onRelease = function () {
_root.gotoAndStop(3);
};
btnPlayMoreGames.onRelease = function () {
getURL ("http://www.gamefools.com/onlinegames/");
};
Frame 3
function reset() {
var _local1 = _root;
_local1.createEmptyMovieClip("BG_top", 1000);
_local1.createEmptyMovieClip("BG_bottom", 1001);
_local1.createEmptyMovieClip("BG_blocks", 1002);
txtScore = 0;
bird_frame = 1;
Bird._rotation = 0;
Bird._y = 150;
Bird._x = 100;
endCounter = 0;
btnPlayAgain._y = 600;
txtFinalScore = "";
game_score = 0;
game_speed = 12;
game_height = 400;
blockCount = 0;
removedCount = 0;
frameCounter = 0;
topBlocks = 30;
bottomBlocks = 20;
bird_direction = "down";
movement = 0;
velocity = 1;
max_up = 5;
max_down = -7;
bounce_height = 6;
bounce_speed = 3;
alive = true;
bird_top_offset = -5;
bird_bottom_offset = 5;
bouncing = false;
above_water = true;
spikes = new Array();
bounce_dir = "up";
level = 0;
level_counter = 0;
level_length = 1000;
leveling = true;
level_delay_length = 110;
level_delay = level_delay_length;
water_direction = "down";
water_movement = 10;
water_count = 0;
level_phase = 1;
levels = 6;
round = 0;
game_over = false;
createTopandBottom();
changeBG(12637174);
}
function changeBG(col) {
var _local1 = new Color(bgClip);
_local1.setRGB(col);
bgClip._x = 0;
bgClip._y = 0;
bgClip._width = Stage.width;
bgClip._height = Stage.height;
}
function createTopandBottom() {
x = 0;
while (x < topBlocks) {
BG_top.attachMovie("blockMC" + round, "top_" + x, x);
currentTop = eval ("BG_top.top_" + x);
currentTop.cacheAsBitmap = true;
previousTop = eval ("BG_top.top_" + (x - 1));
currentTop._x = x * currentTop._width;
currentTop._y = 0;
x++;
}
x = 0;
while (x < bottomBlocks) {
BG_bottom.attachMovie(("water" + round) + "MC", "bottom_" + x, x + topBlocks);
currentBottom = eval ("BG_bottom.bottom_" + x);
currentBottom.cacheAsBitmap = true;
currentBottom._x = x * currentBottom._width;
currentBottom._y = game_height;
if (level == 0) {
currentBottom._y = currentBottom._y - currentBottom._height;
}
x++;
}
}
function createBlock() {
whichBlock = Math.round(Math.random() * 100);
if (whichBlock >= spikes_percent) {
blockType = "blockMC" + round;
spikes_dir = "down";
} else {
blockType = "block2MC" + round;
spikes_dir = "up";
}
createNumber = Math.round(Math.random() * (level_block_length - 1));
previousBlock = eval ("BG_blocks.block_" + (blockCount - 1));
randomX = Math.round(Math.random() * 6) + 1;
randomX = randomX * 45;
while (Math.abs(previousBlock._y - randomX) < 80) {
randomX = Math.round(Math.random() * 6) + 1;
randomX = randomX * 45;
}
x = 0;
while (x <= createNumber) {
spikes[blockCount] = spikes_dir;
BG_blocks.attachMovie(blockType, "block_" + blockCount, blockCount + 100);
currentBlock = eval ("BG_blocks.block_" + blockCount);
currentBlock.cacheAsBitmap = true;
currentBlock._y = randomX;
currentBlock._x = ((BG_Blocks._x * -1) + 600) + (x * currentBlock._width);
blockCount++;
x++;
}
}
function update_blocks() {
x = 0;
while (x < topBlocks) {
currentTop = eval ("BG_top.top_" + x);
if (((BG_top._x + currentTop._x) < -200) and (level_phase != 3)) {
currentTop._x = currentTop._x + (topBlocks * currentTop._width);
}
x++;
}
x = 0;
while (x < bottomBlocks) {
currentBottom = eval ("BG_bottom.bottom_" + x);
if ((BG_bottom._x + currentBottom._x) < -200) {
currentBottom._x = currentBottom._x + (bottomBlocks * currentBottom._width);
}
x++;
}
x = removedCount;
while (x < blockCount) {
currentBlock = eval ("BG_blocks.block_" + x);
if ((BG_blocks._x + currentBlock._x) < -200) {
currentBlock.removeMovieClip();
removedCount = x;
}
x++;
}
}
function moveTopandBottom() {
BG_top._x = BG_top._x - game_speed;
BG_bottom._x = BG_bottom._x - game_speed;
x = 0;
while (x < topBlocks) {
currentTop = eval ("BG_top.top_" + x);
if (((leveling == true) and (level_phase == 3)) and ((BG_top._x + currentTop._x) < -50)) {
currentTop._x = currentTop._x + (topBlocks * currentTop._width);
temp_x = currentTop._x;
temp_y = currentTop._y;
BG_top.attachMovie("blockMC" + round, "top_" + x, x);
currentTop = eval ("BG_top.top_" + x);
currentTop._x = temp_x;
currentTop._y = temp_y;
}
x++;
}
if (((leveling == true) and (level_phase == 2)) and (level != 0)) {
BG_bottom._y++;
}
if ((((leveling == true) and (level_phase == 3)) and (BG_bottom._y >= 0)) and (level != 0)) {
x = 0;
while (x < bottomBlocks) {
currentBottom = eval ("BG_bottom.bottom_" + x);
temp_x = currentBottom._x;
temp_y = currentBottom._y;
BG_bottom.attachMovie(("water" + round) + "MC", "bottom_" + x, x + topBlocks);
currentBottom = eval ("BG_bottom.bottom_" + x);
currentBottom._x = temp_x;
currentBottom._y = temp_y;
x++;
}
BG_bottom._y--;
}
}
function moveBlocks() {
BG_blocks._x = BG_blocks._x - game_speed;
x = removedCount;
while (x < blockCount) {
currentBlock = eval ("BG_blocks.block_" + x);
if (currentBlock.hitTest(Bird)) {
if ((Bird._y + bird_top_offset) > currentBlock._y) {
if ((Bird._y + bird_top_offset) < (currentBlock._y + currentBlock._height)) {
die();
}
} else {
bounce("up");
}
}
x++;
}
}
function bounce(bounce_direction) {
if ((bouncing == false) & (alive == true)) {
sndBounce.setVolume(20);
sndBounce.start();
}
bouncing = true;
bounce_count = 0;
bounce_dir = bounce_direction;
}
function die() {
if (alive == true) {
sndSquawk.setVolume(100);
sndSquawk.start();
}
alive = false;
}
function levelUp() {
moveBlocks();
moveTopandBottom();
level_delay++;
if ((level_delay >= level_delay_length) & (level_phase == 1)) {
txtLevel = "Level " + (level + 1);
level_delay = 0;
level_phase = 2;
sndLevel.setVolume(100);
sndLevel.start();
}
if ((level_delay >= (level_delay_length / 2)) & (level_phase == 2)) {
if (round == 0) {
changeBG(12637174);
} else if (round == 1) {
changeBG(12835032);
} else if (round == 2) {
changeBG(14803136);
} else if (round == 3) {
changeBG(14538169);
} else if (round == 4) {
changeBG(14209489);
} else if (round == 5) {
changeBG(12171705);
}
level_delay = 0;
level_phase = 3;
}
if ((level_delay >= level_delay_length) & (level_phase == 3)) {
level_delay = 0;
level_phase = 1;
txtLevel = "";
leveling = false;
if (level == 0) {
level_block_length = 5;
level_block_delay = 22;
spikes_percent = 0;
} else if (level == 1) {
level_block_length = 2;
level_block_delay = 14;
spikes_percent = 0;
} else if (level == 2) {
level_block_length = 4;
level_block_delay = 14;
spikes_percent = 0;
} else if (level == 3) {
level_block_length = 1;
level_block_delay = 9;
spikes_percent = 0;
} else if (level == 4) {
level_block_length = 3;
level_block_delay = 11;
spikes_percent = 0;
} else if (level == 5) {
level_block_length = 1;
level_block_delay = 9;
spikes_percent = 0;
} else if (level == 6) {
level_block_length = 3;
level_block_delay = 11;
spikes_percent = 0;
} else if (level == 7) {
level_block_length = 1;
level_block_delay = 9;
spikes_percent = 0;
} else if (level == 8) {
level_block_length = 3;
level_block_delay = 11;
spikes_percent = 0;
} else if (level == 9) {
level_block_length = 1;
level_block_delay = 9;
spikes_percent = 0;
} else if (level == 10) {
level_block_length = 3;
level_block_delay = 11;
spikes_percent = 0;
}
}
}
function animate_bird() {
bird_frame++;
Bird.gotoAndStop(bird_frame);
if (bird_frame == 7) {
bird_frame = 0;
}
}
function main() {
function endGame() {
moveBlocks();
moveTopandBottom();
endCounter++;
if (endCounter > 75) {
btnPlayAgain._y = 220;
}
}
if (game_over == true) {
endGame();
return(undefined);
}
if (leveling == true) {
levelUp();
} else {
moveBlocks();
moveTopandBottom();
game_score++;
level_counter++;
if (level_counter >= level_length) {
level++;
round++;
if (round == levels) {
round = 0;
}
level_counter = 0;
leveling = true;
}
txtScore = game_score;
if (Bird._y < 40) {
die();
}
if (Bird._y > (game_height - 40)) {
Bird._y = 1000;
die();
}
if (frameCounter < level_block_delay) {
frameCounter++;
} else {
createBlock();
frameCounter = 0;
}
}
if ((above_water == true) and (Bird._y > 400)) {
sndSploosh.start();
above_water = false;
game_over = true;
txtFinalScore = "Game Over \n Final Score: " + game_score;
txtLevel = "";
}
if ((bird_direction == "up") && (movement < max_up)) {
movement = movement + velocity;
}
if ((bird_direction == "down") && (movement > max_down)) {
movement = movement - velocity;
}
if (bouncing == true) {
if (bounce_count <= bounce_height) {
movement = bounce_speed;
if (bounce_dir == "down") {
movement = movement * -1;
}
bounce_count = bounce_count + bounce_speed;
} else {
bouncing = false;
}
}
if (alive == true) {
Bird._y = Bird._y - movement;
} else {
Bird._x = Bird._x + 2;
Bird._y = Bird._y + 8;
Bird._rotation = Bird._rotation + 4;
}
}
Bird.cacheAsBitmap = true;
btnPlayAgain.onRelease = function () {
reset();
};
reset();
sndSquawk = new Sound();
sndSquawk.attachSound("squawk");
sndSploosh = new Sound();
sndSploosh.attachSound("sndSploosh");
sndBounce = new Sound();
sndBounce.attachSound("sndBounce");
sndLevel = new Sound();
sndLevel.attachSound("sndLevel");
sndWind = new Sound();
sndWind.attachSound("sndWind");
changeBG(12637174);
gotoAndStop (3);
setInterval(function () {
main();
}, 23);
setInterval(function () {
animate_bird();
}, 70);
setInterval(function () {
update_blocks();
}, 1000);
onMouseDown = function () {
bird_direction = "up";
bouncing = false;
};
onMouseUp = function () {
bird_direction = "down";
movment = movment + 4;
bouncing = false;
};