Encontre un juego que es muy parecido pero no entiendo el codigo.
me lo podrian explicar.
Código :
stop();
theScore = 0;
if (useMouseOn == undefined)
useMouseOn = 1;
gBallBaseLoc = [208, 329];//De donde sale el balon
gGameRect = [19, 15, 397, 397];//Rectangulo del juego
theNumberOfBalls = 1; //Numero de balones
//ballsLeft = 2; // Vidas
pauseBall = 0;//Pausa del balon
setPause = 0;//Pausa del mouse
function moveTheBalls () {//funcion vidas o numero de balones
x=1
thisBall = theBallsList["ball"+x];
if (!thisBall == 0) {
thisBall.moveBall();
}
}
function newBallList (startBallNum) {//funcion para crear nuevo balon
this["ball"+startBallNum] = new newBall("ball"+startBallNum);
}
function newBall (instName) {
duplicateMovieClip ("ball", instName, theNumberOfBalls);
this.name = instName;
this.MovieClip = _level0[instName];
this.MovieClip._x = gBallBaseLoc[0];
this.MovieClip._y = gBallBaseLoc[1];
this.deltaX = getRandom(-5, 5);
this.deltaY = -5;
this.HitNum = 0;
}
newBall.prototype.moveBall = function () {
if (pauseBall == 0)
{
this.MovieClip._x += this.deltaX;
this.MovieClip._y += this.deltaY;
if (this.MovieClip.hitTest(_level0.paddle) && this.deltaY > 0) {
this.paddleHit(_level0.paddle);
}
if (this.MovieClip._y>(gGameRect[3]+20)) {
if (theCurBallNum<=0) {//Game Over
gotoAndStop (5);
}
}
//Borde Derecho
if (this.MovieClip._x<=gGameRect[0] || this.MovieClip._x>=gGameRect[2]) {
this.flipX();
}
//Techo
if (this.MovieClip._y <= gGameRect[1])
{
this.flipY();
}
}
}
//Rebote con el techo
newBall.prototype.flipY = function () {
this.deltaY *= -1;
}
//Rebote con el lado derecho
newBall.prototype.flipX = function () {
this.deltaX *= -1;
}
//rebote con la bota
newBall.prototype.paddleHit = function (thePaddle) {
this.deltaX = (this.MovieClip._x - thePaddle._x)/4;
this.flipY();
this.MovieClip._y = Math.min(this.MovieClip._y, (thePaddle._y)+10);
}dejo el *.fla para que vean el resto del codigo.
http://www.megaupload.com/?d=OHYX46E0
PD: como hago que cuente cuando el balon toque el zapato??a
ayudaaaaa
