Comunidad de diseño web y desarrollo en internet online

explicacion de codigo en flash 8.0

Citar            
MensajeEscrito el 27 Ago 2008 02:51 am
Me pidieron que hiciera un juego.
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

Por hacker225

1 de clabLevel



 

msie
Citar            
MensajeEscrito el 27 Ago 2008 08:33 am
Es un poco largo de explicar, este código que has puesto deben ser unos buenos largos párrafos, mejor tratas de interpretar con la ayuda de flash al lado que quiere decir cada cosa y de tener dudas postea solamente una sección de código, pero no un código completo.

Por elchininet

Claber

3921 de clabLevel

17 tutoriales

Genero:Masculino  

Front-end developer at Booking.com

firefox
Citar            
MensajeEscrito el 27 Ago 2008 08:04 pm
lee los comentarios ahi dice.

Por DiegoAzul

376 de clabLevel



 

Mx

firefox
Citar            
MensajeEscrito el 29 Ago 2008 12:55 am
Pero los comentarios estan en un idioma raro

Por hacker225

1 de clabLevel



 

msie
Citar            
MensajeEscrito el 29 Ago 2008 02:14 am
te recomiendo que lo armes vos de 0, porque tenes mil formas diferentes de hacer este juego, y quizas el que lo armo se complicó bastante

Por lucasmoyano

Claber

1960 de clabLevel

22 tutoriales

Genero:Masculino  

Developer

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.