Frame 1
total = _root.getBytesTotal();
parcial = _root.getBytesLoaded();
escala = (parcial * 100) / total;
_root.barra._xscale = escala;
if (parcial == total) {
gotoAndPlay (3);
}
Frame 2
gotoAndPlay (1);
Frame 3
stop();
Frame 4
function mouNau() {
if (Key.isDown(38)) {
if (_root.targetClip._y > 0) {
_root.targetClip._y = _root.targetClip._y - _root.char.vel;
}
}
if (Key.isDown(40)) {
if (_root.targetClip._y < 300) {
_root.targetClip._y = _root.targetClip._y + _root.char.vel;
}
}
if (Key.isDown(37)) {
if (_root.targetClip._x > 0) {
_root.targetClip._x = _root.targetClip._x - _root.char.vel;
}
}
if (Key.isDown(39)) {
if (_root.targetClip._x < 500) {
_root.targetClip._x = _root.targetClip._x + _root.char.vel;
}
}
if (Key.isDown(17) & (_root.char.status != "dead")) {
if (_root.char.fuel <= 0) {
_root.char.status = "dead";
_root.gameeOver();
}
if (_root.delayShotAct == _root.char.delayShot) {
_root.shot();
_root.char.fuel = _root.char.fuel - 1;
_root.delayShotAct = 0;
} else {
_root.delayShotAct = _root.delayShotAct + 1;
}
} else {
_root.delayShotAct = _root.char.delayShot;
}
_root.nau._x = _root.nau._x + ((_root.targetClip._x - _root.nau._x) / char.multiplicador);
_root.nau._y = _root.nau._y + ((_root.targetClip._y - _root.nau._y) / char.multiplicador);
if ((_root.nau._y < (_root.targetClip._y - 10)) & (_root.nau.moviendo == false)) {
_root.nau.moviendo = true;
_root.nau.gotoAndPlay("bajando");
}
if (((_root.nau._y > (_root.targetClip._y - 10)) & (_root.nau._y < _root.targetClip._y)) & (_root.nau._currentframe != 1)) {
_root.nau.play();
}
if ((_root.nau._y > (_root.targetClip._y + 10)) & (_root.nau.moviendo == false)) {
_root.nau.moviendo = true;
_root.nau.gotoAndPlay("subiendo");
}
if (((_root.nau._y < (_root.targetClip._y + 10)) & (_root.nau._y > _root.targetClip._y)) & (_root.nau._currentframe != 1)) {
_root.nau.play();
}
}
function shot() {
_root.nau.cabina.play();
if (_root.shotNum < 10) {
_root.attachMovie("shot", "shot" + _root.shotNum, _root.shotNum);
_root["shot" + _root.shotNum]._x = _root.nau._x + 16;
_root["shot" + _root.shotNum]._y = _root.nau._y + 3;
_root.shotNum++;
} else {
_root.attachMovie("shot", "shot" + _root.shotNum, _root.shotNum);
_root["shot" + _root.shotNum]._x = _root.nau._x + 16;
_root["shot" + _root.shotNum]._y = _root.nau._y + 3;
_root.shotNum = 1;
}
_root.sample(1, "shot4_Wav");
}
function comprovaColisions() {
i = 0;
while (i <= 10) {
j = 0;
while (j <= 10) {
if (_root.enemyLair["enemy" + j].hitTest(_root["shot" + i]) == true) {
_root.enemyLair["enemy" + j].energy = _root.enemyLair["enemy" + j].energy - 1;
if (_root.enemyLair["enemy" + j].energy == 0) {
_root.enemyLair.attachMovie("exploss", "exploss" + i, i + 100);
scala = random(50) + 50;
_root.enemyLair["exploss" + i]._rotation = random(360);
_root.enemyLair["exploss" + i]._xscale = scala;
_root.enemyLair["exploss" + i]._yscale = scala;
_root.enemyLair["exploss" + i]._x = _root.enemyLair["enemy" + j]._x;
_root.enemyLair["exploss" + i]._y = _root.enemyLair["enemy" + j]._y;
if (_root.enemyLair["enemy" + j].clase == 2) {
_root.itemLair.attachMovie("fuelCell", "fuelCell" + i, i + 100);
_root.itemLair["fuelCell" + i]._x = _root.enemyLair["enemy" + j]._x;
_root.itemLair["fuelCell" + i]._y = _root.enemyLair["enemy" + j]._y;
}
_root.sample(2, "exploss3_wav");
_root.controlScore(_root.enemyLair["enemy" + j].clase);
removeMovieClip(_root.enemyLair["enemy" + j]);
removeMovieClip(_root["shot" + i]);
} else {
_root.enemyLair.attachMovie("impact", "impact" + i, i + 100);
_root.enemyLair["impact" + i]._rotation = random(360);
_root.enemyLair["impact" + i]._x = _root["shot" + i]._x;
_root.enemyLair["impact" + i]._y = _root["shot" + i]._y;
_root.sample(2, "impact2_wav");
removeMovieClip(_root["shot" + i]);
}
}
if (_root.itemLair["fuelCell" + i].hitTest(_root.nau) == true) {
_root.char.fuel = _root.char.fuel + 20;
if (_root.char.fuel > 100) {
_root.char.fuel = 100;
}
_root.sample(2, "pow_up2_wav");
removeMovieClip(_root.itemLair["fuelCell" + i]);
}
if (_root.enemyLair["enemy" + j].hitTest(_root.nau) == true) {
_root.attachMovie("exploss", "explossFinal", i + 100);
_root.explossFinal._x = _root.targetClip._x;
_root.explossFinal._y = _root.targetClip._y;
_root.sample(2, "exploss3_wav");
removeMovieClip(_root.nau);
_root.char.status = "dead";
}
if (_root["shot" + i]._x > 500) {
removeMovieClip(_root["shot" + i]);
}
if (_root.enemyLair["enemyShot" + i].hitTest(_root.nau) == true) {
_root.attachMovie("exploss", "explossFinal", i + 100);
_root.explossFinal._x = _root.targetClip._x;
_root.explossFinal._y = _root.targetClip._y;
_root.sample(2, "exploss3_wav");
removeMovieClip(_root.nau);
removeMovieClip(_root.enemyLair["enemyShot" + i]);
_root.char.status = "dead";
}
j++;
}
i++;
}
}
function sample(c, nombre) {
if (c == 1) {
channel_1 = new Sound();
channel_1.attachSound(nombre);
channel_1.setVolume(_root.volumenGlobal);
channel_1.start();
}
if (c == 2) {
channel_2 = new Sound();
channel_2.attachSound(nombre);
channel_2.setVolume(_root.volumenGlobal);
channel_2.start();
}
if (c == 3) {
channel_3 = new Sound();
channel_3.attachSound(nombre);
channel_3.setVolume(_root.volumenGlobal);
channel_3.start();
}
if (c == 4) {
stopAllSounds();
channel_4 = new Sound();
channel_4.attachSound(nombre);
channel_4.setVolume(_root.volumenGlobal);
channel_4.start(0, 99);
}
}
function creaEnemics() {
if (_root.world.contadorTiempo < _root.world.framesSegundo) {
_root.world.contadorTiempo++;
} else {
_root.world.contadorTiempo = 0;
_root.char.fuel = _root.char.fuel - 1;
if (_root.arrayEnemics[_root.arrayEnemicsPuntero] != 0) {
clase = _root.arrayEnemics[_root.arrayEnemicsPuntero];
d++;
_root.enemyLair.attachMovie("enemy" + clase, "enemy" + d, d);
if (clase == 1) {
_root.enemyLair["enemy" + d].vel = random(5) + 4;
_root.enemyLair["enemy" + d].energy = 1;
} else if (clase == 2) {
_root.enemyLair["enemy" + d].vel = random(7) + 5;
_root.enemyLair["enemy" + d].energy = 1;
} else if (clase == 3) {
_root.enemyLair["enemy" + d].vel = random(5) + 4;
_root.enemyLair["enemy" + d].energy = 3;
} else if (clase == 4) {
_root.enemyLair["enemy" + d].vel = 3;
_root.enemyLair["enemy" + d].energy = 10;
}
_root.enemyLair["enemy" + d].clase = clase;
_root.enemyLair["enemy" + d].index = d;
_root.enemyLair["enemy" + d]._x = 520;
_root.enemyLair["enemy" + d]._y = random(200) + 50;
}
if (_root.arrayEnemicsPuntero != _root.arrayEnemics.length) {
_root.arrayEnemicsPuntero++;
} else {
_root.arrayEnemicsPuntero = 0;
}
}
if (d == 10) {
d = 0;
}
}
function controlGameState() {
_root.hudClip.barraClip._xscale = _root.char.fuel;
if (_root.char.fuel <= 0) {
_root.char.status = "dead";
}
if (_root.char.status == "dead") {
_root.gameOver();
}
}
function controlScore(clase) {
if (clase == 1) {
_root.char.score = _root.char.score + 25;
}
if (clase == 2) {
_root.char.score = _root.char.score + 52;
}
}
function gameOver() {
_root.contadorEnd++;
if (_root.contadorEnd == 20) {
removeMovieClip(_root.nau);
removeMovieClip(_root.enemyLair);
removeMovieClip(_root.hudClip);
removeMovieClip(_root.itemLair);
gotoAndStop (5);
}
}
char = {multiplicador:4, vel:10, delayShot:5, fuel:100, score:0};
world = {friccio:0.8, gravetat:0.2, contadorTiempo:0, framesSegundo:20, currentLevel:1};
_root.arrayEnemics = [1, 2, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 2, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 0, 3, 0, 2, 2, 1, 1, 1, 0, 0, 0, 1, 1];
_root.arrayEnemicsPuntero = 0;
_root.shotNum = 1;
_root.contadorEnd = 0;
_root.volumenGlobal = 100;
_root.attachMovie("empty", "enemyLair", 50);
_root.attachMovie("empty", "itemLair", 70);
_root.attachMovie("nau", "nau", 100);
_root.attachMovie("hudClip", "hudClip", 200);
_root.nau._y = 150;
sample(4, "musica");
Instance of Symbol 69 MovieClip [empty] in Frame 4
onClipEvent (enterFrame) {
_root.creaEnemics();
_root.mouNau();
_root.comprovaColisions();
_root.controlGameState();
}
Symbol 12 MovieClip Frame 5
gotoAndPlay (1);
Symbol 15 MovieClip Frame 5
gotoAndStop (1);
Symbol 16 MovieClip [nau] Frame 1
_root.nau.moviendo = false;
stop();
Symbol 16 MovieClip [nau] Frame 10
stop();
Symbol 16 MovieClip [nau] Frame 19
gotoAndStop (1);
Symbol 16 MovieClip [nau] Frame 30
stop();
Symbol 16 MovieClip [nau] Frame 40
gotoAndStop (1);
Symbol 18 MovieClip [shot] Frame 1
this._x = this._x + 20;
Symbol 18 MovieClip [shot] Frame 2
gotoAndPlay (1);
Symbol 23 MovieClip [enemy2] Frame 1
Symbol 23 MovieClip [enemy2] Frame 2
this._x = this._x - vel;
if (this._x < -30) {
removeMovieClip(this);
}
Symbol 23 MovieClip [enemy2] Frame 3
gotoAndPlay (2);
Symbol 28 MovieClip [enemy4] Frame 1
disparaCada = 5;
contadorTiempo = 0;
velBalas = 6;
angulo = 0;
anguloMov = 0;
j = 0;
Symbol 28 MovieClip [enemy4] Frame 2
this._x = this._x - vel;
this._y = this._y + (vel * Math.cos(anguloMov));
this._rotation = this._rotation + (1 * Math.sin(anguloMov));
anguloMov = anguloMov + 0.1;
if (this._x < -30) {
removeMovieClip(this);
}
if (contadorTiempo == disparaCada) {
contadorTiempo = 0;
if (this._x > _root.nau._x) {
j++;
_root.enemyLair.attachMovie("enemyShot2", "enemyShot" + j, (100 + (index * 10)) + j);
_root.enemyLair["enemyShot" + j]._x = this._x;
_root.enemyLair["enemyShot" + j]._y = this._y;
_root.enemyLair["enemyShot" + j].velX = (velBalas * Math.cos(angulo)) * -1;
_root.enemyLair["enemyShot" + j].velY = (velBalas * Math.sin(angulo)) * -1;
angulo = angulo + 10;
}
} else {
contadorTiempo++;
}
Symbol 28 MovieClip [enemy4] Frame 3
gotoAndPlay (2);
Symbol 30 MovieClip [enemy3] Frame 1
disparaCada = 20;
contadorTiempo = 0;
velBalas = 5;
j = 0;
Symbol 30 MovieClip [enemy3] Frame 2
this._x = this._x - vel;
if (this._x < -30) {
removeMovieClip(this);
}
if (contadorTiempo == disparaCada) {
contadorTiempo = 0;
if (this._x > _root.nau._x) {
j++;
_root.enemyLair.attachMovie("enemyShot1", "enemyShot" + j, (100 + (index * 10)) + j);
_root.enemyLair["enemyShot" + j]._x = this._x;
_root.enemyLair["enemyShot" + j]._y = this._y;
catContiguo = this._x - _root.nau._x;
catOpuesto = this._y - _root.nau._y;
hipotenusa = Math.sqrt((catContiguo * catContiguo) + (catOpuesto * catOpuesto));
angulo = Math.atan(catOpuesto / hipotenusa);
_root.enemyLair["enemyShot" + j].velX = (velBalas * Math.cos(angulo)) * -1;
_root.enemyLair["enemyShot" + j].velY = (velBalas * Math.sin(angulo)) * -1;
}
} else {
contadorTiempo++;
}
Symbol 30 MovieClip [enemy3] Frame 3
gotoAndPlay (2);
Symbol 33 MovieClip [enemy1] Frame 1
Symbol 33 MovieClip [enemy1] Frame 2
this._x = this._x - vel;
if (this._x < -30) {
removeMovieClip(this);
}
Symbol 33 MovieClip [enemy1] Frame 3
gotoAndPlay (2);
Symbol 45 MovieClip [exploss] Frame 11
removeMovieClip(this);
Symbol 54 MovieClip [fuelCell] Frame 80
removeMovieClip(this);
Symbol 61 MovieClip [hudClip] Frame 3
gotoAndPlay (1);
Symbol 63 MovieClip [enemyShot2] Frame 1
this._x = this._x + velX;
this._y = this._y + velY;
if (this._x < 0) {
removeMovieClip(this);
}
if (this._x > 510) {
removeMovieClip(this);
}
if (this._y < 0) {
removeMovieClip(this);
}
if (this._y > 310) {
removeMovieClip(this);
}
if ((this._x == 0) & (this._y == 0)) {
removeMovieClip(this);
}
Symbol 63 MovieClip [enemyShot2] Frame 2
gotoAndPlay (1);
Symbol 65 MovieClip [enemyShot1] Frame 1
this._x = this._x + velX;
this._y = this._y + velY;
if (this._x < 0) {
removeMovieClip(this);
}
if (this._x > 510) {
removeMovieClip(this);
}
if (this._y < 0) {
removeMovieClip(this);
}
if (this._y > 310) {
removeMovieClip(this);
}
if ((this._x == 0) & (this._y == 0)) {
removeMovieClip(this);
}
Symbol 65 MovieClip [enemyShot1] Frame 2
gotoAndPlay (1);
Symbol 68 MovieClip [impact] Frame 5
removeMovieClip(this);
Symbol 85 Button
on (release) {
gotoAndStop (4);
}
Symbol 90 MovieClip Frame 200
gotoAndPlay (1);
Symbol 93 MovieClip Frame 120
gotoAndPlay (1);