Frame 1
function destellar() {
hayDestello = true;
destello._visible = true;
destello._x = 0;
destello._y = 0;
destello._alpha = 100;
}
function startAnimacionRingsBlanco(x, y, num, tipo) {
if (!animacionRingsBlanco) {
numRingsBlanco = num;
tipoRingBlanco = tipo;
var _local2 = 0;
while (_local2 < numRingsBlanco) {
attachMovie("ring_blanco", "ringBlanco" + _local2, RINGS_DEPTH_BLANCO + _local2);
this["ringBlanco" + _local2].x = x;
this["ringBlanco" + _local2].y = y;
this["ringBlanco" + _local2]._x = x * RATIO_W;
this["ringBlanco" + _local2]._y = y * RATIO_H;
if (tipoRingBlanco == TIPO_RING_IN) {
maxCounterRingsBlanco = MAX_COUNTER_ANIMACION_RINGS_IN;
this["ringBlanco" + _local2]._alpha = 30;
this["ringBlanco" + _local2].v = 50;
this["ringBlanco" + _local2].radio = 2000;
this["ringBlanco" + _local2]._width = (this["ringBlanco" + _local2].radio * 2) * RATIO_W;
this["ringBlanco" + _local2]._height = (this["ringBlanco" + _local2].radio * 2) * RATIO_H;
} else {
maxCounterRingsBlanco = MAX_COUNTER_ANIMACION_RINGS_OUT;
this["ringBlanco" + _local2]._alpha = getRandom(50, 80);
this["ringBlanco" + _local2].v = getRandom(5, 50);
}
_local2++;
}
animacionRingsBlanco = true;
counterAnimacionRingsBlanco = 0;
}
}
function logicAnimacionRingsBlanco() {
counterAnimacionRingsBlanco++;
if (counterAnimacionRingsBlanco > maxCounterRingsBlanco) {
if (tipoRingBlanco == TIPO_RING_IN) {
if ((!levelOver) && (!gameOver)) {
attachMovie("burbuja1", "burbuja1", BURBUJA1_DEPTH);
burbuja1.x = this.ringBlanco0.x;
burbuja1.y = this.ringBlanco0.y;
burbuja1._x = burbuja1.x * RATIO_W;
burbuja1._y = burbuja1.y * RATIO_H;
burbuja1._xscale = burbuja1._xscale / 2;
burbuja1._yscale = burbuja1._yscale / 2;
hayBurbuja1 = true;
}
}
stopAnimacionRingsBlanco();
} else {
var _local2 = 0;
while (_local2 < numRingsBlanco) {
if (tipoRingBlanco == TIPO_RING_IN) {
this["ringBlanco" + _local2].radio = this["ringBlanco" + _local2].radio - this["ringBlanco" + _local2].v;
this["ringBlanco" + _local2]._width = (Math.abs(this["ringBlanco" + _local2].radio) * 2) * RATIO_W;
this["ringBlanco" + _local2]._height = (Math.abs(this["ringBlanco" + _local2].radio) * 2) * RATIO_H;
this["ringBlanco" + _local2]._alpha = this["ringBlanco" + _local2]._alpha + 1;
} else {
this["ringBlanco" + _local2]._xscale = this["ringBlanco" + _local2]._xscale + this["ringBlanco" + _local2].v;
this["ringBlanco" + _local2]._yscale = this["ringBlanco" + _local2]._yscale + this["ringBlanco" + _local2].v;
this["ringBlanco" + _local2]._xscale = this["ringBlanco" + _local2]._xscale + (this["ringBlanco" + _local2].v * RATIO_W);
this["ringBlanco" + _local2]._yscale = this["ringBlanco" + _local2]._yscale + (this["ringBlanco" + _local2].v * RATIO_H);
this["ringBlanco" + _local2]._alpha = this["ringBlanco" + _local2]._alpha - 1;
}
_local2++;
}
}
}
function stopAnimacionRingsBlanco() {
var _local2 = 0;
while (_local2 < numRingsBlanco) {
this["ringBlanco" + _local2].removeMovieClip();
_local2++;
}
animacionRingsBlanco = false;
}
function startAnimacionRingsRojo(x, y, num, tipo) {
if (!animacionRingsRojo) {
numRingsRojo = num;
tipoRingRojo = tipo;
var _local2 = 0;
while (_local2 < numRingsRojo) {
attachMovie("ring_rojo", "ringRojo" + _local2, RINGS_DEPTH_ROJO + _local2);
this["ringRojo" + _local2].x = x;
this["ringRojo" + _local2].y = y;
this["ringRojo" + _local2]._x = x * RATIO_W;
this["ringRojo" + _local2]._y = y * RATIO_H;
if (tipoRingRojo == TIPO_RING_IN) {
maxCounterRingsRojo = MAX_COUNTER_ANIMACION_RINGS_IN;
this["ringRojo" + _local2]._alpha = 30;
this["ringRojo" + _local2].v = 50;
this["ringRojo" + _local2].radio = 2000;
this["ringRojo" + _local2]._width = (this["ringRojo" + _local2].radio * 2) * RATIO_W;
this["ringRojo" + _local2]._height = (this["ringRojo" + _local2].radio * 2) * RATIO_H;
} else {
maxCounterRingsRojo = MAX_COUNTER_ANIMACION_RINGS_OUT;
this["ringRojo" + _local2]._alpha = getRandom(50, 80);
this["ringRojo" + _local2].v = getRandom(5, 50);
}
_local2++;
}
animacionRingsRojo = true;
counterAnimacionRingsRojo = 0;
}
}
function logicAnimacionRingsRojo() {
counterAnimacionRingsRojo++;
if (counterAnimacionRingsRojo > maxCounterRingsRojo) {
if (tipoRingRojo == TIPO_RING_IN) {
if ((!levelOver) && (!gameOver)) {
attachMovie("burbuja2", "burbuja2", BURBUJA2_DEPTH);
burbuja2.x = this.ringRojo0.x;
burbuja2.y = this.ringRojo0.y;
burbuja2._x = burbuja2.x * RATIO_W;
burbuja2._y = burbuja2.y * RATIO_H;
burbuja2._xscale = burbuja2._xscale / 2;
burbuja2._yscale = burbuja2._yscale / 2;
hayBurbuja2 = true;
}
}
stopAnimacionRingsRojo();
} else {
var _local2 = 0;
while (_local2 < numRingsRojo) {
if (tipoRingRojo == TIPO_RING_IN) {
this["ringRojo" + _local2].radio = this["ringRojo" + _local2].radio - this["ringRojo" + _local2].v;
this["ringRojo" + _local2]._width = (Math.abs(this["ringRojo" + _local2].radio) * 2) * RATIO_W;
this["ringRojo" + _local2]._height = (Math.abs(this["ringRojo" + _local2].radio) * 2) * RATIO_H;
this["ringRojo" + _local2]._alpha = this["ringRojo" + _local2]._alpha + 1;
} else {
this["ringRojo" + _local2]._xscale = this["ringRojo" + _local2]._xscale + this["ringRojo" + _local2].v;
this["ringRojo" + _local2]._yscale = this["ringRojo" + _local2]._yscale + this["ringRojo" + _local2].v;
this["ringRojo" + _local2]._xscale = this["ringRojo" + _local2]._xscale + (this["ringRojo" + _local2].v * RATIO_W);
this["ringRojo" + _local2]._yscale = this["ringRojo" + _local2]._yscale + (this["ringRojo" + _local2].v * RATIO_H);
this["ringRojo" + _local2]._alpha = this["ringRojo" + _local2]._alpha - 1;
}
_local2++;
}
}
}
function stopAnimacionRingsRojo() {
var _local2 = 0;
while (_local2 < numRingsRojo) {
this["ringRojo" + _local2].removeMovieClip();
_local2++;
}
animacionRingsRojo = false;
}
function startAnimacionRingsAzul(x, y, num, tipo) {
if (!animacionRingsAzul) {
numRingsAzul = num;
tipoRingAzul = tipo;
var _local2 = 0;
while (_local2 < numRingsAzul) {
attachMovie("ring_azul", "ringAzul" + _local2, RINGS_DEPTH_AZUL + _local2);
this["ringAzul" + _local2].x = x;
this["ringAzul" + _local2].y = y;
this["ringAzul" + _local2]._x = x * RATIO_W;
this["ringAzul" + _local2]._y = y * RATIO_H;
if (tipoRingAzul == TIPO_RING_IN) {
maxCounterRingsAzul = MAX_COUNTER_ANIMACION_RINGS_IN;
this["ringAzul" + _local2]._alpha = 30;
this["ringAzul" + _local2].v = 50;
this["ringAzul" + _local2].radio = 2000;
this["ringAzul" + _local2]._width = (this["ringAzul" + _local2].radio * 2) * RATIO_W;
this["ringAzul" + _local2]._height = (this["ringAzul" + _local2].radio * 2) * RATIO_H;
} else {
maxCounterRingsAzul = MAX_COUNTER_ANIMACION_RINGS_OUT;
this["ringAzul" + _local2]._alpha = getRandom(50, 80);
this["ringAzul" + _local2].v = getRandom(5, 50);
}
_local2++;
}
animacionRingsAzul = true;
counterAnimacionRingsAzul = 0;
}
}
function logicAnimacionRingsAzul() {
counterAnimacionRingsAzul++;
if (counterAnimacionRingsAzul > maxCounterRingsAzul) {
if (tipoRingAzul == TIPO_RING_IN) {
if ((!levelOver) && (!gameOver)) {
attachMovie("burbuja3", "burbuja3", BURBUJA3_DEPTH);
burbuja3.x = this.ringAzul0.x;
burbuja3.y = this.ringAzul0.y;
burbuja3._x = burbuja3.x * RATIO_W;
burbuja3._y = burbuja3.y * RATIO_H;
burbuja3._xscale = burbuja3._xscale / 2;
burbuja3._yscale = burbuja3._yscale / 2;
hayBurbuja3 = true;
}
}
stopAnimacionRingsAzul();
} else {
var _local2 = 0;
while (_local2 < numRingsAzul) {
if (tipoRingAzul == TIPO_RING_IN) {
this["ringAzul" + _local2].radio = this["ringAzul" + _local2].radio - this["ringAzul" + _local2].v;
this["ringAzul" + _local2]._width = (Math.abs(this["ringAzul" + _local2].radio) * 2) * RATIO_W;
this["ringAzul" + _local2]._height = (Math.abs(this["ringAzul" + _local2].radio) * 2) * RATIO_H;
this["ringAzul" + _local2]._alpha = this["ringAzul" + _local2]._alpha + 1;
} else {
this["ringAzul" + _local2]._xscale = this["ringAzul" + _local2]._xscale + this["ringAzul" + _local2].v;
this["ringAzul" + _local2]._yscale = this["ringAzul" + _local2]._yscale + this["ringAzul" + _local2].v;
this["ringAzul" + _local2]._xscale = this["ringAzul" + _local2]._xscale + (this["ringAzul" + _local2].v * RATIO_W);
this["ringAzul" + _local2]._yscale = this["ringAzul" + _local2]._yscale + (this["ringAzul" + _local2].v * RATIO_H);
this["ringAzul" + _local2]._alpha = this["ringAzul" + _local2]._alpha - 1;
}
_local2++;
}
}
}
function stopAnimacionRingsAzul() {
var _local2 = 0;
while (_local2 < numRingsAzul) {
this["ringAzul" + _local2].removeMovieClip();
_local2++;
}
animacionRingsAzul = false;
}
function startAnimacionColor(car) {
if ((!levelOver) && (!gameOver)) {
car.animacionColor = true;
car.counterAnimacionColor = 0;
var _local2 = new Color(car.clip);
car.myColor = _local2;
var _local3 = {ra:100, rb:255, ga:100, gb:0, ba:100, bb:0, aa:100, ab:255};
car.trans = _local3;
car.myColor.setTransform(car.trans);
}
}
function logicAnimacionColor(car) {
car.counterAnimacionColor++;
if (car.counterAnimacionColor > MAX_COUNTER_ANIMACION_COLOR) {
stopAnimacionColor(car);
} else {
car.trans.rb = car.trans.rb - 5;
car.trans.gb = car.trans.gb + 5;
car.trans.bb = car.trans.bb + 5;
car.trans.aa = car.trans.aa - 5;
car.myColor.setTransform(car.trans);
}
}
function stopAnimacionColor(car) {
car.animacionColor = false;
car.myColor.setTransform({ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:100, ab:0});
}
function nextCar() {
selectedCar++;
if (selectedCar > 4) {
selectedCar = 1;
}
}
function prevCar() {
selectedCar--;
if (selectedCar < 1) {
selectedCar = 4;
}
}
function onEnterFrameFunction() {
var _local3 = false;
if (escaleraOn) {
escaleraLogic();
return(undefined);
}
if (hayDestello) {
destello._alpha = destello._alpha - 5;
if (destello._alpha <= 0) {
destello._visible = false;
hayDestello = false;
}
}
if (gameState == GAME) {
var _local4 = Math.floor(Math.abs(100 - playerCar.energy));
if (_local4 == 0) {
_local4 = 1;
}
hud.resistencia.energia.gotoAndStop(_local4);
actualizarEnergy(playerCar);
if (_root.scoreNum < 10) {
_root.score = "00000" + _root.scoreNum;
} else if (_root.scoreNum < 100) {
_root.score = "0000" + _root.scoreNum;
} else if (_root.scoreNum < 1000) {
_root.score = "000" + _root.scoreNum;
} else if (_root.scoreNum < 10000) {
_root.score = "00" + _root.scoreNum;
} else if (_root.scoreNum < 100000) {
_root.score = "0" + _root.scoreNum;
} else {
_root.score = "" + _root.scoreNum;
}
if (levelOver) {
cuentaLevelOver++;
if (cuentaLevelOver > MAX_CUENTA_LEVEL_OVER) {
levelover.removeMovieClip();
levelUp();
return(undefined);
}
} else if (gameOver) {
cuentaGameOver++;
if (cuentaGameOver > MAX_CUENTA_GAME_OVER) {
gameover.removeMovieClip();
setGameState(MENU);
return(undefined);
}
}
if (semaforoOn) {
semaforoLogic();
}
if (semaforoVerde) {
logicBurbujas();
processEnemies();
ordenarProfs();
playerLogic();
checkCollisions();
logicParticleSystem();
_local3 = true;
if ((!levelOver) && (!gameOver)) {
if (playerCar.energy <= 0) {
playerCar.energy = 0;
playSound(SOUND_GAMEOVER);
attachMovie("gameover", "gameover", GAME_OVER_DEPTH);
gameover._x = SCREEN_WIDTH / 2;
gameover._y = (SCREEN_HEIGHT / 2) - 30;
gameOver = true;
cuentaGameOver = 0;
playerCar.clip._visible = false;
playerCar.energyClip._visible = false;
}
var _local2 = 0;
while (_local2 < numEnemies) {
if (enemy[_local2].vivo) {
if (enemy[_local2].energy <= 0) {
matarEnemigo(enemy[_local2]);
} else {
_local3 = false;
}
}
_local2++;
}
if (_local3) {
attachMovie("levelover", "levelover", LEVEL_OVER_DEPTH);
levelover._x = SCREEN_WIDTH / 2;
levelover._y = (SCREEN_HEIGHT / 2) - 30;
levelOver = true;
cuentaLevelOver = 0;
playSound(SOUND_VERDE);
}
}
}
}
}
function initEscalera() {
destello._visible = false;
hayDestello = false;
escaleraOn = true;
cuentaEscalera = 0;
attachMovie("escalera", "escalera", ESCALERA_DEPTH);
escalera._x = 305;
escalera._y = ESCALERA_Y_SALIDA;
attachMovie("escadadosoponentes", "escadadosoponentes", ESCALERA_DEPTH + 1);
escadadosoponentes._x = 150;
escadadosoponentes._y = 80;
attachMovie("cuadro", "cuadro", ESCALERA_DEPTH + 2);
cuadro._x = 100;
cuadro._y = ESCALERA_Y_SALIDA;
attachMovie("carEscalera" + selectedCar, "car", SELECTED_CAR_DEPTH);
car._x = cuadro._x + 70;
car._y = cuadro._y + 50;
attachMovie("marco2", "marco2", MARCO_DEPTH);
marco2._x = 288;
marco2._y = 0;
var _local3;
switch (selectedCar) {
case 1 :
_local3 = 80;
break;
case 2 :
_local3 = 90;
break;
case 3 :
_local3 = 100;
break;
case 4 :
_local3 = 70;
}
hud.resistencia.energia.gotoAndStop(Math.floor(100 - _local3));
hud.velocidad.barra.gotoAndStop(1);
var _local2;
switch (_root.currentLevel) {
case 1 :
_local2 = 20;
break;
case 2 :
_local2 = 20;
break;
case 3 :
_local2 = 20;
break;
case 4 :
_local2 = 20;
break;
case 5 :
_local2 = 15;
break;
case 6 :
_local2 = 10;
break;
case 7 :
_local2 = 10;
break;
case 8 :
_local2 = 10;
break;
case 9 :
_local2 = 10;
break;
case 10 :
_local2 = 10;
break;
case 11 :
_local2 = 10;
break;
case 12 :
_local2 = 5;
break;
case 13 :
_local2 = 0;
break;
case 14 :
_local2 = 0;
break;
case 15 :
_local2 = 0;
}
distancia = ((15 - _root.currentLevel) * ALTO_CADA_CUADRO) + _local2;
escalera.velY = distancia / (FPS * 4);
}
function escaleraLogic() {
cuentaEscalera++;
if (cuentaEscalera > MAX_CUENTA_ESCALERA) {
removeEscalera();
initLevel(_root.currentLevel);
} else if ((cuentaEscalera > FPS) && (cuentaEscalera < (MAX_CUENTA_ESCALERA - FPS))) {
if (escalera._y > (ESCALERA_Y_SALIDA - distancia)) {
escalera._y = escalera._y - escalera.velY;
} else {
escalera._y = ESCALERA_Y_SALIDA - distancia;
}
}
}
function removeEscalera() {
escaleraOn = false;
escalera.removeMovieClip();
escadadosoponentes.removeMovieClip();
cuadro.removeMovieClip();
car.removeMovieClip();
marco2.removeMovieClip();
}
function levelUp() {
if (_root.currentLevel == 15) {
trace("TERMINO EL JUEGO");
setGameState(FIN);
return(undefined);
}
removeGame();
playSoundFondoSelect();
_root.currentLevel++;
levelOver = false;
gameOver = false;
animacionRingsBlanco = false;
animacionRingsRojo = false;
animacionRingsAzul = false;
hayBurbuja1 = false;
hayBurbuja2 = false;
hayBurbuja3 = false;
var _local2;
if (((((_root.currentLevel == 1) || (_root.currentLevel == 2)) || (_root.currentLevel == 7)) || (_root.currentLevel == 8)) || (_root.currentLevel == 13)) {
_local2 = 1;
friction = PARK_FRICTION;
} else if (((((_root.currentLevel == 3) || (_root.currentLevel == 4)) || (_root.currentLevel == 9)) || (_root.currentLevel == 10)) || (_root.currentLevel == 14)) {
_local2 = 2;
friction = ICE_FRICTION;
} else {
_local2 = 3;
friction = ROAD_FRICTION;
}
attachMovie("pista" + _local2, "pista", PISTA_DEPTH);
pista._x = 0;
pista._y = 0;
attachMovie("hud", "hud", HUD_DEPTH);
hud._x = 0;
hud._y = 375;
attachMovie("paredpista" + _local2, "paredpista", PARED_PISTA_DEPTH);
paredpista._x = 0;
paredpista._y = (SCREEN_HEIGHT - paredpista._height) - hud._height;
attachMovie("copyright", "copyright", COPYRIGHT_DEPTH);
copyright._height = 16;
copyright._x = 200;
copyright._y = 6;
initEscalera();
}
function matarEnemigo(e) {
playSound(SOUND_MORIR);
e.vivo = false;
e.clip._visible = false;
e.energyClip._visible = false;
switch (e.tipo) {
case AUTO_VERDE :
addScore(100);
break;
case AUTO_BLANCO_NARANJA :
addScore(200);
break;
case AUTO_TURBINAS_NARANJA :
addScore(350);
break;
case AUTO_GOLDEN_AZUL :
addScore(500);
break;
case AUTO_ROJO_DIABLO :
addScore(750);
break;
case AUTO_AZUL_MOTOR :
addScore(1000);
}
}
function checkCollisions() {
var _local2 = 0;
while (_local2 < numEnemies) {
if (enemy[_local2].vivo) {
ballToBallDetection(playerCar, enemy[_local2], true);
}
_local2++;
}
_local2 = 0;
while (_local2 < numEnemies) {
var _local1 = _local2 + 1;
while (_local1 < numEnemies) {
if (enemy[_local2].vivo && (enemy[_local1].vivo)) {
ballToBallDetection(enemy[_local2], enemy[_local1], false);
}
_local1++;
}
_local2++;
}
_local2 = 0;
while (_local2 < numEnemies) {
if (enemy[_local2].vivo) {
if (circleToCircleDetection((playerCar.x + (playerCar.clip._width / 2)) + OFFSET_CIRCULO_X, (playerCar.y + (playerCar.clip._height / 2)) + OFFSET_CIRCULO_Y, playerCar.radius, (enemy[_local2].x + (enemy[_local2].clip._width / 2)) + OFFSET_CIRCULO_X, (enemy[_local2].y + (enemy[_local2].clip._height / 2)) + OFFSET_CIRCULO_Y, enemy[_local2].radius)) {
dosR = playerCar.radius + enemy[_local2].radius;
d = dist((playerCar.x + (playerCar.clip._width / 2)) + OFFSET_CIRCULO_X, (playerCar.y + (playerCar.clip._height / 2)) + OFFSET_CIRCULO_Y, (enemy[_local2].x + (enemy[_local2].clip._width / 2)) + OFFSET_CIRCULO_X, (enemy[_local2].y + (enemy[_local2].clip._height / 2)) + OFFSET_CIRCULO_Y);
var _local3 = (dosR - d) / 2;
var _local7 = ((((playerCar.x + (playerCar.clip._width / 2)) + OFFSET_CIRCULO_X) - enemy[_local2].x) + (enemy[_local2].clip._width / 2)) + OFFSET_CIRCULO_X;
var _local8 = ((((playerCar.y + (playerCar.clip._height / 2)) + OFFSET_CIRCULO_Y) - enemy[_local2].y) + (enemy[_local2].clip._height / 2)) + OFFSET_CIRCULO_Y;
var _local6 = Math.atan2(_local8, _local7);
var _local5 = Math.cos(_local6);
var _local4 = Math.sin(_local6);
playerCar.x = playerCar.x + (_local3 * _local5);
playerCar.y = playerCar.y + (_local3 * _local4);
enemy[_local2].x = enemy[_local2].x - (_local3 * _local5);
enemy[_local2].y = enemy[_local2].y - (_local3 * _local4);
}
}
_local2++;
}
_local2 = 0;
while (_local2 < (numEnemies - 1)) {
var _local1 = _local2 + 1;
while (_local1 < numEnemies) {
if (enemy[_local2].vivo && (enemy[_local1].vivo)) {
if (circleToCircleDetection((enemy[_local1].x + (enemy[_local1].clip._width / 2)) + OFFSET_CIRCULO_X, (enemy[_local1].y + (enemy[_local1].clip._height / 2)) + OFFSET_CIRCULO_Y, enemy[_local1].radius, (enemy[_local2].x + (enemy[_local2].clip._width / 2)) + OFFSET_CIRCULO_X, (enemy[_local2].y + (enemy[_local2].clip._height / 2)) + OFFSET_CIRCULO_Y, enemy[_local2].radius)) {
dosR = enemy[_local1].radius + enemy[_local2].radius;
d = dist((enemy[_local1].x + (enemy[_local1].clip._width / 2)) + OFFSET_CIRCULO_X, (enemy[_local1].y + (enemy[_local1].clip._height / 2)) + OFFSET_CIRCULO_Y, (enemy[_local2].x + (enemy[_local2].clip._width / 2)) + OFFSET_CIRCULO_X, (enemy[_local2].y + (enemy[_local2].clip._height / 2)) + OFFSET_CIRCULO_Y);
var _local3 = (dosR - d) / 2;
var _local7 = ((((enemy[_local1].x + (enemy[_local1].clip._width / 2)) + OFFSET_CIRCULO_X) - enemy[_local2].x) + (enemy[_local2].clip._width / 2)) + OFFSET_CIRCULO_X;
var _local8 = ((((enemy[_local1].y + (enemy[_local1].clip._height / 2)) + OFFSET_CIRCULO_Y) - enemy[_local2].y) + (enemy[_local2].clip._height / 2)) + OFFSET_CIRCULO_Y;
var _local6 = Math.atan2(_local8, _local7);
var _local5 = Math.cos(_local6);
var _local4 = Math.sin(_local6);
enemy[_local1].x = enemy[_local1].x + (_local3 * _local5);
enemy[_local1].y = enemy[_local1].y + (_local3 * _local4);
enemy[_local2].x = enemy[_local2].x - (_local3 * _local5);
enemy[_local2].y = enemy[_local2].y - (_local3 * _local4);
}
}
_local1++;
}
_local2++;
}
}
function ballToBallDetection(b1, b2, b1EsElPlayer) {
var _local10 = b1.vel.getX();
var _local8 = b1.vel.getY();
var _local9 = b2.vel.getX();
var _local7 = b2.vel.getY();
var _local6 = (b1.x + (b1.clip._width / 2)) + OFFSET_CIRCULO_X;
var _local4 = (b1.y + (b1.clip._height / 2)) + OFFSET_CIRCULO_Y;
var _local5 = (b2.x + (b2.clip._width / 2)) + OFFSET_CIRCULO_X;
var _local3 = (b2.y + (b2.clip._height / 2)) + OFFSET_CIRCULO_Y;
var _local17 = b1.radius + b2.radius;
var _local24 = (((-2 * _local10) * _local9) + (_local10 * _local10)) + (_local9 * _local9);
var _local23 = ((((-2 * _local6) * _local9) - ((2 * _local5) * _local10)) + ((2 * _local6) * _local10)) + ((2 * _local5) * _local9);
var _local22 = (((-2 * _local6) * _local5) + (_local6 * _local6)) + (_local5 * _local5);
var _local21 = (((-2 * _local8) * _local7) + (_local8 * _local8)) + (_local7 * _local7);
var _local20 = ((((-2 * _local4) * _local7) - ((2 * _local3) * _local8)) + ((2 * _local4) * _local8)) + ((2 * _local3) * _local7);
var _local26 = (((-2 * _local4) * _local3) + (_local4 * _local4)) + (_local3 * _local3);
var _local15 = _local24 + _local21;
var _local12 = _local23 + _local20;
var _local25 = (_local22 + _local26) - (_local17 * _local17);
var _local19 = Math.sqrt((_local12 * _local12) - ((4 * _local15) * _local25));
var _local14 = ((-_local12) + _local19) / (2 * _local15);
var _local13 = ((-_local12) - _local19) / (2 * _local15);
var _local11 = -1;
if ((_local14 > 0) && (_local14 <= 1)) {
_local11 = _local14;
var _local18 = true;
}
if ((_local13 > 0) && (_local13 <= 1)) {
if ((_local11 == -1) || (_local13 < _local14)) {
_local11 = _local13;
var _local18 = true;
}
}
if (_local18) {
var _local16 = false;
if ((b1.vel.magnitud() + b2.vel.magnitud()) > MIN_VEL_SOUND_GOLPE) {
playSound(SOUND_GOLPE);
_local16 = true;
} else if ((b1.vel.magnitud() + b2.vel.magnitud()) > MIN_VEL_SOUND_GOLPE_SUAVE) {
playSound(SOUND_GOLPE_SUAVE);
}
ball2BallReaction(b1, b2, _local6, _local5, _local4, _local3, _local11, _local16, b1EsElPlayer);
}
if (_local18) {
return(true);
}
return(false);
}
function ball2BallReaction(b1, b2, x1, x2, y1, y2, time, sacaEnergy, b1EsElPlayer) {
trace("b1EsElPlayer=" + b1EsElPlayer);
var _local5;
var _local7;
if (b1.burbuja1On) {
_local5 = 1;
} else {
_local5 = b1.mass;
}
if (b2.burbuja1On) {
_local7 = 1;
} else {
_local7 = b2.mass;
}
if ((_local5 == 1) || (_local7 == 1)) {
trace("MASA 1-----------------------");
}
var _local19 = b1.vel.getX();
var _local18 = b2.vel.getX();
var _local21 = b1.vel.getY();
var _local20 = b2.vel.getY();
var _local22 = x1 - x2;
var _local24 = y1 - y2;
var _local14 = Math.atan2(_local24, _local22);
var _local4 = Math.cos(_local14);
var _local3 = Math.sin(_local14);
var _local15 = (_local19 * _local4) + (_local21 * _local3);
var _local12 = (_local18 * _local4) + (_local20 * _local3);
var _local13 = (_local21 * _local4) - (_local19 * _local3);
var _local11 = (_local20 * _local4) - (_local18 * _local3);
var _local9 = (_local5 * _local15) + (_local7 * _local12);
var _local6 = _local9 * 2;
if (_local6 > 0) {
if (sacaEnergy) {
if ((!levelOver) && (!gameOver)) {
b1.energy = b1.energy - Math.abs(_local6);
actualizarEnergy(b1);
if (b1.energy < 30) {
startAnimacionColor(b1);
}
if (b1.energy <= 0) {
b1.energy = 0;
destellar();
startAnimacionRingsBlanco(b1.x + (CAR_WIDTH / 2), b1.y + (CAR_HEIGHT / 2), 3, TIPO_RING_OUT);
}
}
}
} else if (sacaEnergy) {
if ((!levelOver) && (!gameOver)) {
b2.energy = b2.energy - Math.abs(_local6);
if (b1EsElPlayer) {
addScore(Math.abs(Math.floor(_local6)));
}
actualizarEnergy(b2);
if (b2.energy < 30) {
startAnimacionColor(b2);
}
if (b2.energy <= 0) {
b2.energy = 0;
destellar();
startAnimacionRingsBlanco(b2.x + (CAR_WIDTH / 2), b2.y + (CAR_HEIGHT / 2), 3, TIPO_RING_OUT);
}
}
}
var _local23 = _local15 - _local12;
var _local16 = (_local9 + (_local5 * _local23)) / (_local5 + _local7);
var _local17 = (_local16 - _local15) + _local12;
_local15 = _local17;
_local12 = _local16;
_local19 = (_local15 * _local4) - (_local13 * _local3);
_local18 = (_local12 * _local4) - (_local11 * _local3);
_local21 = (_local13 * _local4) + (_local15 * _local3);
_local20 = (_local11 * _local4) + (_local12 * _local3);
b1.x = b1.x + (b1.vel.getX() * time);
b1.y = b1.y + (b1.vel.getY() * time);
b2.x = b2.x + (b2.vel.getX() * time);
b2.y = b2.y + (b2.vel.getY() * time);
b1.vel.setXY(_local19, _local21);
b2.vel.setXY(_local18, _local20);
var _local10 = 0.8;
b1.vel.mul(_local10);
b2.vel.mul(_local10);
b1.accelMag = 0;
b1.accelVec.setXY(0, 0);
b2.accelMag = 0;
b2.accelVec.setXY(0, 0);
}
function processEnemies() {
var _local1 = 0;
while (_local1 < numEnemies) {
if (enemy[_local1].vivo) {
enemyLogic(_local1);
}
logicEfectoPowerUps(enemy[_local1]);
actualizarEnergy(enemy[_local1]);
_local1++;
}
}
function enemyLogic(i) {
if (enemy[i].animacionColor) {
logicAnimacionColor(enemy[i]);
}
if ((!levelOver) && (!gameOver)) {
switch (enemy[i].steeringBehaviour) {
case SEEK_FACIL :
case SEEK_MEDIO :
case SEEK_DIFICIL :
var _local2 = new Vector2D(playerCar.x - enemy[i].x, playerCar.y - enemy[i].y);
_local2.normalize();
_local2.mul(MAX_VEL_ENEMY);
var _local7 = _local2.getX() - enemy[i].vel.getX();
var _local6 = _local2.getY() - enemy[i].vel.getY();
var _local5 = (Math.atan2(_local6, _local7) * 180) / Math.PI;
_local5 = toStandardAngle(_local5);
if (Math.abs(_local5 - enemy[i].angle) > STEP_ANGLE) {
var _local4;
var _local3;
switch (enemy[i].steeringBehaviour) {
case SEEK_DIFICIL :
_local4 = STEP_ANGLE / 2;
_local3 = 0.9;
break;
case SEEK_MEDIO :
_local4 = STEP_ANGLE / 4;
_local3 = 0.85;
break;
case SEEK_FACIL :
_local4 = STEP_ANGLE / 6;
_local3 = 0.8;
}
if (enemy[i].tipo == AUTO_TURBINAS_NARANJA) {
_local3 = AUTO_TURBINAS_NARANJA_ACCEL_DEC;
}
if (enemy[i].tipo == AUTO_AZUL_MOTOR) {
_local3 = AUTO_AZUL_MOTOR_ACCEL_DEC;
}
var _local11 = enemy[i].vel.getX();
var _local9 = enemy[i].vel.getY();
var _local10 = _local2.getX();
var _local8 = _local2.getY();
if (enemy[i].vel.sign(_local2) == -1) {
girarIzquierdaEnemy(enemy[i], _local4, _local3);
}
if (enemy[i].vel.sign(_local2) == 1) {
girarDerechaEnemy(enemy[i], _local4, _local3);
}
}
break;
case SEEK_TARGET_FACIL :
case SEEK_TARGET_MEDIO :
case SEEK_TARGET_DIFICIL :
_local2 = new Vector2D(enemy[i].xTarget - enemy[i].x, enemy[i].yTarget - enemy[i].y);
_local2.normalize();
_local2.mul(MAX_VEL_ENEMY);
_local7 = _local2.getX() - enemy[i].vel.getX();
_local6 = _local2.getY() - enemy[i].vel.getY();
_local5 = (Math.atan2(_local6, _local7) * 180) / Math.PI;
_local5 = toStandardAngle(_local5);
if (Math.abs(_local5 - enemy[i].angle) > STEP_ANGLE) {
switch (enemy[i].steeringBehaviour) {
case SEEK_TARGET_DIFICIL :
var _local4 = STEP_ANGLE / 2;
var _local3 = 0.9;
break;
case SEEK_TARGET_MEDIO :
_local4 = STEP_ANGLE / 4;
_local3 = 0.85;
break;
case SEEK_TARGET_FACIL :
_local4 = STEP_ANGLE / 6;
_local3 = 0.8;
}
if (enemy[i].tipo == AUTO_TURBINAS_NARANJA) {
_local3 = AUTO_TURBINAS_NARANJA_ACCEL_DEC;
}
if (enemy[i].tipo == AUTO_AZUL_MOTOR) {
_local3 = AUTO_AZUL_MOTOR_ACCEL_DEC;
}
var _local11 = enemy[i].vel.getX();
var _local9 = enemy[i].vel.getY();
var _local10 = _local2.getX();
var _local8 = _local2.getY();
if (enemy[i].vel.sign(_local2) == -1) {
girarIzquierdaEnemy(enemy[i], _local4, _local3);
}
if (enemy[i].vel.sign(_local2) == 1) {
girarDerechaEnemy(enemy[i], _local4, _local3);
}
}
break;
case FLEE_FACIL :
case FLEE_MEDIO :
case FLEE_DIFICIL :
_local2 = new Vector2D(enemy[i].x - playerCar.x, enemy[i].y - playerCar.y);
_local2.normalize();
_local2.mul(MAX_VEL_ENEMY);
_local7 = _local2.getX() - enemy[i].vel.getX();
_local6 = _local2.getY() - enemy[i].vel.getY();
_local5 = (Math.atan2(_local6, _local7) * 180) / Math.PI;
_local5 = toStandardAngle(_local5);
if (Math.abs(_local5 - enemy[i].angle) > STEP_ANGLE) {
switch (enemy[i].steeringBehaviour) {
case FLEE_DIFICIL :
var _local4 = STEP_ANGLE / 2;
var _local3 = 0.3;
break;
case FLEE_MEDIO :
_local4 = STEP_ANGLE / 4;
_local3 = 0.3;
break;
case FLEE_FACIL :
_local4 = STEP_ANGLE / 6;
_local3 = 0.3;
}
var _local11 = enemy[i].vel.getX();
var _local9 = enemy[i].vel.getY();
var _local10 = _local2.getX();
var _local8 = _local2.getY();
if (enemy[i].vel.sign(_local2) == -1) {
girarIzquierdaEnemy(enemy[i], _local4, _local3);
}
if (enemy[i].vel.sign(_local2) == 1) {
girarDerechaEnemy(enemy[i], _local4, _local3);
}
}
break;
case WANDER_FACIL :
case WANDER_MEDIO :
case WANDER_DIFICIL :
arco = arco + getRandom(-10, 10);
if (arco > 100) {
arco = arco - 100;
} else if (arco < 0) {
arco = arco + 100;
}
switch (enemy[i].steeringBehaviour) {
case WANDER_DIFICIL :
var _local4 = STEP_ANGLE / 2;
var _local3 = 0.9;
break;
case WANDER_MEDIO :
_local4 = STEP_ANGLE / 4;
_local3 = 0.85;
break;
case WANDER_FACIL :
_local4 = STEP_ANGLE / 6;
_local3 = 0.8;
}
if (enemy[i].tipo == AUTO_TURBINAS_NARANJA) {
_local3 = AUTO_TURBINAS_NARANJA_ACCEL_DEC;
}
if (enemy[i].tipo == AUTO_AZUL_MOTOR) {
_local3 = AUTO_AZUL_MOTOR_ACCEL_DEC;
}
if (arco < 50) {
girarIzquierdaEnemy(enemy[i], _local4, _local3);
}
if (arco <= 50) {
break;
}
girarDerechaEnemy(enemy[i], _local4, _local3);
}
enemy[i].nextAIChange--;
if (enemy[i].nextAIChange < 0) {
changeSteeringBehaviour(enemy[i]);
}
}
enemy[i].clip.gotoAndStop(Math.floor(enemy[i].angle / ANGULO_ROTACION) + 1);
if ((!levelOver) && (!gameOver)) {
enemy[i].accelMag = enemy[i].accelMag + STEP_ACCEL;
if (enemy[i].accelMag > MAX_ACCEL) {
enemy[i].accelMag = MAX_ACCEL;
}
}
enemy[i].accelVec.x = enemy[i].accelMag * Math.cos(enemy[i].angle * (Math.PI/180));
enemy[i].accelVec.y = enemy[i].accelMag * Math.sin(enemy[i].angle * (Math.PI/180));
if ((!levelOver) && (!gameOver)) {
enemy[i].vel.x = enemy[i].vel.x + enemy[i].accelVec.getX();
enemy[i].vel.y = enemy[i].vel.y + enemy[i].accelVec.getY();
}
if (enemy[i].burbuja2On) {
enemy[i].vel.truncate(VEL_5);
} else {
enemy[i].vel.truncate(MAX_VEL_ENEMY);
}
enemy[i].vel.mul(friction);
enemy[i].x = enemy[i].x + enemy[i].vel.getX();
enemy[i].y = enemy[i].y + enemy[i].vel.getY();
if (enemy[i].x > (PISTA_WIDTH - enemy[i].clip._width)) {
if (enemy[i].vel.magnitud() > MIN_VEL_SOUND_BARRERA) {
playSound(SOUND_GOLPE_BARRERA);
}
enemy[i].x = (PISTA_WIDTH - enemy[i].clip._width) - 2;
enemy[i].vel.mul(0.4);
enemy[i].vel.mirror();
enemy[i].accelMag = 0;
if (((enemy[i].steeringBehaviour != SEEK_TARGET_FACIL) && (enemy[i].steeringBehaviour != SEEK_TARGET_MEDIO)) && (enemy[i].steeringBehaviour != SEEK_TARGET_DIFICIL)) {
enemy[i].steeringBehaviour = SEEK_TARGET_MEDIO;
selectRandomTarget(enemy[i]);
enemy[i].nextAIChange = FPS * 6;
}
}
if (enemy[i].x < 0) {
if (enemy[i].vel.magnitud() > MIN_VEL_SOUND_BARRERA) {
playSound(SOUND_GOLPE_BARRERA);
}
enemy[i].x = 2;
enemy[i].vel.mul(0.4);
enemy[i].vel.mirror();
enemy[i].accelMag = 0;
if (((enemy[i].steeringBehaviour != SEEK_TARGET_FACIL) && (enemy[i].steeringBehaviour != SEEK_TARGET_MEDIO)) && (enemy[i].steeringBehaviour != SEEK_TARGET_DIFICIL)) {
enemy[i].steeringBehaviour = SEEK_TARGET_MEDIO;
selectRandomTarget(enemy[i]);
enemy[i].nextAIChange = FPS * 6;
}
}
if (enemy[i].y > ((PISTA_HEIGHT - enemy[i].clip._height) - 50)) {
if (enemy[i].vel.magnitud() > MIN_VEL_SOUND_BARRERA) {
playSound(SOUND_GOLPE_BARRERA);
}
enemy[i].y = ((PISTA_HEIGHT - enemy[i].clip._height) - 2) - 50;
enemy[i].vel.mul(0.4);
enemy[i].vel.flip();
enemy[i].accelMag = 0;
if (((enemy[i].steeringBehaviour != SEEK_TARGET_FACIL) && (enemy[i].steeringBehaviour != SEEK_TARGET_MEDIO)) && (enemy[i].steeringBehaviour != SEEK_TARGET_DIFICIL)) {
enemy[i].steeringBehaviour = SEEK_TARGET_MEDIO;
selectRandomTarget(enemy[i]);
enemy[i].nextAIChange = FPS * 6;
}
}
if (enemy[i].y < 0) {
if (enemy[i].vel.magnitud() > MIN_VEL_SOUND_BARRERA) {
playSound(SOUND_GOLPE_BARRERA);
}
enemy[i].y = 2;
enemy[i].vel.mul(0.4);
enemy[i].vel.flip();
enemy[i].accelMag = 0;
if (((enemy[i].steeringBehaviour != SEEK_TARGET_FACIL) && (enemy[i].steeringBehaviour != SEEK_TARGET_MEDIO)) && (enemy[i].steeringBehaviour != SEEK_TARGET_DIFICIL)) {
enemy[i].steeringBehaviour = SEEK_TARGET_MEDIO;
selectRandomTarget(enemy[i]);
enemy[i].nextAIChange = FPS * 6;
}
}
enemy[i].clip._x = enemy[i].x * RATIO_W;
enemy[i].clip._y = enemy[i].y * RATIO_H;
posicionarEnergyClip(enemy[i]);
}
function changeSteeringBehaviour(e) {
var _local3 = getRandom(0, 100);
var _local2 = 30;
if (e.tipo == AUTO_ROJO_DIABLO) {
_local2 = AUTO_ROJO_PORCENTAJE_SEEK;
}
if (e.tipo == AUTO_AZUL_MOTOR) {
_local2 = AUTO_AZUL_MOTOR_PORCENTAJE_SEEK;
}
if (_local3 < _local2) {
e.steeringBehaviour = SEEK_DIFICIL;
} else {
e.steeringBehaviour = getRandom(0, 11);
}
e.nextAIChange = FPS * getRandom(5, 15);
if (((e.steeringBehaviour == SEEK_TARGET_FACIL) || (e.steeringBehaviour == SEEK_TARGET_MEDIO)) || (e.steeringBehaviour == SEEK_TARGET_DIFICIL)) {
selectRandomTarget(e);
}
}
function selectRandomTarget(e) {
e.xTarget = getRandom(200, PISTA_WIDTH - 200);
e.yTarget = getRandom(200, PISTA_HEIGHT - 200);
}
function girarDerecha(car, stepAngle) {
car.angle = car.angle + stepAngle;
if (car.burbuja2On) {
car.accelMag = car.accelMag * 0.9;
} else {
car.accelMag = car.accelMag * 0.8;
}
car.angle = toStandardAngle(car.angle);
}
function girarIzquierda(car, stepAngle) {
car.angle = car.angle - stepAngle;
if (car.burbuja2On) {
car.accelMag = car.accelMag * 0.9;
} else {
car.accelMag = car.accelMag * 0.8;
}
car.angle = toStandardAngle(car.angle);
}
function girarDerechaEnemy(car, stepAngle, accelDecrement) {
car.angle = car.angle + stepAngle;
if (car.burbuja2On) {
car.accelMag = car.accelMag * 0.9;
} else {
car.accelMag = car.accelMag * accelDecrement;
}
car.angle = toStandardAngle(car.angle);
}
function girarIzquierdaEnemy(car, stepAngle, accelDecrement) {
car.angle = car.angle - stepAngle;
if (car.burbuja2On) {
car.accelMag = car.accelMag * 0.9;
} else {
car.accelMag = car.accelMag * accelDecrement;
}
car.angle = toStandardAngle(car.angle);
}
function playerLogic() {
if (playerCar.animacionColor) {
logicAnimacionColor(playerCar);
}
if (animacionRingsBlanco) {
logicAnimacionRingsBlanco();
}
if (animacionRingsRojo) {
logicAnimacionRingsRojo();
}
if (animacionRingsAzul) {
logicAnimacionRingsAzul();
}
if ((!levelOver) && (!gameOver)) {
if (!hayBurbuja1) {
if (getRandom(1, 2000) == 1) {
startPowerUp(getRandom(50, PISTA_WIDTH - 50), getRandom(50, PISTA_HEIGHT - 100), POWERUP_FUERZA);
}
}
if (!hayBurbuja2) {
if (getRandom(1, 2000) == 1) {
startPowerUp(getRandom(50, PISTA_WIDTH - 50), getRandom(50, PISTA_HEIGHT - 100), POWERUP_VELOCIDAD);
}
}
if (!hayBurbuja3) {
if (getRandom(1, 1500) == 1) {
startPowerUp(getRandom(50, PISTA_WIDTH - 50), getRandom(50, PISTA_HEIGHT - 100), POWERUP_RESISTENCIA);
}
}
}
if (!gameOver) {
if (Key.isDown(37)) {
girarIzquierda(playerCar, STEP_ANGLE);
}
if (Key.isDown(39)) {
girarDerecha(playerCar, STEP_ANGLE);
}
}
playerCar.clip.gotoAndStop(Math.floor(playerCar.angle / ANGULO_ROTACION) + 1);
if (Key.isDown(17) || (Key.isDown(38))) {
if (!gameOver) {
playerCar.accelMag = playerCar.accelMag + STEP_ACCEL;
if (playerCar.accelMag > MAX_ACCEL) {
playerCar.accelMag = MAX_ACCEL;
}
}
} else {
playerCar.accelMag = playerCar.accelMag - STEP_ACCEL;
if (playerCar.accelMag < 0) {
playerCar.accelMag = 0;
}
}
playerCar.accelVec.x = playerCar.accelMag * Math.cos(playerCar.angle * (Math.PI/180));
playerCar.accelVec.y = playerCar.accelMag * Math.sin(playerCar.angle * (Math.PI/180));
if (Key.isDown(40)) {
playerCar.vel.mul(playerCar.freno);
}
playerCar.vel.x = playerCar.vel.x + playerCar.accelVec.getX();
playerCar.vel.y = playerCar.vel.y + playerCar.accelVec.getY();
if (playerCar.burbuja2On) {
playerCar.vel.truncate(VEL_5);
} else {
playerCar.vel.truncate(playerCar.max_vel);
}
var _local1 = Math.floor(Math.abs((playerCar.vel.magnitud() * 100) / VEL_5));
if (_local1 < 1) {
_local1 = 1;
}
hud.velocidad.barra.gotoAndStop(_local1);
playerCar.vel.mul(friction);
playerCar.x = playerCar.x + playerCar.vel.getX();
playerCar.y = playerCar.y + playerCar.vel.getY();
if (playerCar.x > ((PISTA_WIDTH - playerCar.clip._width) - 7)) {
if (playerCar.vel.magnitud() > MIN_VEL_SOUND_BARRERA) {
playSound(SOUND_GOLPE_BARRERA);
}
playerCar.x = (PISTA_WIDTH - playerCar.clip._width) - 7;
playerCar.vel.mul(0.4);
playerCar.vel.mirror();
playerCar.accelMag = 0;
}
if (playerCar.x < 7) {
if (playerCar.vel.magnitud() > MIN_VEL_SOUND_BARRERA) {
playSound(SOUND_GOLPE_BARRERA);
}
playerCar.x = 7;
playerCar.vel.mul(0.4);
playerCar.vel.mirror();
playerCar.accelMag = 0;
}
if (playerCar.y > ((PISTA_HEIGHT - playerCar.clip._height) - 50)) {
if (playerCar.vel.magnitud() > MIN_VEL_SOUND_BARRERA) {
playSound(SOUND_GOLPE_BARRERA);
}
playerCar.y = (PISTA_HEIGHT - playerCar.clip._height) - 50;
playerCar.vel.mul(0.4);
playerCar.vel.flip();
playerCar.accelMag = 0;
}
if (playerCar.y < 0) {
if (playerCar.vel.magnitud() > MIN_VEL_SOUND_BARRERA) {
playSound(SOUND_GOLPE_BARRERA);
}
playerCar.y = 0;
playerCar.vel.mul(0.4);
playerCar.vel.flip();
playerCar.accelMag = 0;
}
playerCar.clip._x = playerCar.x * RATIO_W;
playerCar.clip._y = playerCar.y * RATIO_H;
posicionarEnergyClip(playerCar);
logicEfectoPowerUps(playerCar);
}
function toStandardAngle(t) {
t = t % 360;
if (t < 0) {
t = t + 360;
}
return(t);
}
function dist(x1, y1, x2, y2) {
return(Math.sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))));
}
function setGameState(nextState) {
switch (gameState) {
case INSTRUCTIONS :
removeInstructions();
break;
case MENU :
removeMenu();
break;
case SELECT :
removeSelect();
break;
case GAME :
removeGame();
break;
case FIN :
removeFin();
}
switch (nextState) {
case INSTRUCTIONS :
showInstructions();
break;
case MENU :
showMenu();
break;
case SELECT :
showSelect();
break;
case GAME :
showGame();
break;
case FIN :
showFin();
}
gameState = nextState;
}
function showMenu() {
playSoundFondoMenu();
attachMovie("screen_menu", "menu", MENU_DEPTH);
menu._x = 0;
menu._y = 0;
}
function removeMenu() {
menu.removeMovieClip();
}
function showInstructions() {
attachMovie("screen_instrucciones", "instructions", INSTRUCTIONS_DEPTH);
instructions._x = 0;
instructions._y = 0;
}
function removeInstructions() {
instructions.removeMovieClip();
}
function showSelect() {
stopSoundFondoMenu();
playSoundFondoSelect();
attachMovie("screen_select", "select", SELECT_DEPTH);
select._x = 0;
select._y = 0;
}
function removeSelect() {
stopSoundFondoSelect();
select.removeMovieClip();
}
function showGame() {
_root.currentLevel = 0;
_root.scoreNum = 0;
_root.score = _root.scoreNum + "00000";
levelUp(_root.currentLevel);
}
function showFin() {
attachMovie("fin", "fin", FIN_DEPTH);
fin._x = 0;
fin._y = 0;
createEmptyMovieClip("video", VIDEO_DEPTH);
video._x = 0;
video._y = 0;
video.loadMovie("video.swf", 1);
attachMovie("titulo_final", "titulo_final", TITULO_FINAL_DEPTH);
titulo_final._x = 50;
titulo_final._y = 50;
}
function removeFin() {
fin.removeMovieClip();
video.removeMovieClip();
titulo_final.removeMovieClip();
}
function initLevel(n) {
playerCar = new Object();
switch (n) {
case 1 :
numEnemies = 2;
break;
case 2 :
numEnemies = 3;
break;
case 3 :
numEnemies = 2;
break;
case 4 :
numEnemies = 2;
break;
case 5 :
numEnemies = 3;
break;
case 6 :
numEnemies = 2;
break;
case 7 :
numEnemies = 4;
break;
case 8 :
numEnemies = 2;
break;
case 9 :
numEnemies = 4;
break;
case 10 :
numEnemies = 4;
break;
case 11 :
numEnemies = 3;
break;
case 12 :
numEnemies = 3;
break;
case 12 :
numEnemies = 3;
break;
case 13 :
numEnemies = 4;
break;
case 14 :
numEnemies = 4;
break;
case 15 :
numEnemies = 4;
break;
default :
numEnemies = 4;
}
enemy = new Array(numEnemies);
var _local1 = 0;
while (_local1 < numEnemies) {
enemy[_local1] = new Object();
_local1++;
}
switch (n) {
case 1 :
initEnemy(0, 50, 100, 0, AUTO_VERDE, AUTO_VERDE_MASS);
initEnemy(1, 500, 100, 180, AUTO_VERDE, AUTO_VERDE_MASS);
initPlayer(50, 300, 0);
break;
case 2 :
initEnemy(0, 150, 100, 45, AUTO_VERDE, AUTO_VERDE_MASS);
initEnemy(1, 450, 100, 135, AUTO_VERDE, AUTO_VERDE_MASS);
initEnemy(2, 300, 150, 90, AUTO_BLANCO_NARANJA, AUTO_BLANCO_NARANJA_MASS);
initPlayer(50, 300, 0);
break;
case 3 :
initEnemy(0, 500, 300, 135, AUTO_BLANCO_NARANJA, AUTO_BLANCO_NARANJA_MASS);
initEnemy(1, 500, 400, 135, AUTO_BLANCO_NARANJA, AUTO_BLANCO_NARANJA_MASS);
initPlayer(50, 300, 0);
break;
case 4 :
initEnemy(0, 500, 200, 180, AUTO_TURBINAS_NARANJA, AUTO_TURBINAS_NARANJA_MASS);
initEnemy(1, 500, 350, 180, AUTO_TURBINAS_NARANJA, AUTO_TURBINAS_NARANJA_MASS);
initPlayer(50, 300, 0);
break;
case 5 :
initEnemy(0, 500, 100, 135, AUTO_BLANCO_NARANJA, AUTO_BLANCO_NARANJA_MASS);
initEnemy(1, 500, 250, 135, AUTO_BLANCO_NARANJA, AUTO_BLANCO_NARANJA_MASS);
initEnemy(2, 500, 400, 225, AUTO_TURBINAS_NARANJA, AUTO_TURBINAS_NARANJA_MASS);
initPlayer(50, 300, 0);
break;
case 6 :
initEnemy(0, 500, 300, 180, AUTO_GOLDEN_AZUL, AUTO_GOLDEN_AZUL_MASS);
initEnemy(1, 500, 350, 180, AUTO_GOLDEN_AZUL, AUTO_GOLDEN_AZUL_MASS);
initPlayer(50, 300, 0);
break;
case 7 :
initEnemy(0, 500, 100, 135, AUTO_VERDE, AUTO_VERDE_MASS);
initEnemy(1, 500, 200, 135, AUTO_VERDE, AUTO_VERDE_MASS);
initEnemy(2, 500, 300, 135, AUTO_GOLDEN_AZUL, AUTO_GOLDEN_AZUL_MASS);
initEnemy(3, 500, 400, 135, AUTO_GOLDEN_AZUL, AUTO_GOLDEN_AZUL_MASS);
initPlayer(50, 300, 0);
break;
case 8 :
initEnemy(0, 50, 100, 0, AUTO_ROJO_DIABLO, AUTO_ROJO_DIABLO_MASS);
initEnemy(1, 500, 100, 180, AUTO_ROJO_DIABLO, AUTO_ROJO_DIABLO_MASS);
initPlayer(50, 300, 0);
break;
case 9 :
initEnemy(0, 50, 100, 0, AUTO_TURBINAS_NARANJA, AUTO_TURBINAS_NARANJA_MASS);
initEnemy(1, 50, 150, 0, AUTO_TURBINAS_NARANJA, AUTO_TURBINAS_NARANJA_MASS);
initEnemy(2, 500, 400, 180, AUTO_TURBINAS_NARANJA, AUTO_TURBINAS_NARANJA_MASS);
initEnemy(3, 500, 450, 180, AUTO_TURBINAS_NARANJA, AUTO_TURBINAS_NARANJA_MASS);
initPlayer(50, 300, 0);
break;
case 10 :
initEnemy(0, 500, 100, 135, AUTO_BLANCO_NARANJA, AUTO_BLANCO_NARANJA_MASS);
initEnemy(1, 500, 450, 225, AUTO_GOLDEN_AZUL, AUTO_GOLDEN_AZUL_MASS);
initEnemy(2, 500, 250, 180, AUTO_ROJO_DIABLO, AUTO_ROJO_DIABLO_MASS);
initEnemy(3, 500, 300, 180, AUTO_ROJO_DIABLO, AUTO_ROJO_DIABLO_MASS);
initPlayer(50, 300, 0);
break;
case 11 :
initEnemy(0, 50, 100, 0, AUTO_TURBINAS_NARANJA, AUTO_TURBINAS_NARANJA_MASS);
initEnemy(1, 50, 150, 0, AUTO_TURBINAS_NARANJA, AUTO_TURBINAS_NARANJA_MASS);
initEnemy(2, 500, 400, 180, AUTO_AZUL_MOTOR, AUTO_AZUL_MOTOR_MASS);
initPlayer(50, 300, 0);
break;
case 12 :
initEnemy(0, 500, 250, 180, AUTO_ROJO_DIABLO, AUTO_ROJO_DIABLO_MASS);
initEnemy(1, 500, 350, 180, AUTO_ROJO_DIABLO, AUTO_ROJO_DIABLO_MASS);
initEnemy(2, 450, 300, 180, AUTO_AZUL_MOTOR, AUTO_AZUL_MOTOR_MASS);
initPlayer(50, 300, 0);
break;
case 13 :
initEnemy(0, 500, 80, 135, AUTO_GOLDEN_AZUL, AUTO_GOLDEN_AZUL_MASS);
initEnemy(1, 500, 430, 225, AUTO_BLANCO_NARANJA, AUTO_BLANCO_NARANJA_MASS);
initEnemy(2, 450, 130, 135, AUTO_AZUL_MOTOR, AUTO_AZUL_MOTOR_MASS);
initEnemy(3, 450, 380, 225, AUTO_VERDE, AUTO_VERDE_MASS);
initPlayer(50, 300, 0);
break;
case 14 :
initEnemy(0, 50, 100, 0, AUTO_TURBINAS_NARANJA, AUTO_TURBINAS_NARANJA_MASS);
initEnemy(1, 50, 150, 0, AUTO_ROJO_DIABLO, AUTO_ROJO_DIABLO_MASS);
initEnemy(2, 500, 450, 180, AUTO_AZUL_MOTOR, AUTO_AZUL_MOTOR_MASS);
initEnemy(3, 500, 400, 180, AUTO_BLANCO_NARANJA, AUTO_BLANCO_NARANJA_MASS);
initPlayer(50, 300, 0);
break;
case 15 :
initEnemy(0, 500, 50, 180, AUTO_AZUL_MOTOR, AUTO_AZUL_MOTOR_MASS);
initEnemy(1, 500, 150, 180, AUTO_AZUL_MOTOR, AUTO_AZUL_MOTOR_MASS);
initEnemy(2, 500, 300, 180, AUTO_AZUL_MOTOR, AUTO_AZUL_MOTOR_MASS);
initEnemy(3, 500, 400, 180, AUTO_AZUL_MOTOR, AUTO_AZUL_MOTOR_MASS);
initPlayer(50, 300, 0);
break;
default :
initEnemy(0, 500, 50, 180, AUTO_AZUL_MOTOR, AUTO_AZUL_MOTOR_MASS);
initEnemy(1, 500, 150, 180, AUTO_AZUL_MOTOR, AUTO_AZUL_MOTOR_MASS);
initEnemy(2, 500, 300, 180, AUTO_AZUL_MOTOR, AUTO_AZUL_MOTOR_MASS);
initEnemy(3, 500, 400, 180, AUTO_AZUL_MOTOR, AUTO_AZUL_MOTOR_MASS);
initPlayer(50, 300, 0);
}
initSemaforo();
stopSoundFondoSelect();
}
function initPlayer(x, y, angle) {
playerCar.x = x;
playerCar.y = y;
playerCar.angle = angle;
playerCar.vel = new Vector2D(0, 0);
playerCar.accelVec = new Vector2D(0, 0);
playerCar.accelMag = 0;
attachMovie("car" + selectedCar, "playerCarClip", PLAYER_DEPTH);
playerCar.clip = playerCarClip;
playerCar.clip._x = x * RATIO_W;
playerCar.clip._y = y * RATIO_H;
playerCar.radius = RADIUS;
playerCar.clip.gotoAndStop(Math.floor(playerCar.angle / ANGULO_ROTACION) + 1);
playerCar.mass = 0.6;
playerCar.energy = 100;
attachMovie("barravida", "playerCarEnergyClip", ENERGY_DEPTH);
playerCar.energyClip = playerCarEnergyClip;
posicionarEnergyClip(playerCar);
playerCar.burbuja1On = false;
playerCar.cuentaBurbuja1 = 0;
playerCar.burbuja2On = false;
playerCar.cuentaBurbuja2 = 0;
switch (selectedCar) {
case 1 :
playerCar.max_vel = 15;
playerCar.mass = 0.65;
playerCar.energy = 80;
playerCar.freno = 0.9;
break;
case 2 :
playerCar.max_vel = 12.5;
playerCar.mass = 0.75;
playerCar.energy = 90;
playerCar.freno = 0.7;
break;
case 3 :
playerCar.max_vel = 10;
playerCar.mass = 0.9;
playerCar.energy = 100;
playerCar.freno = 0.7;
break;
case 4 :
playerCar.max_vel = 13;
playerCar.mass = 0.9;
playerCar.energy = 70;
playerCar.freno = 0.7;
}
var _local1 = Math.floor(Math.abs(100 - playerCar.energy));
if (_local1 == 0) {
_local1 = 1;
}
hud.resistencia.energia.gotoAndStop(_local1);
actualizarEnergy(playerCar);
}
function initEnemy(indice, x, y, angle, auto, mass) {
enemy[indice].x = x;
enemy[indice].y = y;
enemy[indice].angle = angle;
enemy[indice].vel = new Vector2D(0, 0);
enemy[indice].accelVec = new Vector2D(0, 0);
enemy[indice].accelMag = 0;
attachMovie("car" + auto, ("enemy" + indice) + "clip", ENEMY_DEPTH + indice);
enemy[indice].clip = eval (("enemy" + indice) + "clip");
enemy[indice].clip._x = x * RATIO_W;
enemy[indice].clip._y = y * RATIO_H;
enemy[indice].clip.gotoAndStop(Math.floor(enemy[indice].angle / ANGULO_ROTACION) + 1);
enemy[indice].radius = RADIUS;
enemy[indice].mass = mass;
enemy[indice].steeringBehaviour = SEEK_FACIL;
enemy[indice].nextAIChange = FPS * getRandom(5, 10);
enemy[indice].energy = 100;
attachMovie("barravida", ("enemy" + indice) + "EnergyClip", (ENERGY_DEPTH + indice) + 1);
enemy[indice].energyClip = eval (("enemy" + indice) + "EnergyClip");
enemy[indice].energyClip.gotoAndStop(1);
posicionarEnergyClip(enemy[indice]);
enemy[indice].vivo = true;
enemy[indice].tipo = auto;
enemy[indice].burbuja1On = false;
enemy[indice].cuentaBurbuja1 = 0;
enemy[indice].burbuja2On = false;
enemy[indice].cuentaBurbuja2 = 0;
actualizarEnergy(enemy[indice]);
}
function posicionarEnergyClip(car) {
car.energyClip._x = car.clip._x + (CAR_WIDTH / 2);
car.energyClip._y = car.clip._y - 10;
}
function initSemaforo() {
attachMovie("semaforo", "semaforo", SEMAFORO_DEPTH);
semaforo.gotoAndPlay("apagado");
semaforo._x = SCREEN_WIDTH / 2;
semaforo._y = (-semaforo._height) / 2;
cuentaSemaforo = 0;
semaforoOn = true;
semaforoVerde = false;
playSound(SOUND_SEMAFORO);
}
function semaforoLogic() {
cuentaSemaforo++;
if (((cuentaSemaforo == (FPS * 1)) || (cuentaSemaforo == (FPS * 2))) || (cuentaSemaforo == (FPS * 3))) {
playSound(SOUND_ROJO);
}
if (cuentaSemaforo == (FPS * 4)) {
playSound(SOUND_VERDE);
playSoundFondoGame();
}
if (cuentaSemaforo > MAX_CUENTA_SEMAFORO) {
semaforoOn = false;
semaforo.removeMovieClip();
} else if (cuentaSemaforo < (FPS * 1)) {
semaforo._y = semaforo._y + 5;
} else if (cuentaSemaforo < (FPS * 2)) {
semaforo.gotoAndPlay("rojo1");
} else if (cuentaSemaforo < (FPS * 3)) {
semaforo.gotoAndPlay("rojo2");
} else if (cuentaSemaforo < (FPS * 4)) {
semaforo.gotoAndPlay("rojo3");
} else if (cuentaSemaforo < (FPS * 5)) {
semaforo.gotoAndPlay("verde");
semaforoVerde = true;
} else {
semaforo._y = semaforo._y - 5;
}
}
function removeGame() {
stopSoundFondoGame();
pista.removeMovieClip();
paredpista.removeMovieClip();
hud.removeMovieClip();
playerCar.clip.removeMovieClip();
playerCar.energyClip.removeMovieClip();
playerCar = null;
var _local2 = 0;
while (_local2 < numEnemies) {
enemy[_local2].clip.removeMovieClip();
enemy[_local2].energyClip.removeMovieClip();
enemy[_local2] = null;
_local2++;
}
enemy = null;
_local2 = 0;
while (_local2 < numRingsBlanco) {
this["ringBlanco" + _local2].removeMovieClip();
_local2++;
}
_local2 = 0;
while (_local2 < numRingsRojo) {
this["ringRojo" + _local2].removeMovieClip();
_local2++;
}
_local2 = 0;
while (_local2 < numRingsAzul) {
this["ringBlanco" + _local2].removeMovieClip();
_local2++;
}
if (hayBurbuja1) {
burbuja1.removeMovieClip();
}
if (hayBurbuja2) {
burbuja2.removeMovieClip();
}
if (hayBurbuja3) {
burbuja3.removeMovieClip();
}
}
function circleToCircleDetection(x1, y1, radius1, x2, y2, radius2) {
var _local2 = x1 - x2;
var _local1 = y1 - y2;
var _local3 = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
if (_local3 <= (radius1 + radius2)) {
return(true);
}
return(false);
}
function pointToCircleDetection(x1, y1, x2, y2, radius) {
var _local2 = x2 - x1;
var _local1 = y2 - y1;
var _local3 = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
if (_local3 <= radius) {
return(true);
}
return(false);
}
function ordenarProfs() {
var _local3;
var _local2 = 0;
while (_local2 < (numEnemies - 1)) {
var _local1 = _local2 + 1;
while (_local1 < numEnemies) {
if (enemy[_local2].y > enemy[_local1].y) {
_local3 = enemy[_local1];
enemy[_local1] = enemy[_local2];
enemy[_local2] = _local3;
}
_local1++;
}
enemy[_local2].clip.swapDepths(ENEMY_DEPTH + _local2);
_local2++;
}
_local2 = 0;
while (_local2 < numEnemies) {
if (playerCar.y < enemy[_local2].y) {
playerCar.clip.swapDepths(ENEMY_DEPTH + _local2);
var _local1 = _local2;
while (_local1 < numEnemies) {
enemy[_local1].clip.swapDepths((ENEMY_DEPTH + _local1) + 1);
_local1++;
}
break;
}
_local2++;
}
if (playerCar.y > enemy[numEnemies - 1].y) {
playerCar.clip.swapDepths(ENEMY_DEPTH + numEnemies);
}
}
function getRandom(minimum, maximum) {
return(Math.floor((Math.random() * ((maximum - minimum) + 1)) + minimum));
}
function crearSoundManager() {
var _local1 = 1;
createEmptyMovieClip("soundManager", SOUND_MANAGER_DEPTH);
soundManager.createEmptyMovieClip("sonido_boton", _local1++);
soundManager.sonido_boton.miSonido = new Sound(soundManager.sonido_boton);
soundManager.sonido_boton.miSonido.attachSound("sonido_boton.wav");
soundManager.sonido_boton.miSonido.setVolume(100);
soundManager.createEmptyMovieClip("sonido_select", _local1++);
soundManager.sonido_select.miSonido = new Sound(soundManager.sonido_select);
soundManager.sonido_select.miSonido.attachSound("sonido_select.wav");
soundManager.sonido_select.miSonido.setVolume(100);
soundManager.createEmptyMovieClip("sonido_golpe", _local1++);
soundManager.sonido_golpe.miSonido = new Sound(soundManager.sonido_golpe);
soundManager.sonido_golpe.miSonido.attachSound("sonido_golpe.wav");
soundManager.sonido_golpe.miSonido.setVolume(100);
soundManager.createEmptyMovieClip("sonido_golpe_suave", _local1++);
soundManager.sonido_golpe_suave.miSonido = new Sound(soundManager.sonido_golpe_suave);
soundManager.sonido_golpe_suave.miSonido.attachSound("sonido_golpe_suave.wav");
soundManager.sonido_golpe_suave.miSonido.setVolume(100);
soundManager.createEmptyMovieClip("sonido_golpe_barrera", _local1++);
soundManager.sonido_golpe_barrera.miSonido = new Sound(soundManager.sonido_golpe_barrera);
soundManager.sonido_golpe_barrera.miSonido.attachSound("sonido_golpe_barrera.wav");
soundManager.sonido_golpe_barrera.miSonido.setVolume(100);
soundManager.createEmptyMovieClip("sonido_fondo_menu", _local1++);
soundManager.sonido_fondo_menu.miSonido = new Sound(soundManager.sonido_fondo_menu);
soundManager.sonido_fondo_menu.miSonido.attachSound("sonido_fondo_menu.wav");
soundManager.sonido_fondo_menu.miSonido.setVolume(200);
soundManager.sonido_fondo_menu.onSoundComplete = soundFondoComplete;
soundManager.createEmptyMovieClip("sonido_fondo_select", _local1++);
soundManager.sonido_fondo_select.miSonido = new Sound(soundManager.sonido_fondo_select);
soundManager.sonido_fondo_select.miSonido.attachSound("sonido_fondo_select.wav");
soundManager.sonido_fondo_select.miSonido.setVolume(100);
soundManager.sonido_fondo_select.onSoundComplete = soundFondoComplete;
soundManager.createEmptyMovieClip("sonido_fondo", _local1++);
soundManager.sonido_fondo.miSonido = new Sound(soundManager.sonido_fondo);
soundManager.sonido_fondo.miSonido.attachSound("sonido_fondo.wav");
soundManager.sonido_fondo.miSonido.setVolume(50);
soundManager.sonido_fondo.onSoundComplete = soundFondoComplete;
soundManager.createEmptyMovieClip("sonido_car_stop_select", _local1++);
soundManager.sonido_car_stop_select.miSonido = new Sound(soundManager.car_stop_select);
soundManager.sonido_car_stop_select.miSonido.attachSound("car_stop_select.wav");
soundManager.sonido_car_stop_select.miSonido.setVolume(100);
soundManager.createEmptyMovieClip("sonido_car_start_select", _local1++);
soundManager.sonido_car_start_select.miSonido = new Sound(soundManager.car_start_select);
soundManager.sonido_car_start_select.miSonido.attachSound("car_start_select.wav");
soundManager.sonido_car_start_select.miSonido.setVolume(100);
soundManager.createEmptyMovieClip("sonido_rojo", _local1++);
soundManager.sonido_rojo.miSonido = new Sound(soundManager.sonido_rojo);
soundManager.sonido_rojo.miSonido.attachSound("sonido_rojo.wav");
soundManager.sonido_rojo.miSonido.setVolume(150);
soundManager.createEmptyMovieClip("sonido_verde", _local1++);
soundManager.sonido_verde.miSonido = new Sound(soundManager.sonido_verde);
soundManager.sonido_verde.miSonido.attachSound("sonido_verde.wav");
soundManager.sonido_verde.miSonido.setVolume(150);
soundManager.createEmptyMovieClip("sonido_gameover", _local1++);
soundManager.sonido_gameover.miSonido = new Sound(soundManager.sonido_gameover);
soundManager.sonido_gameover.miSonido.attachSound("sonido_gameover.wav");
soundManager.sonido_gameover.miSonido.setVolume(150);
soundManager.createEmptyMovieClip("sonido_morir", _local1++);
soundManager.sonido_morir.miSonido = new Sound(soundManager.sonido_morir);
soundManager.sonido_morir.miSonido.attachSound("sonido_morir.wav");
soundManager.sonido_morir.miSonido.setVolume(150);
soundManager.createEmptyMovieClip("sonido_powerup_enemigo", _local1++);
soundManager.sonido_powerup_enemigo.miSonido = new Sound(soundManager.sonido_powerup_enemigo);
soundManager.sonido_powerup_enemigo.miSonido.attachSound("sonido_powerup_enemigo.wav");
soundManager.sonido_powerup_enemigo.miSonido.setVolume(150);
soundManager.createEmptyMovieClip("sonido_powerup_fuerza", _local1++);
soundManager.sonido_powerup_fuerza.miSonido = new Sound(soundManager.sonido_powerup_fuerza);
soundManager.sonido_powerup_fuerza.miSonido.attachSound("sonido_powerup_fuerza.wav");
soundManager.sonido_powerup_fuerza.miSonido.setVolume(150);
soundManager.createEmptyMovieClip("sonido_powerup_resistencia", _local1++);
soundManager.sonido_powerup_resistencia.miSonido = new Sound(soundManager.sonido_powerup_resistencia);
soundManager.sonido_powerup_resistencia.miSonido.attachSound("sonido_powerup_resistencia.wav");
soundManager.sonido_powerup_resistencia.miSonido.setVolume(150);
soundManager.createEmptyMovieClip("sonido_powerup_velocidad", _local1++);
soundManager.sonido_powerup_velocidad.miSonido = new Sound(soundManager.sonido_powerup_velocidadd);
soundManager.sonido_powerup_velocidad.miSonido.attachSound("sonido_powerup_velocidad.wav");
soundManager.sonido_powerup_velocidad.miSonido.setVolume(150);
soundManager.createEmptyMovieClip("sonido_semaforo", _local1++);
soundManager.sonido_semaforo.miSonido = new Sound(soundManager.sonido_semaforo);
soundManager.sonido_semaforo.miSonido.attachSound("sonido_semaforo.wav");
soundManager.sonido_semaforo.miSonido.setVolume(150);
}
function playSound(s) {
if (soundOn) {
switch (s) {
case SOUND_BOTON :
soundManager.sonido_boton.miSonido.start();
break;
case SOUND_SELECT :
soundManager.sonido_select.miSonido.start();
break;
case SOUND_GOLPE :
soundManager.sonido_golpe.miSonido.start();
break;
case SOUND_GOLPE_SUAVE :
soundManager.sonido_golpe_suave.miSonido.start();
break;
case SOUND_GOLPE_BARRERA :
break;
case SOUND_CAR_STOP_SELECT :
soundManager.sonido_car_stop_select.miSonido.start();
break;
case SOUND_CAR_START_SELECT :
soundManager.sonido_car_start_select.miSonido.start();
break;
case SOUND_ROJO :
soundManager.sonido_rojo.miSonido.start();
break;
case SOUND_VERDE :
soundManager.sonido_verde.miSonido.start();
break;
case SOUND_GAMEOVER :
soundManager.sonido_gameover.miSonido.start();
break;
case SOUND_MORIR :
soundManager.sonido_morir.miSonido.start();
break;
case SOUND_POWERUP_ENEMIGO :
soundManager.sonido_powerup_enemigo.miSonido.start();
break;
case SOUND_POWERUP_FUERZA :
soundManager.sonido_powerup_fuerza.miSonido.start();
break;
case SOUND_POWERUP_RESISTENCIA :
soundManager.sonido_powerup_resistencia.miSonido.start();
break;
case SOUND_POWERUP_VELOCIDAD :
soundManager.sonido_powerup_velocidad.miSonido.start();
break;
case SOUND_SEMAFORO :
soundManager.sonido_semaforo.miSonido.start();
}
}
}
function playSoundFondoGame() {
if (soundOn) {
if (!tocando_fondo) {
soundManager.sonido_fondo.miSonido.start(0, 999999);
tocando_fondo = true;
}
}
}
function stopSoundFondoGame() {
soundManager.sonido_fondo.miSonido.stop();
tocando_fondo = false;
}
function playSoundFondoSelect() {
if (soundOn) {
if (!tocando_fondo) {
soundManager.sonido_fondo_select.miSonido.start(0, 999999);
tocando_fondo = true;
}
}
}
function stopSoundFondoSelect() {
soundManager.sonido_fondo_select.miSonido.stop();
tocando_fondo = false;
}
function playSoundFondoMenu() {
if (soundOn) {
if (!tocando_fondo) {
soundManager.sonido_fondo_menu.miSonido.start(0, 999999);
tocando_fondo = true;
}
}
}
function stopSoundFondoMenu() {
soundManager.sonido_fondo_menu.miSonido.stop();
tocando_fondo = false;
}
function soundFondoComplete() {
tocando_fondo = false;
}
function toogleSound() {
soundOn = !soundOn;
if (!soundOn) {
soundOnOff.parlante.gotoAndStop("off");
stopAllSounds();
tocando_fondo = false;
} else {
soundOnOff.parlante.gotoAndPlay("on");
switch (gameState) {
case MENU :
case INSTRUCTIONS :
playSoundFondoMenu();
return;
case SELECT :
playSoundFondoSelect();
return;
case GAME :
}
}
}
function startPowerUp(x, y, tipo) {
var _local4;
switch (tipo) {
case POWERUP_FUERZA :
startAnimacionRingsBlanco(x, y, 1, TIPO_RING_IN);
break;
case POWERUP_VELOCIDAD :
startAnimacionRingsRojo(x, y, 1, TIPO_RING_IN);
break;
case POWERUP_RESISTENCIA :
startAnimacionRingsAzul(x, y, 1, TIPO_RING_IN);
}
}
function logicBurbujas() {
if (hayBurbuja1) {
if (circleToCircleDetection((playerCar.x + (CAR_WIDTH / 2)) + OFFSET_CIRCULO_X, (playerCar.y + (CAR_HEIGHT / 2)) + OFFSET_CIRCULO_Y, playerCar.radius, burbuja1.x, burbuja1.y, RADIO_BURBUJA)) {
startAnimacionRingsBlanco(burbuja1.x, burbuja1.y, 3, TIPO_RING_OUT);
burbuja1.removeMovieClip();
hayBurbuja1 = false;
destellar();
aplicarPowerupFuerza(playerCar);
playSound(SOUND_POWERUP_FUERZA);
} else {
var _local1 = 0;
while (_local1 < numEnemies) {
if (circleToCircleDetection((enemy[_local1].x + (CAR_WIDTH / 2)) + OFFSET_CIRCULO_X, (enemy[_local1].y + (CAR_HEIGHT / 2)) + OFFSET_CIRCULO_Y, enemy[_local1].radius, burbuja1.x, burbuja1.y, RADIO_BURBUJA)) {
startAnimacionRingsBlanco(burbuja1.x, burbuja1.y, 3, TIPO_RING_OUT);
burbuja1.removeMovieClip();
hayBurbuja1 = false;
destellar();
aplicarPowerupFuerza(enemy[_local1]);
playSound(SOUND_POWERUP_ENEMIGO);
break;
}
_local1++;
}
}
}
if (hayBurbuja2) {
if (circleToCircleDetection((playerCar.x + (CAR_WIDTH / 2)) + OFFSET_CIRCULO_X, (playerCar.y + (CAR_HEIGHT / 2)) + OFFSET_CIRCULO_Y, playerCar.radius, burbuja2.x, burbuja2.y, RADIO_BURBUJA)) {
startAnimacionRingsRojo(burbuja2.x, burbuja2.y, 3, TIPO_RING_OUT);
burbuja2.removeMovieClip();
hayBurbuja2 = false;
destellar();
aplicarPowerupVelocidad(playerCar);
playSound(SOUND_POWERUP_VELOCIDAD);
} else {
var _local1 = 0;
while (_local1 < numEnemies) {
if (circleToCircleDetection((enemy[_local1].x + (CAR_WIDTH / 2)) + OFFSET_CIRCULO_X, (enemy[_local1].y + (CAR_HEIGHT / 2)) + OFFSET_CIRCULO_Y, enemy[_local1].radius, burbuja2.x, burbuja2.y, RADIO_BURBUJA)) {
startAnimacionRingsRojo(burbuja2.x, burbuja2.y, 3, TIPO_RING_OUT);
burbuja2.removeMovieClip();
hayBurbuja2 = false;
destellar();
aplicarPowerupVelocidad(enemy[_local1]);
playSound(SOUND_POWERUP_ENEMIGO);
break;
}
_local1++;
}
}
}
if (hayBurbuja3) {
if (circleToCircleDetection((playerCar.x + (CAR_WIDTH / 2)) + OFFSET_CIRCULO_X, (playerCar.y + (CAR_HEIGHT / 2)) + OFFSET_CIRCULO_Y, playerCar.radius, burbuja3.x, burbuja3.y, RADIO_BURBUJA)) {
startAnimacionRingsAzul(burbuja3.x, burbuja3.y, 3, TIPO_RING_OUT);
burbuja3.removeMovieClip();
hayBurbuja3 = false;
destellar();
aplicarPowerupResistencia(playerCar);
trace(".................................................");
playSound(SOUND_POWERUP_RESISTENCIA);
} else {
var _local1 = 0;
while (_local1 < numEnemies) {
if (circleToCircleDetection((enemy[_local1].x + (CAR_WIDTH / 2)) + OFFSET_CIRCULO_X, (enemy[_local1].y + (CAR_HEIGHT / 2)) + OFFSET_CIRCULO_Y, enemy[_local1].radius, burbuja3.x, burbuja3.y, RADIO_BURBUJA)) {
startAnimacionRingsAzul(burbuja3.x, burbuja3.y, 3, TIPO_RING_OUT);
burbuja3.removeMovieClip();
hayBurbuja3 = false;
destellar();
aplicarPowerupResistencia(enemy[_local1]);
playSound(SOUND_POWERUP_ENEMIGO);
break;
}
_local1++;
}
}
}
}
function aplicarPowerupFuerza(car) {
trace("agarra fuerza");
car.burbuja1On = true;
car.cuentaBurbuja1 = 0;
}
function aplicarPowerupVelocidad(car) {
trace("agarra velocidad");
car.burbuja2On = true;
car.cuentaBurbuja2 = 0;
}
function aplicarPowerupResistencia(car) {
car.energy = car.energy + 30;
if (car.energy > 100) {
car.energy = 100;
}
actualizarEnergy(car);
}
function logicEfectoPowerUps(car) {
if (car.burbuja1On) {
car.cuentaBurbuja1++;
if (car.cuentaBurbuja1 > MAX_CUENTA_EFECTO_BURBUJA) {
car.burbuja1On = false;
trace("termina efecto fuerza");
}
}
if (car.burbuja2On) {
car.cuentaBurbuja2++;
if (car.cuentaBurbuja2 > MAX_CUENTA_EFECTO_BURBUJA) {
car.burbuja2On = false;
trace("termina efecto velocidad");
}
}
}
function addScore(s) {
_root.scoreNum = _root.scoreNum + s;
}
function actualizarEnergy(car) {
var _local1 = Math.floor(Math.abs(100 - car.energy));
if (_local1 == 0) {
_local1 = 1;
}
car.energyClip.gotoAndStop(_local1);
}
_root.scoreNum = 0;
_root.score = _root.scoreNum + "00000";
_root.currentLevel = 1;
POWERUP_FUERZA = 0;
POWERUP_VELOCIDAD = 1;
POWERUP_RESISTENCIA = 3;
FPS = 30;
CAR_WIDTH = 56;
CAR_HEIGHT = 56;
MENU_DEPTH = 100;
FIN_DEPTH = 105;
VIDEO_DEPTH = 106;
INSTRUCTIONS_DEPTH = 110;
SELECT_DEPTH = 115;
PISTA_DEPTH = 120;
COPYRIGHT_DEPTH = 150;
PLAYER_DEPTH = 200;
ENEMY_DEPTH = 201;
CIRCULO_DEPTH = 300;
BURBUJA1_DEPTH = 400;
BURBUJA2_DEPTH = 401;
BURBUJA3_DEPTH = 402;
PARED_PISTA_DEPTH = 450;
HUD_DEPTH = 451;
SOUND_MANAGER_DEPTH = 500;
RINGS_DEPTH_BLANCO = 800;
RINGS_DEPTH_ROJO = 810;
RINGS_DEPTH_AZUL = 820;
PARTICLES_DEPTH = 4000;
SOUND_ON_OFF_DEPTH = 5000;
ESCALERA_DEPTH = 6000;
SELECTED_CAR_DEPTH = 6010;
ENERGY_DEPTH = 7000;
SEMAFORO_DEPTH = 8000;
GAME_OVER_DEPTH = 9000;
LEVEL_OVER_DEPTH = 9100;
TITULO_FINAL_DEPTH = 9200;
MARCO_DEPTH = 9300;
SCREEN_WIDTH = 600;
SCREEN_HEIGHT = 400;
attachMovie("soundOnOff", "soundOnOff", SOUND_ON_OFF_DEPTH);
soundOnOff._xscale = 60;
soundOnOff._yscale = 60;
soundOnOff._alpha = 100;
soundOnOff._x = (SCREEN_WIDTH - soundOnOff._width) - 5;
soundOnOff._y = 5;
soundOnOff.onPress = toogleSound;
attachMovie("destello", "destello", 20000);
destello._visible = false;
hayDestello = false;
MAX_COUNTER_ANIMACION_RINGS_OUT = 30;
MAX_COUNTER_ANIMACION_RINGS_IN = 40;
TIPO_RING_IN = 0;
TIPO_RING_OUT = 1;
numRingsBlanco = 3;
tipoRingBlanco = 0;
maxCounterRingsBlanco = 0;
animacionRingsBlanco = false;
counterAnimacionRingsBlanco = 0;
numRingsRojo = 3;
tipoRingRojo = 0;
maxCounterRingsRojo = 0;
animacionRingsRojo = false;
counterAnimacionRingsRojo = 0;
numRingsAzul = 3;
tipoRingAzul = 0;
maxCounterRingsAzul = 0;
animacionRingsAzul = false;
counterAnimacionRingsAzul = 0;
MAX_COUNTER_ANIMACION_COLOR = 15;
MIN_VEL_SOUND_BARRERA = 2;
MIN_VEL_SOUND_GOLPE = 6;
MIN_VEL_SOUND_GOLPE_SUAVE = 4;
tocando_fondo = false;
soundOn = true;
crearSoundManager();
selectedCar = 1;
arco = 50;
OFFSET_CIRCULO_X = 0;
OFFSET_CIRCULO_Y = 14;
_root.clipGame = this;
PISTA_WIDTH = 600;
PISTA_HEIGHT = 600;
RATIO_W = SCREEN_WIDTH / PISTA_WIDTH;
RATIO_H = SCREEN_HEIGHT / PISTA_HEIGHT;
RADIUS = 20;
STEP_ANGLE = 7.5;
ANGULO_ROTACION = 15;
STEP_ACCEL = 0.04;
MAX_ACCEL = 5;
MAX_VEL_ENEMY = 15;
MAX_VEL_PLAYER = 15;
VEL_5 = 17;
PARK_FRICTION = 0.94;
ROAD_FRICTION = 0.95;
ICE_FRICTION = 0.96;
friction = PARK_FRICTION;
numEnemies = 0;
SEEK_FACIL = 0;
SEEK_MEDIO = 1;
SEEK_DIFICIL = 2;
FLEE_FACIL = 3;
FLEE_MEDIO = 4;
FLEE_DIFICIL = 5;
WANDER_FACIL = 6;
WANDER_MEDIO = 7;
WANDER_DIFICIL = 8;
SEEK_TARGET_FACIL = 9;
SEEK_TARGET_MEDIO = 10;
SEEK_TARGET_DIFICIL = 11;
INIT = 0;
MENU = 1;
INSTRUCTIONS = 2;
SELECT = 3;
GAME = 4;
FIN = 5;
gameState = INIT;
setGameState(MENU);
this.onEnterFrame = onEnterFrameFunction;
gameOver = false;
cuentaGameOver = 0;
MAX_CUENTA_GAME_OVER = FPS * 5;
levelOver = false;
cuentaLevelOver = 0;
MAX_CUENTA_LEVEL_OVER = FPS * 5;
escaleraOn = false;
cuentaEscalera = 0;
MAX_CUENTA_ESCALERA = FPS * 6;
ALTO_CADA_CUADRO = 167;
ESCALERA_Y_SALIDA = 160;
debug = false;
AUTO_VERDE = 5;
AUTO_BLANCO_NARANJA = 9;
AUTO_TURBINAS_NARANJA = 10;
AUTO_GOLDEN_AZUL = 8;
AUTO_ROJO_DIABLO = 7;
AUTO_AZUL_MOTOR = 6;
AUTO_VERDE_MASS = 0.3;
AUTO_BLANCO_NARANJA_MASS = 0.5;
AUTO_TURBINAS_NARANJA_MASS = 0.5;
AUTO_GOLDEN_AZUL_MASS = 0.6;
AUTO_ROJO_DIABLO_MASS = 0.8;
AUTO_AZUL_MOTOR_MASS = 1;
AUTO_TURBINAS_NARANJA_ACCEL_DEC = 0.9;
AUTO_ROJO_PORCENTAJE_SEEK = 50;
AUTO_AZUL_MOTOR_ACCEL_DEC = 0.9;
AUTO_AZUL_MOTOR_PORCENTAJE_SEEK = 50;
MAX_CUENTA_EFECTO_BURBUJA = FPS * 30;
semaforoOn = false;
cuentaSemaforo = 0;
MAX_CUENTA_SEMAFORO = FPS * 6;
semaforoVerde = false;
SOUND_BOTON = 0;
SOUND_SELECT = 1;
SOUND_GOLPE = 2;
SOUND_GOLPE_SUAVE = 3;
SOUND_GOLPE_BORDE = 4;
SOUND_CAR_STOP_SELECT = 5;
SOUND_CAR_START_SELECT = 6;
SOUND_ROJO = 7;
SOUND_VERDE = 8;
SOUND_GAMEOVER = 9;
SOUND_MORIR = 10;
SOUND_POWERUP_ENEMIGO = 11;
SOUND_POWERUP_FUERZA = 12;
SOUND_POWERUP_RESISTENCIA = 13;
SOUND_POWERUP_VELOCIDAD = 14;
SOUND_SEMAFORO = 15;
hayBurbuja1 = false;
hayBurbuja2 = false;
hayBurbuja3 = false;
RADIO_BURBUJA = 5;
Symbol 22 MovieClip [escadadosoponentes] Frame 11
stop();
Symbol 139 MovieClip Frame 1
stop();
Symbol 139 MovieClip Frame 2
stop();
Symbol 139 MovieClip Frame 99
stop();
Symbol 139 MovieClip Frame 100
stop();
Symbol 139 MovieClip Frame 101
stop();
Symbol 145 MovieClip Frame 1
stop();
Symbol 145 MovieClip Frame 99
stop();
Symbol 145 MovieClip Frame 100
stop();
Symbol 256 MovieClip [barravida] Frame 1
stop();
stop();
Symbol 256 MovieClip [barravida] Frame 2
stop();
Symbol 256 MovieClip [barravida] Frame 99
stop();
Symbol 256 MovieClip [barravida] Frame 100
stop();
Symbol 256 MovieClip [barravida] Frame 101
stop();
stop();
Symbol 267 MovieClip [gameover] Frame 11
stop();
Symbol 270 MovieClip [levelover] Frame 11
stop();
Symbol 322 MovieClip [semaforo] Frame 1
stop();
Symbol 322 MovieClip [semaforo] Frame 2
stop();
Symbol 322 MovieClip [semaforo] Frame 3
stop();
Symbol 322 MovieClip [semaforo] Frame 4
stop();
Symbol 322 MovieClip [semaforo] Frame 5
stop();
Symbol 327 MovieClip [burbuja3] Frame 30
gotoAndPlay ("loop");
Symbol 329 MovieClip [burbuja2] Frame 30
gotoAndPlay ("loop");
Symbol 331 MovieClip [burbuja1] Frame 30
gotoAndPlay ("loop");
Symbol 350 MovieClip [status4] Frame 10
stop();
Symbol 353 MovieClip [status3] Frame 10
stop();
Symbol 356 MovieClip [status2] Frame 10
stop();
Symbol 359 MovieClip [status1] Frame 10
stop();
Symbol 371 MovieClip Frame 9
stop();
Symbol 376 MovieClip Frame 16
stop();
Symbol 384 MovieClip Frame 26
stop();
Symbol 386 MovieClip Frame 7
stop();
Symbol 388 MovieClip Frame 9
stop();
Symbol 390 Button
on (press) {
if (!_root.yaArranco) {
_root.clipGame.playSound(_root.clipGame.SOUND_BOTON);
clipChampiones.gotoAndPlay("arrancar");
}
}
Symbol 403 Button
on (release) {
if (!_root.yaArranco) {
_root.clipGame.playSound(_root.clipGame.SOUND_SELECT);
_root.clipGame.nextCar();
_parent.clipChampiones.gotoAndPlay("champion" + _root.clipGame.selectedCar);
}
}
Symbol 410 Button
on (release) {
if (!_root.yaArranco) {
_root.clipGame.playSound(_root.clipGame.SOUND_SELECT);
_root.clipGame.prevCar();
_parent.clipChampiones.gotoAndPlay("champion" + _root.clipGame.selectedCar);
}
}
Symbol 412 MovieClip Frame 15
stop();
Symbol 635 MovieClip Frame 1
_root.yaArranco = false;
_root.clipGame.sel.removeMovieClip();
_root.clipGame.sel.removeMovieClip();
_root.clipGame.playSound(_root.clipGame.SOUND_CAR_STOP_SELECT);
Symbol 635 MovieClip Frame 16
_root.clipGame.playSound(_root.clipGame.SOUND_CAR_STOP_SELECT);
Symbol 635 MovieClip Frame 32
_root.clipGame.playSound(_root.clipGame.SOUND_CAR_STOP_SELECT);
Symbol 635 MovieClip Frame 51
_root.clipGame.playSound(_root.clipGame.SOUND_CAR_STOP_SELECT);
Symbol 635 MovieClip Frame 69
gotoAndPlay ("champion1");
Symbol 635 MovieClip Frame 70
_root.yaArranco = true;
_root.clipGame.attachMovie("status" + _root.clipGame.selectedCar, "sel", 10000);
_root.clipGame.sel._x = 366;
_root.clipGame.sel._y = 86;
_root.clipGame.sel._width = 170;
_root.clipGame.sel._height = 160;
_root.clipGame.attachMovie("carsel" + _root.clipGame.selectedCar, "car", 10001);
_root.clipGame.car._x = 406;
_root.clipGame.car._y = 98;
Symbol 635 MovieClip Frame 73
_root.clipGame.playSound(_root.clipGame.SOUND_CAR_START_SELECT);
Symbol 635 MovieClip Frame 83
_root.clipGame.playSound(_root.clipGame.SOUND_CAR_START_SELECT);
Symbol 635 MovieClip Frame 90
_root.clipGame.playSound(_root.clipGame.SOUND_CAR_START_SELECT);
trace("3");
Symbol 635 MovieClip Frame 100
_root.clipGame.playSound(_root.clipGame.SOUND_CAR_START_SELECT);
trace("4");
Symbol 635 MovieClip Frame 108
Symbol 635 MovieClip Frame 127
_root.yaArranco = false;
Symbol 635 MovieClip Frame 128
_root.yaArranco = false;
_root.clipGame.sel.removeMovieClip();
_root.clipGame.car.removeMovieClip();
removeMovieClip(_root.clipGame.sel);
removeMovieClip(_root.clipGame.car);
_root.clipGame.setGameState(_root.clipGame.GAME);
Symbol 635 MovieClip Frame 157
gotoAndPlay ("repetir1");
Symbol 635 MovieClip Frame 158
gotoAndPlay ("repetir1");
Symbol 635 MovieClip Frame 188
gotoAndPlay ("repetir2");
Symbol 635 MovieClip Frame 218
gotoAndPlay ("repetir3");
Symbol 635 MovieClip Frame 248
gotoAndPlay ("repetir4");
Symbol 647 MovieClip Frame 8
gotoAndPlay (1);
Symbol 647 MovieClip Frame 9
stop();
Symbol 653 Button
on (release) {
_root.clipGame.playSound(_root.clipGame.SOUND_BOTON);
_root.clipGame.setGameState(_root.clipGame.SELECT);
}
Symbol 686 MovieClip Frame 58
stop();
Symbol 705 MovieClip Frame 12
stop();
Symbol 707 MovieClip Frame 11
stop();
Symbol 708 MovieClip Frame 10
stop();
Symbol 716 MovieClip Frame 8
stop();
Symbol 722 Button
on (release) {
_root.clipGame.playSound(_root.clipGame.SOUND_BOTON);
_root.clipGame.setGameState(_root.clipGame.INSTRUCTIONS);
}
Symbol 805 MovieClip [car9] Frame 1
stop();
Symbol 805 MovieClip [car9] Frame 2
stop();
Symbol 805 MovieClip [car9] Frame 3
stop();
Symbol 805 MovieClip [car9] Frame 4
stop();
Symbol 805 MovieClip [car9] Frame 5
stop();
Symbol 805 MovieClip [car9] Frame 6
stop();
Symbol 805 MovieClip [car9] Frame 7
stop();
Symbol 805 MovieClip [car9] Frame 8
stop();
Symbol 805 MovieClip [car9] Frame 9
stop();
Symbol 805 MovieClip [car9] Frame 10
stop();
Symbol 805 MovieClip [car9] Frame 11
stop();
Symbol 805 MovieClip [car9] Frame 12
stop();
Symbol 805 MovieClip [car9] Frame 13
stop();
Symbol 805 MovieClip [car9] Frame 14
stop();
Symbol 805 MovieClip [car9] Frame 15
stop();
Symbol 805 MovieClip [car9] Frame 16
stop();
Symbol 805 MovieClip [car9] Frame 17
stop();
Symbol 805 MovieClip [car9] Frame 18
stop();
Symbol 805 MovieClip [car9] Frame 19
stop();
Symbol 805 MovieClip [car9] Frame 20
stop();
Symbol 805 MovieClip [car9] Frame 21
stop();
Symbol 805 MovieClip [car9] Frame 22
stop();
Symbol 805 MovieClip [car9] Frame 23
stop();
Symbol 805 MovieClip [car9] Frame 24
stop();
Symbol 856 MovieClip [car1] Frame 1
stop();
Symbol 856 MovieClip [car1] Frame 2
stop();
Symbol 856 MovieClip [car1] Frame 3
stop();
Symbol 856 MovieClip [car1] Frame 4
stop();
Symbol 856 MovieClip [car1] Frame 5
stop();
Symbol 856 MovieClip [car1] Frame 6
stop();
Symbol 856 MovieClip [car1] Frame 7
stop();
Symbol 856 MovieClip [car1] Frame 8
stop();
Symbol 856 MovieClip [car1] Frame 9
stop();
Symbol 856 MovieClip [car1] Frame 10
stop();
Symbol 856 MovieClip [car1] Frame 11
stop();
Symbol 856 MovieClip [car1] Frame 12
stop();
Symbol 856 MovieClip [car1] Frame 13
stop();
Symbol 856 MovieClip [car1] Frame 14
stop();
Symbol 856 MovieClip [car1] Frame 15
stop();
Symbol 856 MovieClip [car1] Frame 16
stop();
Symbol 856 MovieClip [car1] Frame 17
stop();
Symbol 856 MovieClip [car1] Frame 18
stop();
Symbol 856 MovieClip [car1] Frame 19
stop();
Symbol 856 MovieClip [car1] Frame 20
stop();
Symbol 856 MovieClip [car1] Frame 21
stop();
Symbol 856 MovieClip [car1] Frame 22
stop();
Symbol 856 MovieClip [car1] Frame 23
stop();
Symbol 856 MovieClip [car1] Frame 24
stop();
Symbol 905 MovieClip [car2] Frame 1
stop();
Symbol 905 MovieClip [car2] Frame 2
stop();
Symbol 905 MovieClip [car2] Frame 3
stop();
Symbol 905 MovieClip [car2] Frame 4
stop();
Symbol 905 MovieClip [car2] Frame 5
stop();
Symbol 905 MovieClip [car2] Frame 6
stop();
Symbol 905 MovieClip [car2] Frame 7
stop();
Symbol 905 MovieClip [car2] Frame 8
stop();
Symbol 905 MovieClip [car2] Frame 9
stop();
Symbol 905 MovieClip [car2] Frame 10
stop();
Symbol 905 MovieClip [car2] Frame 11
stop();
Symbol 905 MovieClip [car2] Frame 12
stop();
Symbol 905 MovieClip [car2] Frame 13
stop();
Symbol 905 MovieClip [car2] Frame 14
stop();
Symbol 905 MovieClip [car2] Frame 15
stop();
Symbol 905 MovieClip [car2] Frame 16
stop();
Symbol 905 MovieClip [car2] Frame 17
stop();
Symbol 905 MovieClip [car2] Frame 18
stop();
Symbol 905 MovieClip [car2] Frame 19
stop();
Symbol 905 MovieClip [car2] Frame 20
stop();
Symbol 905 MovieClip [car2] Frame 21
stop();
Symbol 905 MovieClip [car2] Frame 22
stop();
Symbol 905 MovieClip [car2] Frame 23
stop();
Symbol 905 MovieClip [car2] Frame 24
stop();
Symbol 954 MovieClip [car3] Frame 1
stop();
Symbol 954 MovieClip [car3] Frame 2
stop();
Symbol 954 MovieClip [car3] Frame 3
stop();
Symbol 954 MovieClip [car3] Frame 4
stop();
Symbol 954 MovieClip [car3] Frame 5
stop();
Symbol 954 MovieClip [car3] Frame 6
stop();
Symbol 954 MovieClip [car3] Frame 7
stop();
Symbol 954 MovieClip [car3] Frame 8
stop();
Symbol 954 MovieClip [car3] Frame 9
stop();
Symbol 954 MovieClip [car3] Frame 10
stop();
Symbol 954 MovieClip [car3] Frame 11
stop();
Symbol 954 MovieClip [car3] Frame 12
stop();
Symbol 954 MovieClip [car3] Frame 13
stop();
Symbol 954 MovieClip [car3] Frame 14
stop();
Symbol 954 MovieClip [car3] Frame 15
stop();
Symbol 954 MovieClip [car3] Frame 16
stop();
Symbol 954 MovieClip [car3] Frame 17
stop();
Symbol 954 MovieClip [car3] Frame 18
stop();
Symbol 954 MovieClip [car3] Frame 19
stop();
Symbol 954 MovieClip [car3] Frame 20
stop();
Symbol 954 MovieClip [car3] Frame 21
stop();
Symbol 954 MovieClip [car3] Frame 22
stop();
Symbol 954 MovieClip [car3] Frame 23
stop();
Symbol 954 MovieClip [car3] Frame 24
stop();
Symbol 1003 MovieClip [car4] Frame 1
stop();
Symbol 1003 MovieClip [car4] Frame 2
stop();
Symbol 1003 MovieClip [car4] Frame 3
stop();
Symbol 1003 MovieClip [car4] Frame 4
stop();
Symbol 1003 MovieClip [car4] Frame 5
stop();
Symbol 1003 MovieClip [car4] Frame 6
stop();
Symbol 1003 MovieClip [car4] Frame 7
stop();
Symbol 1003 MovieClip [car4] Frame 8
stop();
Symbol 1003 MovieClip [car4] Frame 9
stop();
Symbol 1003 MovieClip [car4] Frame 10
stop();
Symbol 1003 MovieClip [car4] Frame 11
stop();
Symbol 1003 MovieClip [car4] Frame 12
stop();
Symbol 1003 MovieClip [car4] Frame 13
stop();
Symbol 1003 MovieClip [car4] Frame 14
stop();
Symbol 1003 MovieClip [car4] Frame 15
stop();
Symbol 1003 MovieClip [car4] Frame 16
stop();
Symbol 1003 MovieClip [car4] Frame 17
stop();
Symbol 1003 MovieClip [car4] Frame 18
stop();
Symbol 1003 MovieClip [car4] Frame 19
stop();
Symbol 1003 MovieClip [car4] Frame 20
stop();
Symbol 1003 MovieClip [car4] Frame 21
stop();
Symbol 1003 MovieClip [car4] Frame 22
stop();
Symbol 1003 MovieClip [car4] Frame 23
stop();
Symbol 1003 MovieClip [car4] Frame 24
stop();
Symbol 1052 MovieClip [car7] Frame 1
stop();
Symbol 1052 MovieClip [car7] Frame 2
stop();
Symbol 1052 MovieClip [car7] Frame 3
stop();
Symbol 1052 MovieClip [car7] Frame 4
stop();
Symbol 1052 MovieClip [car7] Frame 5
stop();
Symbol 1052 MovieClip [car7] Frame 6
stop();
Symbol 1052 MovieClip [car7] Frame 7
stop();
Symbol 1052 MovieClip [car7] Frame 8
stop();
Symbol 1052 MovieClip [car7] Frame 9
stop();
Symbol 1052 MovieClip [car7] Frame 10
stop();
Symbol 1052 MovieClip [car7] Frame 11
stop();
Symbol 1052 MovieClip [car7] Frame 12
stop();
Symbol 1052 MovieClip [car7] Frame 13
stop();
Symbol 1052 MovieClip [car7] Frame 14
stop();
Symbol 1052 MovieClip [car7] Frame 15
stop();
Symbol 1052 MovieClip [car7] Frame 16
stop();
Symbol 1052 MovieClip [car7] Frame 17
stop();
Symbol 1052 MovieClip [car7] Frame 18
stop();
Symbol 1052 MovieClip [car7] Frame 19
stop();
Symbol 1052 MovieClip [car7] Frame 20
stop();
Symbol 1052 MovieClip [car7] Frame 21
stop();
Symbol 1052 MovieClip [car7] Frame 22
stop();
Symbol 1052 MovieClip [car7] Frame 23
stop();
Symbol 1052 MovieClip [car7] Frame 24
stop();
Symbol 1101 MovieClip [car8] Frame 1
stop();
Symbol 1101 MovieClip [car8] Frame 2
stop();
Symbol 1101 MovieClip [car8] Frame 3
stop();
Symbol 1101 MovieClip [car8] Frame 4
stop();
Symbol 1101 MovieClip [car8] Frame 5
stop();
Symbol 1101 MovieClip [car8] Frame 6
stop();
Symbol 1101 MovieClip [car8] Frame 7
stop();
Symbol 1101 MovieClip [car8] Frame 8
stop();
Symbol 1101 MovieClip [car8] Frame 9
stop();
Symbol 1101 MovieClip [car8] Frame 10
stop();
Symbol 1101 MovieClip [car8] Frame 11
stop();
Symbol 1101 MovieClip [car8] Frame 12
stop();
Symbol 1101 MovieClip [car8] Frame 13
stop();
Symbol 1101 MovieClip [car8] Frame 14
stop();
Symbol 1101 MovieClip [car8] Frame 15
stop();
Symbol 1101 MovieClip [car8] Frame 16
stop();
Symbol 1101 MovieClip [car8] Frame 17
stop();
Symbol 1101 MovieClip [car8] Frame 18
stop();
Symbol 1101 MovieClip [car8] Frame 19
stop();
Symbol 1101 MovieClip [car8] Frame 20
stop();
Symbol 1101 MovieClip [car8] Frame 21
stop();
Symbol 1101 MovieClip [car8] Frame 22
stop();
Symbol 1101 MovieClip [car8] Frame 23
stop();
Symbol 1101 MovieClip [car8] Frame 24
stop();
Symbol 1149 MovieClip [car5] Frame 1
stop();
Symbol 1149 MovieClip [car5] Frame 2
stop();
Symbol 1149 MovieClip [car5] Frame 3
stop();
Symbol 1149 MovieClip [car5] Frame 4
stop();
Symbol 1149 MovieClip [car5] Frame 5
stop();
Symbol 1149 MovieClip [car5] Frame 6
stop();
Symbol 1149 MovieClip [car5] Frame 7
stop();
Symbol 1149 MovieClip [car5] Frame 8
stop();
Symbol 1149 MovieClip [car5] Frame 9
stop();
Symbol 1149 MovieClip [car5] Frame 10
stop();
Symbol 1149 MovieClip [car5] Frame 11
stop();
Symbol 1149 MovieClip [car5] Frame 12
stop();
Symbol 1149 MovieClip [car5] Frame 13
stop();
Symbol 1149 MovieClip [car5] Frame 14
stop();
Symbol 1149 MovieClip [car5] Frame 15
stop();
Symbol 1149 MovieClip [car5] Frame 16
stop();
Symbol 1149 MovieClip [car5] Frame 17
stop();
Symbol 1149 MovieClip [car5] Frame 18
stop();
Symbol 1149 MovieClip [car5] Frame 19
stop();
Symbol 1149 MovieClip [car5] Frame 20
stop();
Symbol 1149 MovieClip [car5] Frame 21
stop();
Symbol 1149 MovieClip [car5] Frame 22
stop();
Symbol 1149 MovieClip [car5] Frame 23
stop();
Symbol 1149 MovieClip [car5] Frame 24
stop();
Symbol 1198 MovieClip [car6] Frame 1
stop();
Symbol 1198 MovieClip [car6] Frame 2
stop();
Symbol 1198 MovieClip [car6] Frame 3
stop();
Symbol 1198 MovieClip [car6] Frame 4
stop();
Symbol 1198 MovieClip [car6] Frame 5
stop();
Symbol 1198 MovieClip [car6] Frame 6
stop();
Symbol 1198 MovieClip [car6] Frame 7
stop();
Symbol 1198 MovieClip [car6] Frame 8
stop();
Symbol 1198 MovieClip [car6] Frame 9
stop();
Symbol 1198 MovieClip [car6] Frame 10
stop();
Symbol 1198 MovieClip [car6] Frame 11
stop();
Symbol 1198 MovieClip [car6] Frame 12
stop();
Symbol 1198 MovieClip [car6] Frame 13
stop();
Symbol 1198 MovieClip [car6] Frame 14
stop();
Symbol 1198 MovieClip [car6] Frame 15
stop();
Symbol 1198 MovieClip [car6] Frame 16
stop();
Symbol 1198 MovieClip [car6] Frame 17
stop();
Symbol 1198 MovieClip [car6] Frame 18
stop();
Symbol 1198 MovieClip [car6] Frame 19
stop();
Symbol 1198 MovieClip [car6] Frame 20
stop();
Symbol 1198 MovieClip [car6] Frame 21
stop();
Symbol 1198 MovieClip [car6] Frame 22
stop();
Symbol 1198 MovieClip [car6] Frame 23
stop();
Symbol 1198 MovieClip [car6] Frame 24
stop();
Symbol 1247 MovieClip [car10] Frame 1
stop();
Symbol 1247 MovieClip [car10] Frame 2
stop();
Symbol 1247 MovieClip [car10] Frame 3
stop();
Symbol 1247 MovieClip [car10] Frame 4
stop();
Symbol 1247 MovieClip [car10] Frame 5
stop();
Symbol 1247 MovieClip [car10] Frame 6
stop();
Symbol 1247 MovieClip [car10] Frame 7
stop();
Symbol 1247 MovieClip [car10] Frame 8
stop();
Symbol 1247 MovieClip [car10] Frame 9
stop();
Symbol 1247 MovieClip [car10] Frame 10
stop();
Symbol 1247 MovieClip [car10] Frame 11
stop();
Symbol 1247 MovieClip [car10] Frame 12
stop();
Symbol 1247 MovieClip [car10] Frame 13
stop();
Symbol 1247 MovieClip [car10] Frame 14
stop();
Symbol 1247 MovieClip [car10] Frame 15
stop();
Symbol 1247 MovieClip [car10] Frame 16
stop();
Symbol 1247 MovieClip [car10] Frame 17
stop();
Symbol 1247 MovieClip [car10] Frame 18
stop();
Symbol 1247 MovieClip [car10] Frame 19
stop();
Symbol 1247 MovieClip [car10] Frame 20
stop();
Symbol 1247 MovieClip [car10] Frame 21
stop();
Symbol 1247 MovieClip [car10] Frame 22
stop();
Symbol 1247 MovieClip [car10] Frame 23
stop();
Symbol 1247 MovieClip [car10] Frame 24
stop();
Symbol 1275 Button
on (release) {
_root.clipGame.playSound(_root.clipGame.SOUND_BOTON);
_root.clipGame.setGameState(_root.clipGame.MENU);
}
Symbol 1284 MovieClip [__Packages.Vector2D] Frame 0
class Vector2D
{
var x, y;
function Vector2D (x, y) {
this.x = x;
this.y = y;
}
function getX() {
return(x);
}
function getY() {
return(y);
}
function setXY(x, y) {
this.x = x;
this.y = y;
}
function magnitud() {
return(Math.sqrt((x * x) + (y * y)));
}
function truncate(max) {
if (magnitud() > max) {
normalize();
mul(max);
}
}
function normalize() {
var _local2 = magnitud();
if (_local2 > EPSILON) {
x = x / _local2;
y = y / _local2;
}
}
function mul(n) {
x = x * n;
y = y * n;
}
function trace() {
trace(((("(" + x) + ",") + y) + ")");
}
function mirror() {
x = x * -1;
}
function flip() {
y = y * -1;
}
function sign(v2) {
if ((y * v2.getX()) > (x * v2.getY())) {
return(-1);
}
return(1);
}
var EPSILON = 1E-6;
}