Frame 1
fscommand ("allowScale", false);
stop();
Frame 2
stop();
Symbol 17 MovieClip Frame 1
stop();
Symbol 18 MovieClip [shooterClass] Frame 1
function updatePos() {
if (random(deekChance) == 0) {
vx = -vx;
}
if (((_x + vx) < 30) || (540 < (_x + vx))) {
vx = -vx;
}
_x = (_x + vx);
_y = (_y + vy);
z = z - vz;
}
function scale() {
_xscale = (((maxScale - minScale) * ((-(z - startz)) / startz)) + minScale);
_yscale = (((maxScale - minScale) * ((-(z - startz)) / startz)) + minScale);
}
function shoot() {
_parent.eventSnd.attachSound("shot");
_parent.eventSnd.start();
sprite.gotoAndStop(2);
goalNum = random(goalCount) + 1;
scatterx = (Math.random() * shotChaos) - (shotChaos / 2);
scattery = (Math.random() * shotChaos) - (shotChaos / 2);
targetx = _parent["target" + goalNum]._x + scatterx;
targety = _parent["target" + goalNum]._y + scattery;
_parent.attachMovie("ballClass", "ball", 11);
_parent.ball._x = _x;
_parent.ball._y = _y;
_parent.ball.z = shotDepth;
_parent.ball.goalNum = goalNum;
_parent.ball.targetx = targetx;
_parent.ball.targety = targety;
typeRoll = random(100);
if (typeRoll < curveChance) {
_parent.ball.type = "curve";
} else if (typeRoll < (curveChance + spiralChance)) {
_parent.ball.type = "spiral";
} else if (typeRoll < ((curveChance + spiralChance) + fastChance)) {
_parent.ball.type = "fast";
} else {
_parent.ball.type = "line";
}
iconRoll = random(100);
if (iconRoll < bludgerChance) {
_parent.ball.iconID = 2;
} else if (iconRoll < (bludgerChance + bonus1Chance)) {
_parent.ball.iconID = 3;
} else if (iconRoll < ((bludgerChance + bonus1Chance) + bonus2Chance)) {
_parent.ball.iconID = 4;
} else if (iconRoll < (((bludgerChance + bonus1Chance) + bonus2Chance) + bonus3Chance)) {
_parent.ball.iconID = 5;
} else {
_parent.ball.iconID = 1;
}
_parent.ball.icon.gotoAndStop(_parent.ball.iconID);
}
function exitStage() {
if (exitDir == 0) {
sprite.gotoAndStop(3);
vx = vx - 0.5;
} else {
sprite.gotoAndStop(4);
vx = vx + 0.5;
}
_x = (_x + vx);
_y = (_y + vy);
z = z - vz;
}
function control() {
if (shotDepth < z) {
updatePos();
scale();
} else if (!shotBool) {
shoot();
shotBool = true;
exitDir = random(2);
} else {
exitStage();
scale();
}
}
minScale = 50;
maxScale = 100;
shotBool = false;
goalCount = _parent.levelData.goalCount;
speed = _parent.levelData.flightSpeed;
deekChance = _parent.levelData.deekChance;
xvar = _parent.levelData.xvar;
yvar = _parent.levelData.yvar;
shotRange = _parent.levelData.shotRange;
shotChaos = _parent.levelData.shotChaos;
curveChance = _parent.levelData.curveChance;
spiralChance = _parent.levelData.spiralChance;
fastChance = _parent.levelData.fastChance;
bludgerChance = _parent.levelData.bludgerChance;
bonus1Chance = _parent.levelData.bonus1Chance;
bonus2Chance = _parent.levelData.bonus2Chance;
bonus3Chance = _parent.levelData.bonus3Chance;
_x = ((Math.random() * 400) + 75);
_y = (Math.random() * 150);
z = 1000 - shotRange;
startz = z;
vx = (Math.random() * xvar) - (xvar / 2);
vy = (Math.random() * yvar) + 0.2;
vz = speed;
shotVar = Math.random() * shotRange;
shotDepth = 500 - shotVar;
scale();
Symbol 18 MovieClip [shooterClass] Frame 2
control();
Symbol 18 MovieClip [shooterClass] Frame 3
control();
gotoAndPlay(_currentframe - 1);
Symbol 62 MovieClip Frame 1
stop();
Symbol 63 MovieClip [ballClass] Frame 1
function setVectors() {
vx = targetx - _x;
vy = targety - _y;
vz = targetz - z;
}
function distance() {
var tx;
var ty;
var tz;
var dist;
var tx = (Math.abs(vx) * 1024);
var ty = (Math.abs(vy) * 1024);
var tz = (Math.abs(vz) * 1024);
if (ty < tx) {
tx = ty;
}
if (tz < ty) {
tz = ty;
}
if (ty < tx) {
tx = ty;
}
dist = (tz + (11 * (ty >> 5))) + (tx >> 2);
v = dist >> 10;
}
function setNormals() {
nx = vx / v;
ny = vy / v;
nz = vz / v;
}
function scaleBall() {
_xscale = (((maxScale - minScale) * ((-(z - shotz)) / shotz)) + minScale);
_yscale = (((maxScale - minScale) * ((-(z - shotz)) / shotz)) + minScale);
}
function spiral() {
xshift = speed / (Math.abs(v) / offset);
_rotation = (_rotation + spin);
icon._x = icon._x - xshift;
}
function curve() {
xshift = speed / (Math.abs(v) / offset);
icon._x = icon._x - xshift;
}
function updatePos() {
if (type == "curve") {
curve();
} else if (type == "spiral") {
spiral();
}
_x = (_x + (nx * speed));
_y = (_y + (ny * speed));
z = z + (nz * speed);
scaleBall();
}
function control() {
updatePos();
if (targetz < z) {
if (z < blockRange) {
_parent.blockLight.gotoAndStop(2);
blockable = true;
}
} else {
atTarget = true;
this.swapDepths(30);
_parent.blockLight.gotoAndStop(1);
}
if ((_xscale < 0) || (z < -400)) {
_parent.envInit();
if (jumpState) {
_parent.shooter.removeMovieClip();
_parent.state = 2;
this.removeMovieClip();
} else {
_parent.spawnShooter();
this.removeMovieClip();
}
}
}
shotz = z;
blockable = false;
atTarget = false;
blocked = false;
jumpState = false;
_parent.blockTested = false;
minScale = 20;
maxScale = 100;
speed = _parent.levelData.speed;
blockRange = _parent.levelData.blockRange;
if (type == "fast") {
speed = speed * 1.5;
}
targetz = 1;
setVectors();
distance();
setNormals();
scaleBall();
if (type == "spiral") {
offset = 100;
icon._x = offset;
spin = 15;
if (random(2) == 0) {
spin = -spin;
}
} else if (type == "curve") {
offset = 400;
if (targetx < _x) {
offset = -offset;
}
icon._x = offset;
}
Symbol 63 MovieClip [ballClass] Frame 2
control();
Symbol 63 MovieClip [ballClass] Frame 3
control();
gotoAndPlay(_currentframe - 1);
Symbol 76 Button
on (press) {
_parent.input = 1;
}
Symbol 85 MovieClip Frame 4
_parent._parent.input = 0;
_parent.gotoAndStop(1);
Symbol 98 MovieClip Frame 6
_parent._parent.input = 0;
_parent.gotoAndStop(1);
Symbol 99 MovieClip [keeperClass] Frame 1
stop();
Symbol 113 Button
on (release) {
_parent._parent.gameInit();
_parent._parent.state = 1;
_parent.removeMovieClip();
}
Symbol 114 MovieClip Frame 45
stop();
Symbol 120 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 120 MovieClip Frame 2
gotoAndPlay(_currentframe - 1);
Symbol 154 MovieClip Frame 1
stop();
Symbol 161 MovieClip Frame 1
stop();
Symbol 169 MovieClip Frame 1
stop();
Symbol 174 Button
on (release) {
play();
}
Symbol 177 Button
on (release) {
_parent._parent.gameInit();
_parent._parent.state = 1;
_parent._visible = 0;
}
Symbol 182 Button
on (release) {
nextFrame();
}
Symbol 201 MovieClip Frame 1
stop();
Symbol 202 MovieClip Frame 1
stop();
Symbol 202 MovieClip Frame 11
stop();
Symbol 204 MovieClip Frame 1
function initLvl() {
level++;
HUD.gems.gotoAndStop(level);
HUD.clock.gotoAndStop(1);
saveRange = 55;
target1.swapDepths(25);
target2.swapDepths(26);
target3.swapDepths(27);
HUD.swapDepths(40);
if (level == 1) {
levelSnd.attachSound("firstLevel");
levelSnd.start();
msg_box._visible = true;
blockLight._visible = true;
game_msg = "Niveau entraînement\nUtilise la pierre précieuse pour décider quand bloquer";
levelData.goalCount = 3;
levelData.flightSpeed = 5;
levelData.deekChance = 10;
levelData.xvar = 5;
levelData.yvar = 1;
levelData.shotRange = 0;
levelData.shotChaos = 100;
levelData.curveChance = 0;
levelData.spiralChance = 0;
levelData.fastChance = 0;
levelData.bludgerChance = 0;
levelData.bonus1Chance = 0;
levelData.bonus2Chance = 0;
levelData.bonus3Chance = 0;
levelData.speed = 15;
levelData.blockRange = 200;
} else if (level == 2) {
levelSnd.attachSound("level");
levelSnd.start();
msg_box._visible = true;
blockLight._visible = false;
game_msg = "Bon travail !\nMaintenant essaie sans la pierre précieuse !";
levelData.goalCount = 3;
levelData.flightSpeed = 7;
levelData.deekChance = 10;
levelData.xvar = 5;
levelData.yvar = 1;
levelData.shotRange = 50;
levelData.shotChaos = 85;
levelData.curveChance = 0;
levelData.spiralChance = 0;
levelData.fastChance = 0;
levelData.bludgerChance = 0;
levelData.bonus1Chance = 0;
levelData.bonus2Chance = 0;
levelData.bonus3Chance = 0;
levelData.speed = 17;
levelData.blockRange = 200;
} else if (level == 3) {
levelSnd.attachSound("level");
levelSnd.start();
msg_box._visible = 1;
game_msg = "Ça y est, tu as compris !\nAttrape des prix avec la barre d'ESPACEMENT";
levelData.goalCount = 3;
levelData.flightSpeed = 8;
levelData.deekChance = 15;
levelData.xvar = 7;
levelData.yvar = 1;
levelData.shotRange = 75;
levelData.shotChaos = 75;
levelData.curveChance = 0;
levelData.spiralChance = 0;
levelData.fastChance = 3;
levelData.bludgerChance = 0;
levelData.bonus1Chance = 15;
levelData.bonus2Chance = 10;
levelData.bonus3Chance = 5;
levelData.speed = 18;
levelData.blockRange = 200;
} else if (level == 4) {
levelSnd.attachSound("level");
levelSnd.start();
msg_box._visible = 1;
game_msg = "Bravo !\nFais attention aux balles en courbe !";
levelData.goalCount = 3;
levelData.flightSpeed = 9;
levelData.deekChance = 25;
levelData.xvar = 7;
levelData.yvar = 1;
levelData.shotRange = 75;
levelData.shotChaos = 50;
levelData.curveChance = 20;
levelData.spiralChance = 0;
levelData.fastChance = 3;
levelData.bludgerChance = 0;
levelData.bonus1Chance = 7;
levelData.bonus2Chance = 5;
levelData.bonus3Chance = 2;
levelData.speed = 19;
levelData.blockRange = 200;
} else if (level == 5) {
levelSnd.attachSound("level");
levelSnd.start();
msg_box._visible = 1;
game_msg = "Tu te débrouilles bien !\nNe te fais pas toucher par le Cognard !";
levelData.goalCount = 3;
levelData.flightSpeed = 10;
levelData.deekChance = 27;
levelData.xvar = 8;
levelData.yvar = 1;
levelData.shotRange = 85;
levelData.shotChaos = 40;
levelData.curveChance = 20;
levelData.spiralChance = 0;
levelData.fastChance = 3;
levelData.bludgerChance = 25;
levelData.bonus1Chance = 7;
levelData.bonus2Chance = 5;
levelData.bonus3Chance = 2;
levelData.speed = 19;
levelData.blockRange = 200;
} else if (level == 6) {
levelSnd.attachSound("level");
levelSnd.start();
msg_box._visible = 1;
game_msg = "Fais attention aux balles rapides !";
levelData.goalCount = 3;
levelData.flightSpeed = 12;
levelData.deekChance = 30;
levelData.xvar = 9;
levelData.yvar = 1;
levelData.shotRange = 100;
levelData.shotChaos = 40;
levelData.curveChance = 20;
levelData.spiralChance = 0;
levelData.fastChance = 20;
levelData.bludgerChance = 10;
levelData.bonus1Chance = 5;
levelData.bonus2Chance = 3;
levelData.bonus3Chance = 2;
levelData.speed = 19;
levelData.blockRange = 200;
} else if (level == 7) {
levelSnd.attachSound("level");
levelSnd.start();
msg_box._visible = 1;
game_msg = "Excellent travail !\nPrépare-toi aux balles jointure !";
levelData.goalCount = 3;
levelData.flightSpeed = 14;
levelData.deekChance = 35;
levelData.xvar = 10;
levelData.yvar = 1;
levelData.shotRange = 100;
levelData.shotChaos = 40;
levelData.curveChance = 25;
levelData.spiralChance = 25;
levelData.fastChance = 25;
levelData.bludgerChance = 15;
levelData.bonus1Chance = 7;
levelData.bonus2Chance = 5;
levelData.bonus3Chance = 2;
levelData.speed = 19;
levelData.blockRange = 200;
} else if (level == 8) {
levelSnd.attachSound("level");
levelSnd.start();
msg_box._visible = 1;
game_msg = "Encore un essai et tu fais partie de l'équipe !";
levelData.goalCount = 3;
levelData.flightSpeed = 16;
levelData.deekChance = 35;
levelData.xvar = 10;
levelData.yvar = 1;
levelData.shotRange = 120;
levelData.shotChaos = 40;
levelData.curveChance = 15;
levelData.spiralChance = 20;
levelData.fastChance = 20;
levelData.bludgerChance = 7;
levelData.bonus1Chance = 5;
levelData.bonus2Chance = 2;
levelData.bonus3Chance = 1;
levelData.speed = 20;
levelData.blockRange = 200;
}
levelSet = true;
}
function resetGame() {
blockLight.gotoAndStop(1);
keyHit = false;
blockTested = false;
}
function gameInit() {
Mouse.hide();
this.attachMovie("keeperClass", "keeper", 20);
loadMovieNum ("clock.swf", 2);
keeper.startDrag(true);
lives = 3;
score = 0;
lifeBonus = 1000;
level = 0;
msg_box._visible = 0;
levelSet = false;
ambSnd.attachSound("ambientLoop");
ambSnd.start(0, 999);
state = 1;
}
function randomGoalMsg() {
var case = random(5);
if (case == 0) {
deathMsg = "Oh non !! Ils ont marqué !";
} else if (case == 1) {
deathMsg = "Oops ! Celle-ci est passée à travers le filet…";
} else if (case == 2) {
deathMsg = "Tu l'as manquée d'un cheveu";
} else if (case == 3) {
deathMsg = "Là, tu avais presque réussi…";
} else {
deathMsg = "La perfection vient avec l'entraînement…";
}
}
function envInit() {
livesCounter.gotoAndStop(lives + 1);
blockLight.gotoAndStop(1);
keyHit = false;
blockTested = false;
randomGoalMsg();
}
function timer() {
time = getTimer() - controlTime;
clockFrame = int((time / timeLimit) * _level2.clock._totalframes) + 1;
_level2.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 spawnShooter() {
this.attachMovie("shooterClass", "shooter", 10);
}
function getInputEvent() {
if (key.isDown(key.SPACE) && (keyHit == false)) {
input = 2;
keyHit = true;
} else if (input == 0) {
keyHit = false;
}
if (((input == 1) || (Key.isDown(66))) || (Key.isDown(98))) {
blocking = 1;
keeper.gotoAndStop(2);
} else if (input == 2) {
blocking = 2;
keeper.gotoAndStop(3);
} else {
blocking = 0;
keeper.gotoAndStop(1);
}
}
function setKeeperBank() {
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);
keeper._rotation = bank;
if (5 < mousedx) {
keeper._xscale = 100;
} else if (mousedx < -5) {
keeper._xscale = -100;
}
}
function keeperInRange() {
ball.point = new Object();
ball.point.x = ball.icon._x;
ball.point.y = ball.icon._y;
ball.localToGlobal(ball.point);
var dx = Math.abs(ball.point.x - keeper._x);
var dy = Math.abs(ball.point.y - keeper._y);
if (saveRange >= distance(dx, dy)) {
return(true);
}
return(false);
}
function distance(x, y) {
var mn = Math.min(x, y);
return((((x + y) - (mn >> 1)) - (mn >> 2)) + (mn >> 4));
}
function shotOnGoal() {
var x = (ball.targetx - this["target" + ball.goalNum]._x);
var y = (ball.targety - this["target" + ball.goalNum]._y);
var r = (target1._width / 2);
var shotTest = ((x * x) + (y * y));
var shotLimit = (r * r);
if (shotLimit >= shotTest) {
return(true);
}
return(false);
}
function Blocked() {
if (ball.iconID == 1) {
if ((blocking == 1) && (keeperInRange())) {
ball.vx = ball.vx - ((Math.random() * 100) + 100);
ball.vy = (-ball.vy) + ((Math.random() * 200) - 100);
ball.vz = (-ball.vz) + ((Math.random() * 200) - 100);
ball.setNormals();
ball.blocked = true;
eventSnd.attachSound("Hit");
eventSnd.start();
score = score + (pointsForBlock * level);
blockTested = true;
return(true);
}
if (ball.atTarget) {
if (shotOnGoal()) {
eventSnd.attachSound("miss");
eventSnd.start();
game_msg = (DeathMsg + newline) + "Essaie encore !";
blockTested = true;
return(false);
}
blockTested = true;
return(true);
}
return(true);
}
if (ball.iconID == 2) {
if (keeperInRange()) {
eventSnd.attachSound("personHit");
eventSnd.start();
game_msg = "OH NON ! Le Cognard t'a touché !\nÇa fait mal !";
blockTested = true;
return(false);
}
score = score + (pointsForDodge * level);
blockTested = true;
return(true);
}
if ((blocking == 2) && (keeperInRange())) {
ball._visible = false;
eventSnd.attachSound("bonus");
eventSnd.start();
if (ball.iconID == 2) {
score = score + (pointsForBonus * level);
} else if (ball.iconID == 3) {
score = score + ((pointsForBonus * level) * 2);
} else {
score = score + ((pointsForBonus * level) * 3);
}
blockTested = true;
return(true);
}
blockTested = true;
return(true);
}
function cleanUp() {
ambSnd.stop("ambientLoop");
keeper.removeMovieClip();
unloadMovieNum (2);
if (level < 4) {
endMsg = "Pas mal, mais un peu plus d'entraînement ne te ferait pas de mal ! Clique sur \"rejouer\" pour te perfectionner . ";
} else if (level < 6) {
endMsg = "Bon travail ! Tu apprends vite mais tu peux encore t'améliorer ! Clique sur \"Rejouer\" pour t'entraîner encore. ";
} else if (level < 7) {
endMsg = ("Formidable ! Tu es un candidat de premier choix pour faire partie de l'équipe de Quidditch de ta maison ! Encore " + (8 - level)) + " niveaux et tu auras gagné la partie ! Clique sur \"rejouer\" pour continuer à t'entraîner.";
} else {
endMsg = "C'était fantastique !! \nAprès une telle performance, ta maison est sûre de gagner la coupe de Quidditch cette année !";
}
this.attachMovie("endScreen", "endGame", 50);
Mouse.show();
}
fscommand ("allowScale", false);
MOV_WIDTH = 570;
MOV_HEIGHT = 475;
timeLimit = 30000;
pointsForBlock = 5;
pointsForDodge = 7;
pointsForBonus = 10;
state = 0;
levelSnd = new Sound();
eventSnd = new Sound();
ambSnd = new Sound();
levelSnd.setVolume(25);
levelData = new Object();
resetGame();
function control() {
if (state == 1) {
shooter.removeMovieClip();
ball.removeMovieClip();
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;
spawnShooter();
state = 3;
}
} else if (state == 2) {
lives--;
if (lives == 0) {
levelSnd.attachSound("gameOver");
levelSnd.start();
state = 5;
} else {
msg_box._visible = true;
envInit();
state = 4;
}
} else if (state == 3) {
timer();
getInputEvent();
if ((((blocking != 0) && (ball.blockable)) && (!blockTested)) || (ball.atTarget && (!blockTested))) {
if (!Blocked()) {
ball.jumpState = true;
}
}
if (score >= lifeBonus) {
eventSnd.attachSound("life");
eventSnd.start();
lives++;
livesCounter.gotoAndStop(lives + 1);
lifeBonus = lifeBonus * 2;
}
} else if (state == 4) {
if (pause(3000)) {
msg_box._visible = false;
spawnShooter();
state = 3;
}
} else if (state == 5) {
cleanUp();
state = 0;
}
setKeeperBank();
}
Symbol 204 MovieClip Frame 2
control();
Symbol 204 MovieClip Frame 3
control();
gotoAndPlay(_currentframe - 1);