Frame 1
stop();
Frame 2
stop();
Symbol 12 MovieClip Frame 1
fileSize = _root.getBytesTotal();
loaded = _root.getBytesLoaded();
percent = int((loaded / fileSize) * 100) + "%";
if (loaded < fileSize) {
bar._xscale = (loaded / fileSize) * 100;
} else {
_root.play();
}
Symbol 12 MovieClip Frame 2
gotoAndPlay(_currentframe - 1);
Symbol 23 MovieClip Frame 1
stop();
Symbol 24 MovieClip Frame 1
stop();
Symbol 27 MovieClip Frame 1
stop();
Symbol 36 MovieClip Frame 1
stop();
Symbol 36 MovieClip Frame 50
gotoAndStop (1);
Symbol 41 MovieClip Frame 1
stop();
Symbol 41 MovieClip Frame 10
gotoAndStop (1);
Symbol 56 Button
on (release) {
_parent._parent.gameInit();
_parent._parent.state = 1;
_parent._visible = 0;
}
Symbol 57 MovieClip Frame 1
stop();
Symbol 57 MovieClip Frame 45
stop();
Symbol 58 MovieClip Frame 1
_visible = 0;
Symbol 58 MovieClip Frame 2
if ((_visible == 1) && (trigger == 0)) {
text.play();
trigger = 1;
} else if (_visible == 0) {
text.gotoAndStop(1);
trigger = 0;
}
Symbol 58 MovieClip Frame 3
gotoAndPlay(_currentframe - 1);
Symbol 85 MovieClip Frame 1
stop();
Symbol 96 MovieClip Frame 1
stop();
Symbol 104 Button
on (release) {
play();
}
Symbol 107 Button
on (release) {
_parent._parent.gameInit();
_parent._parent.state = 1;
_parent._visible = 0;
}
Symbol 112 MovieClip Frame 1
stop();
Symbol 112 MovieClip Frame 11
stop();
Symbol 114 MovieClip Frame 1
function initLvl() {
level++;
HUD.gems.gotoAndStop(level);
HUD.clock.gotoAndStop(1);
if (level == 1) {
levelSnd.attachSound("firstLevel");
levelSnd.start();
msg_box._visible = 1;
game_msg = "Prèpare-toi pour le Niveau 1!\nProtége les Poursuiveurs du Cognard !";
timeLimit = 30000;
ball_cnt = 1;
maxBallSpeed = 6;
ballChaos = 10;
trackSpeed = 1;
comp_cnt = 1;
compSpeed = 5;
path0 = new Array("p1", "p2");
targetIndex0 = 1;
comp0Target = path0[targetIndex0];
comp0._x = this[path0[0]]._x;
comp0._y = this[path0[0]]._y;
comp0.vx = this[comp0Target]._x - comp0._x;
comp0.vy = this[comp0Target]._y - comp0._y;
normVector(comp0, 0);
} else if (level == 2) {
levelSnd.attachSound("level");
levelSnd.start();
msg_box._visible = 1;
game_msg = "Bien joué !\nPrépare-toi pour le niveau 2";
timeLimit = 30000;
ball_cnt = 1;
maxBallSpeed = 7;
ballChaos = 10;
trackSpeed = 1.5;
comp_cnt = 1;
compSpeed = 5;
path0 = new Array("p3", "p4", "p5", "p6");
targetIndex0 = 1;
comp0Target = path0[targetIndex0];
comp0._x = this[path0[0]]._x;
comp0._y = this[path0[0]]._y;
comp0.vx = this[comp0Target]._x - comp0._x;
comp0.vy = this[comp0Target]._y - comp0._y;
normVector(comp0, 0);
} else if (level == 3) {
levelSnd.attachSound("level");
levelSnd.start();
msg_box._visible = 1;
game_msg = "Niveau 3\nUn nouveau Poursuiveur à défendre !";
timeLimit = 30000;
ball_cnt = 1;
maxBallSpeed = 6;
ballChaos = 15;
trackSpeed = 2;
comp_cnt = 2;
compSpeed = 5;
path0 = new Array("p7", "p8");
path1 = new Array("p9", "p10");
targetIndex0 = 1;
targetIndex1 = 1;
comp0Target = path0[targetIndex0];
comp1Target = path1[targetIndex1];
comp0._x = this[path0[0]]._x;
comp0._y = this[path0[0]]._y;
comp1._x = this[path1[0]]._x;
comp1._y = this[path1[0]]._y;
comp0.vx = this[comp0Target]._x - comp0._x;
comp0.vy = this[comp0Target]._y - comp0._y;
comp1.vx = this[comp1Target]._x - comp1._x;
comp1.vy = this[comp1Target]._y - comp1._y;
normVector(comp0, 0);
normVector(comp1, 0);
} else if (level == 4) {
levelSnd.attachSound("level");
levelSnd.start();
msg_box._visible = 1;
game_msg = "Génial !\nPassons au niveau 4";
timeLimit = 30000;
ball_cnt = 1;
maxBallSpeed = 7;
ballChaos = 20;
trackSpeed = 2.5;
comp_cnt = 2;
compSpeed = 3;
path0 = new Array("p11", "p12");
path1 = new Array("p13", "p14");
targetIndex0 = 1;
targetIndex1 = 1;
comp0Target = path0[targetIndex0];
comp1Target = path1[targetIndex1];
comp0._x = this[path0[0]]._x;
comp0._y = this[path0[0]]._y;
comp1._x = this[path1[0]]._x;
comp1._y = this[path1[0]]._y;
comp0.vx = this[comp0Target]._x - comp0._x;
comp0.vy = this[comp0Target]._y - comp0._y;
comp1.vx = this[comp1Target]._x - comp1._x;
comp1.vy = this[comp1Target]._y - comp1._y;
normVector(comp0, 0);
normVector(comp1, 0);
} else if (level == 5) {
levelSnd.attachSound("level");
levelSnd.start();
msg_box._visible = 1;
game_msg = "Niveau 5\nIl y a maintenant deux Cognards à surveiller !";
timeLimit = 30000;
ball_cnt = 2;
maxBallSpeed = 6;
ballChaos = 10;
trackSpeed = 1;
comp_cnt = 1;
comp1._x = -200;
compSpeed = 5;
path0 = new Array("p15", "p16");
targetIndex0 = 1;
comp0Target = path0[targetIndex0];
comp0._x = this[path0[0]]._x;
comp0._y = this[path0[0]]._y;
comp0.vx = this[comp0Target]._x - comp0._x;
comp0.vy = this[comp0Target]._y - comp0._y;
normVector(comp0, 0);
} else if (level == 6) {
levelSnd.attachSound("level");
levelSnd.start();
msg_box._visible = 1;
game_msg = "Bravo ! Tu as réussi à atteindre le Niveau 6 !";
timeLimit = 30000;
ball_cnt = 2;
maxBallSpeed = 7;
ballChaos = 12;
trackSpeed = 1.5;
comp_cnt = 1;
compSpeed = 5;
path0 = new Array("p17", "p18", "p19", "p20");
targetIndex0 = 1;
comp0Target = path0[targetIndex0];
comp0._x = this[path0[0]]._x;
comp0._y = this[path0[0]]._y;
comp0.vx = this[comp0Target]._x - comp0._x;
comp0.vy = this[comp0Target]._y - comp0._y;
normVector(comp0, 0);
} else if (level == 7) {
levelSnd.attachSound("level");
levelSnd.start();
msg_box._visible = 1;
game_msg = "Niveau 7\nIl n’en reste plus qu'un !";
timeLimit = 30000;
ball_cnt = 2;
maxBallSpeed = 6;
ballChaos = 15;
trackSpeed = 2;
comp_cnt = 2;
compSpeed = 5;
path0 = new Array("p21", "p22");
path1 = new Array("p23", "p24");
targetIndex0 = 1;
targetIndex1 = 1;
comp0Target = path0[targetIndex0];
comp1Target = path1[targetIndex1];
comp0._x = this[path0[0]]._x;
comp0._y = this[path0[0]]._y;
comp1._x = this[path1[0]]._x;
comp1._y = this[path1[0]]._y;
comp0.vx = this[comp0Target]._x - comp0._x;
comp0.vy = this[comp0Target]._y - comp0._y;
comp1.vx = this[comp1Target]._x - comp1._x;
comp1.vy = this[comp1Target]._y - comp1._y;
normVector(comp0, 0);
normVector(comp1, 0);
} else if (level == 8) {
levelSnd.attachSound("level");
levelSnd.start();
msg_box._visible = 1;
game_msg = "Tu es vraiment doué !\nNiveau 8";
timeLimit = 30000;
ball_cnt = 2;
maxBallSpeed = 7;
ballChaos = 20;
trackSpeed = 2.5;
comp_cnt = 2;
compSpeed = 5;
path0 = new Array("p25", "p26");
path1 = new Array("p27", "p28");
targetIndex0 = 1;
targetIndex1 = 1;
comp0Target = path0[targetIndex0];
comp1Target = path1[targetIndex1];
comp0._x = this[path0[0]]._x;
comp0._y = this[path0[0]]._y;
comp1._x = this[path1[0]]._x;
comp1._y = this[path1[0]]._y;
comp0.vx = this[comp0Target]._x - comp0._x;
comp0.vy = this[comp0Target]._y - comp0._y;
comp1.vx = this[comp1Target]._x - comp1._x;
comp1.vy = this[comp1Target]._y - comp1._y;
normVector(comp0, 0);
normVector(comp1, 0);
}
levelSet = true;
}
function normVector(obj, type) {
if (obj.vx == 0) {
var x = 0.1;
} else {
var x = obj.vx;
}
if (obj.vy == 0) {
var y = 0.1;
} else {
var y = obj.vy;
}
var v = Math.sqrt(Math.pow(Math.abs(x), 2) + Math.pow(Math.abs(y), 2));
if (type == 0) {
if (x < 0) {
obj.nx = (-x) / v;
} else {
obj.nx = x / v;
}
if (y < 0) {
obj.ny = (-y) / v;
} else {
obj.ny = y / v;
}
} else {
obj.nx = x / v;
obj.ny = y / v;
}
obj.vx = obj.nx * 10;
obj.vy = obj.ny * 10;
}
function gameInit() {
lives = 3;
score = 0;
disTime = ":00";
level = 0;
msg_box._visible = 0;
levelSet = false;
compHit = false;
comp1._x = -200;
ball1._x = -200;
ambSnd.attachSound("ambientLoop");
ambSnd.start(0, 999);
}
function randomDeathMsg() {
var case = random(5);
if (case == 0) {
deathMsg = "HÉ !";
} else if (case == 1) {
deathMsg = "OUILLE !";
} else if (case == 2) {
deathMsg = "AÏE !";
} else if (case == 3) {
deathMsg = "OH NON !";
} else {
deathMsg = "HOUPS !";
}
}
function envInit() {
randomDeathMsg();
i = 1;
while (ball_cnt >= i) {
this["ball" + i]._x = random(MOV_WIDTH);
this["ball" + i]._y = random(50) + 400;
this["ball" + i].vx = (random(51) - 25) * 0.1;
this["ball" + i].vy = (-random(101)) * 0.1;
normVector(this["ball" + i], 0);
i++;
}
}
function timer() {
time = getTimer() - controlTime;
if (time < 10000) {
disTime = ":0" + int(time * 0.001);
} else {
disTime = ":" + int(time * 0.001);
}
clockFrame = int((time / timeLimit) * HUD.clock._totalframes) + 1;
HUD.clock.gotoAndStop(clockFrame);
if (time >= timeLimit) {
controlTime = getTimer();
state = 1;
}
}
function pause(limit) {
var myTime;
if (!timeGate) {
pauseControl = getTimer();
timeGate = true;
return(false);
}
myTime = getTimer() - pauseControl;
if (myTime >= limit) {
timeGate = false;
controlTime = controlTime + limit;
return(true);
}
return(false);
}
function setCompPos() {
i = 0;
while (i < comp_cnt) {
if (this["comp" + i]._x < this[this[("comp" + i) + "Target"]]._x) {
this["comp" + i]._x = this["comp" + i]._x + (compSpeed * this["comp" + i].nx);
} else {
this["comp" + i]._x = this["comp" + i]._x - (compSpeed * this["comp" + i].nx);
}
if (this["comp" + i]._y < this[this[("comp" + i) + "Target"]]._y) {
this["comp" + i]._y = this["comp" + i]._y + (compSpeed * this["comp" + i].ny);
} else {
this["comp" + i]._y = this["comp" + i]._y - (compSpeed * this["comp" + i].ny);
}
if ((((this["comp" + i]._x < (this[this[("comp" + i) + "Target"]]._x + (compSpeed * 2))) && ((this[this[("comp" + i) + "Target"]]._x - (compSpeed * 2)) < this["comp" + i]._x)) && (this["comp" + i]._y < (this[this[("comp" + i) + "Target"]]._y + (compSpeed * 2)))) && ((this[this[("comp" + i) + "Target"]]._y - (compSpeed * 2)) < this["comp" + i]._y)) {
if (this["targetIndex" + i] < (this["path" + i].length - 1)) {
this["targetIndex" + i]++;
} else {
this["targetIndex" + i] = 0;
}
this[("comp" + i) + "Target"] = this["path" + i][this["targetIndex" + i]];
this["comp" + i].vx = this[("comp" + i) + "Target"]._x - this["comp" + i]._x;
this["comp" + i].vy = this[("comp" + i) + "Target"]._y - this["comp" + i]._y;
normVector("comp" + i, 0);
}
i++;
}
}
function collision() {
i = 1;
while (ball_cnt >= i) {
if ((-gutter) >= this["ball" + i]._x) {
this["ball" + i].vx = -this["ball" + i].vx;
this["ball" + i].nx = -this["ball" + i].nx;
this["ball" + i]._x = (-gutter) + (this["ball" + i]._width / 2);
} else if (this["ball" + i]._x >= (MOV_WIDTH + gutter)) {
this["ball" + i].vx = -this["ball" + i].vx;
this["ball" + i].nx = -this["ball" + i].nx;
this["ball" + i]._x = MOV_WIDTH + gutter;
}
if ((-gutter) >= this["ball" + i]._y) {
this["ball" + i].vy = -this["ball" + i].vy;
this["ball" + i].ny = -this["ball" + i].ny;
this["ball" + i]._y = (-gutter) + (this["ball" + i]._width / 2);
} else if (this["ball" + i]._y >= (MOV_HEIGHT + gutter)) {
this["ball" + i].vy = -this["ball" + i].vy;
this["ball" + i].ny = -this["ball" + i].ny;
this["ball" + i]._y = MOV_HEIGHT + gutter;
}
if (this["hit" + i]) {
this["ball" + i].vx = -this["ball" + i].vx;
this["ball" + i].vy = -this["ball" + i].vy;
this["ball" + i].nx = -this["ball" + i].nx;
this["ball" + i].ny = -this["ball" + i].ny;
this["ball" + i]._x = this["ball" + i]._x + (sprite1._width * this["ball" + i].nx);
this["ball" + i]._y = this["ball" + i]._y + (sprite1._width * this["ball" + i].ny);
if (!this["ball" + i].hitTest(sprite1)) {
this["hit" + i] = false;
}
} else if (this["ball" + i].hitTest(sprite1)) {
eventSnd.attachSound("Hit");
eventSnd.start();
sprite1.beater.club.play();
score++;
this["hit" + i] = true;
}
if (compHit) {
if (!this["ball" + i].hitTest(comp0)) {
compHit = false;
state = 2;
}
if (!this["ball" + i].hitTest(comp1)) {
compHit = false;
state = 2;
}
} else {
if (this["ball" + i].hitTest(comp0)) {
eventSnd.attachSound("personHit");
eventSnd.start();
comp0.animation.msg = deathMsg;
comp0.animation.play();
compHit = true;
state = 2;
}
if (this["ball" + i].hitTest(comp1)) {
eventSnd.attachSound("personHit");
eventSnd.start();
comp1.animation.msg = deathMsg;
comp1.animation.play();
compHit = true;
state = 2;
}
}
i++;
}
}
function setBallPos() {
ball1._x = ball1._x + (ball1.nx * maxBallSpeed);
ball1._y = ball1._y + (ball1.ny * maxBallSpeed);
ball2._x = ball2._x + (ball2.nx * maxBallSpeed);
ball2._y = ball2._y + (ball2.ny * maxBallSpeed);
}
function bludgerAI() {
i = 1;
while (ball_cnt >= i) {
if (25 >= random(101)) {
this["ball" + i].vx = this["ball" + i].vx + (random(ballChaos) - (ballChaos / 2));
}
if (10 >= random(101)) {
this["ball" + i].vy = this["ball" + i].vy + (random(ballChaos) - (ballChaos / 2));
}
var tV = {vx:comp0._x - this["ball" + i]._x, vy:comp0._y - this["ball" + i]._y};
normVector(tV, 0);
var xTrack = (tV.nx * trackSpeed);
var yTrack = (tV.ny * trackSpeed);
if (this["ball" + i]._x < comp0._x) {
this["ball" + i].vx = this["ball" + i].vx + xTrack;
} else {
this["ball" + i].vx = this["ball" + i].vx - xTrack;
}
if (this["ball" + i]._y < comp0._y) {
this["ball" + i].vy = this["ball" + i].vy + yTrack;
} else {
this["ball" + i].vy = this["ball" + i].vy - yTrack;
}
normVector(this["ball" + i], 1);
i++;
}
}
function setPlayerCursor() {
if (mousePass == 1) {
mousex2 = _xmouse;
mousedx = mousex2 - mousex1;
mousex1 = mousex2;
mousePass = 0;
} else {
mousePass = 1;
}
var maxBank = 45;
var maxVel = 100;
var bank = ((mousedx / maxVel) * maxBank);
sprite1._rotation = bank;
if (5 < mousedx) {
sprite1.beater.gotoAndStop(1);
} else if (mousedx < -5) {
sprite1.beater.gotoAndStop(2);
}
}
function bonusCheck() {
var bonusScore = (score - (level * 25));
if (bonusScore == 0) {
bonusSnd.play();
}
}
fscommand ("allowScale", false);
MOV_HEIGHT = 480;
MOV_WIDTH = 640;
gutter = 50;
state = 0;
levelSnd = new Sound();
eventSnd = new Sound();
ambSnd = new Sound();
function control() {
if (state == 1) {
if (8 < level) {
levelSnd.attachSound("cheer");
levelSnd.start();
state = 5;
} else if (!levelSet) {
initLvl();
envInit();
}
if (pause(3000)) {
controlTime = getTimer();
msg_box._visible = 0;
levelSet = false;
state = 3;
}
} else if (state == 2) {
lives--;
if (lives == 0) {
levelSnd.attachSound("gameOver");
levelSnd.start();
state = 5;
} else {
compHit = false;
envInit();
state = 4;
}
} else if (state == 3) {
timer();
setCompPos();
collision();
setBallPos();
bludgerAI();
bonusCheck();
} else if (state == 4) {
if (pause(2000)) {
state = 3;
}
} else if (state == 5) {
ambSnd.stop("ambientLoop");
endgame._visible = 1;
state = 0;
}
setPlayerCursor();
sprite1._x = _xmouse;
sprite1._y = _ymouse;
}
Symbol 114 MovieClip Frame 2
control();
Symbol 114 MovieClip Frame 3
control();
gotoAndPlay(_currentframe - 1);