Frame 1
if (getBytesLoaded() >= getBytesTotal()) {
gotoAndStop (3);
}
Frame 2
gotoAndPlay (1);
Frame 3
stop();
stopAllSounds();
Frame 4
function initGame() {
_root.lives = 100;
n = 100;
showHealth();
nextBalloonTime = 0;
nextBalloon = 0;
balloons = [];
numBalloons = 202;
nextBulletTime = 0;
nextBullet = 0;
bullets = [];
score = 0;
}
function newBalloon() {
if (nextBalloon < numBalloons) {
if (getTimer() > nextBalloonTime) {
if (Math.Random() < 0.5) {
attachMovie("balloon", "balloon" + nextBalloon, nextBalloon);
if (score == 3000) {
_root.lev.gotoAndPlay(2);
if (n > 50) {
n = 100;
lives = 100;
} else {
n = 50;
lives = 50;
}
}
if (score >= 3000) {
_root["balloon" + nextBalloon].gotoAndStop(2);
} else {
_root["balloon" + nextBalloon].gotoAndStop(1);
}
_root["balloon" + nextBalloon]._x = 580;
dx = (-int(Math.Random() * 5)) - 3;
_root["balloon" + nextBalloon]._y = int(Math.Random() * 150) + 100;
balloons.push({clip:"balloon" + nextBalloon, d:dx});
nextBalloon++;
if (score >= 3000) {
nextBalloonTime = getTimer() + 700;
} else {
nextBalloonTime = getTimer() + 2000;
}
}
}
}
}
function moveBalloons() {
i = balloons.length - 1;
while (i >= 0) {
dx = balloons[i].d;
balloon = _root[balloons[i].clip];
balloon._x = balloon._x + dx;
if (niyache.hitTest(balloon.hit)) {
_root.lives--;
n = n - 1;
_root.niyache.gotoAndPlay(2);
showHealth();
} else if ((dx < 0) and (balloon._x < 5)) {
balloon.removeMovieClip();
balloons.splice(i, 1);
} else if ((dx > 0) and (balloon._x > 550)) {
balloon.removeMovieClip();
balloons.splice(i, 1);
}
if ((nextBalloon >= numBalloons) or (_root.lives < 1)) {
gotoAndStop (5);
removeAllBalloons();
}
i--;
}
}
function moveniyache() {
if (Key.isDown(38)) {
if ((_root.niyache._y - (_root.niyache._height / 2)) < 60) {
dx = 0;
dy = 0;
} else {
dx = -5;
dy = 0;
}
} else if (Key.isDown(40)) {
if ((_root.niyache._y + (_root.niyache._height / 2)) > 410) {
dx = 0;
dy = 0;
} else {
dx = 5;
dy = 0;
}
} else if (Key.isDown(37)) {
if ((_root.niyache._x - (_root.niyache._width / 2)) < 5) {
dx = 0;
dy = 0;
} else {
dy = -5;
dx = 0;
}
} else if (Key.isDown(39)) {
if ((_root.niyache._x + (_root.niyache._width / 2)) > 550) {
dx = 0;
dy = 0;
} else {
dy = 5;
dx = 0;
niyache._xscale = Math.abs(niyache._xscale);
}
} else {
dx = 0;
dy = 0;
}
niyache._y = niyache._y + dx;
niyache._x = niyache._x + dy;
}
function shootBullet() {
attachMovie("bullet", "bullet" + nextBullet, nextBullet + 9999);
_root["bullet" + nextBullet]._x = niyache._x + 29.6;
_root["bullet" + nextBullet]._y = niyache._y - 40;
bullets.push(nextBullet);
n = n - 0.5;
_root.lives = _root.lives - 0.5;
nextBullet++;
}
function moveBullets() {
i = bullets.length - 1;
while (i >= 0) {
bullet = _root["bullet" + bullets[i]];
bullet._x = bullet._x + 25;
if (bullet._x > 550) {
bullet.removeMovieClip();
bullets.splice(i, 1);
} else if (checkCollision(bullet)) {
bullet.removeMovieClip();
bullets.splice(i, 1);
}
i--;
}
}
function checkCollision(m) {
m = bullet;
j = balloons.length - 1;
while (j >= 0) {
balloon = _root[balloons[j].clip];
if (distance(bullet, balloon) < 15) {
balloon.gotoAndPlay(3);
balloons.splice(j, 1);
score = score + 100;
return(true);
}
j--;
}
return(false);
}
function distance(clip1, clip2) {
dx = clip1._x - clip2._x;
dy = clip1._y - clip2._y;
return(Math.sqrt((dx * dx) + (dy * dy)));
}
function removeAllBalloons() {
i = balloons.length - 1;
while (i >= 0) {
balloon = _root[balloons[i].clip];
balloon.removeMovieClip();
i--;
}
i = bullets.length - 1;
while (i >= 0) {
bullet = _root["bullet" + bullets[i]];
bullet.removeMovieClip();
i--;
}
}
function showHealth() {
_root.health.meter._xscale = n;
}
stop();
Instance of Symbol 92 MovieClip "fox" in Frame 4
onClipEvent (load) {
_root.initGame();
}
onClipEvent (enterFrame) {
_root.showHealth();
_root.newBalloon();
_root.moveBalloons();
_root.moveniyache();
_root.moveBullets();
}
Instance of Symbol 126 MovieClip "barre" in Frame 4
onClipEvent (enterFrame) {
this.swapDepths(5000);
}
Frame 5
stop();
barre.removeMovieClip();
Symbol 7 MovieClip [niyache] Frame 1
stop();
Symbol 7 MovieClip [niyache] Frame 6
Symbol 7 MovieClip [niyache] Frame 10
gotoAndStop (1);
gotoAndStop (1);
Symbol 49 MovieClip [balloon] Frame 1
stop();
Symbol 49 MovieClip [balloon] Frame 2
stop();
Symbol 49 MovieClip [balloon] Frame 22
this.removeMovieClip();
stop();
Symbol 60 Button
on (press) {
gotoAndPlay (4);
}
Symbol 74 MovieClip Frame 1
stop();
Symbol 74 MovieClip Frame 3
gotoAndStop (1);
Symbol 74 MovieClip Frame 5
gotoAndStop (1);
Symbol 94 Button
on (keyPress "<Space>") {
_root.shootBullet();
_root.niyache.robot.gotoAndPlay(2);
_root.son.gotoAndPlay(2);
}
Symbol 98 MovieClip Frame 1
stop();
Symbol 99 MovieClip Frame 1
stop();
Symbol 99 MovieClip Frame 15
gotoAndStop (1);
Symbol 111 MovieClip Frame 1
stop();
Symbol 115 MovieClip Frame 1
stop();
Symbol 115 MovieClip Frame 10
gotoAndStop (1);
Symbol 117 MovieClip Frame 1
stop();
Symbol 117 MovieClip Frame 2
stop();
Symbol 117 MovieClip Frame 3
gotoAndStop (1);
Symbol 124 MovieClip Frame 1
stop();
Symbol 124 MovieClip Frame 2
stop();
Symbol 124 MovieClip Frame 3
stop();
Symbol 124 MovieClip Frame 4
stop();
Symbol 124 MovieClip Frame 5
stop();
Symbol 124 MovieClip Frame 6
stop();
Symbol 124 MovieClip Frame 7
stop();
Symbol 124 MovieClip Frame 8
stop();
Symbol 124 MovieClip Frame 9
stop();
Symbol 124 MovieClip Frame 10
stop();
Symbol 124 MovieClip Frame 11
stop();
Symbol 124 MovieClip Frame 12
stop();
Symbol 124 MovieClip Frame 13
stop();
Symbol 124 MovieClip Frame 14
stop();
Symbol 124 MovieClip Frame 15
stop();
Symbol 124 MovieClip Frame 16
stop();
Symbol 124 MovieClip Frame 17
stop();
Symbol 124 MovieClip Frame 18
stop();
Symbol 124 MovieClip Frame 19
stop();
Symbol 124 MovieClip Frame 20
stop();
Symbol 124 MovieClip Frame 21
stop();
Symbol 124 MovieClip Frame 22
stop();
Symbol 124 MovieClip Frame 23
stop();
Symbol 124 MovieClip Frame 24
stop();
Symbol 124 MovieClip Frame 25
stop();
Symbol 124 MovieClip Frame 26
stop();
Symbol 124 MovieClip Frame 27
stop();
Symbol 124 MovieClip Frame 28
stop();
Symbol 124 MovieClip Frame 29
stop();
Symbol 124 MovieClip Frame 30
stop();
Symbol 124 MovieClip Frame 31
stop();
Symbol 124 MovieClip Frame 32
stop();
Symbol 124 MovieClip Frame 33
stop();
Symbol 124 MovieClip Frame 34
stop();
Symbol 124 MovieClip Frame 35
stop();
Symbol 124 MovieClip Frame 36
stop();
Symbol 124 MovieClip Frame 37
stop();
Symbol 124 MovieClip Frame 38
stop();
Symbol 124 MovieClip Frame 39
stop();
Symbol 124 MovieClip Frame 40
stop();
Symbol 124 MovieClip Frame 41
stop();
Symbol 124 MovieClip Frame 42
stop();
Symbol 124 MovieClip Frame 43
stop();
Symbol 124 MovieClip Frame 44
stop();
Symbol 124 MovieClip Frame 45
stop();
Symbol 124 MovieClip Frame 46
stop();
Symbol 124 MovieClip Frame 47
stop();
Symbol 124 MovieClip Frame 48
stop();
Symbol 124 MovieClip Frame 49
stop();
Symbol 124 MovieClip Frame 50
stop();
Symbol 124 MovieClip Frame 51
stop();
Symbol 124 MovieClip Frame 52
stop();
Symbol 124 MovieClip Frame 53
stop();
Symbol 124 MovieClip Frame 54
stop();
Symbol 124 MovieClip Frame 55
stop();
Symbol 124 MovieClip Frame 56
stop();
Symbol 124 MovieClip Frame 57
stop();
Symbol 124 MovieClip Frame 58
stop();
Symbol 124 MovieClip Frame 59
stop();
Symbol 124 MovieClip Frame 60
stop();
Symbol 124 MovieClip Frame 61
stop();
Symbol 124 MovieClip Frame 62
stop();
Symbol 124 MovieClip Frame 63
stop();
Symbol 124 MovieClip Frame 64
stop();
Symbol 124 MovieClip Frame 65
stop();
Symbol 124 MovieClip Frame 66
stop();
Symbol 124 MovieClip Frame 67
stop();
Symbol 124 MovieClip Frame 68
stop();
Symbol 124 MovieClip Frame 69
stop();
Symbol 124 MovieClip Frame 70
stop();
Symbol 124 MovieClip Frame 71
stop();
Symbol 124 MovieClip Frame 72
stop();
Symbol 124 MovieClip Frame 73
stop();
Symbol 124 MovieClip Frame 74
stop();
Symbol 124 MovieClip Frame 75
stop();
Symbol 124 MovieClip Frame 76
stop();
Symbol 124 MovieClip Frame 77
stop();
Symbol 124 MovieClip Frame 78
stop();
Symbol 124 MovieClip Frame 79
stop();
Symbol 124 MovieClip Frame 80
stop();
Symbol 124 MovieClip Frame 81
stop();
Symbol 124 MovieClip Frame 82
stop();
Symbol 124 MovieClip Frame 83
stop();
Symbol 124 MovieClip Frame 84
stop();
Symbol 124 MovieClip Frame 85
stop();
Symbol 124 MovieClip Frame 86
stop();
Symbol 124 MovieClip Frame 87
stop();
Symbol 124 MovieClip Frame 88
stop();
Symbol 124 MovieClip Frame 89
stop();
Symbol 124 MovieClip Frame 90
stop();
Symbol 124 MovieClip Frame 91
stop();
Symbol 124 MovieClip Frame 92
stop();
Symbol 124 MovieClip Frame 93
stop();
Symbol 124 MovieClip Frame 94
stop();
Symbol 124 MovieClip Frame 95
stop();
Symbol 124 MovieClip Frame 96
stop();
Symbol 124 MovieClip Frame 97
stop();
Symbol 124 MovieClip Frame 98
stop();
Symbol 124 MovieClip Frame 99
stop();
Symbol 124 MovieClip Frame 100
gotoAndPlay (1);
Symbol 136 MovieClip Frame 79
gotoAndPlay (38);
Symbol 139 Button
on (press) {
gotoAndPlay (4);
}