Comunidad de diseño web y desarrollo en internet online

Ayuda con removeMovieClip

Citar            
MensajeEscrito el 05 Ago 2009 04:04 am
Hola gente, tengo varios problemas con este codigo:

Código ActionScript :

stop();
clock = 0;
lives = 4;
score = 0;
enemies = 4;
enemiesonstage = 0;
timer = function () {
   clock += 1;
};
enemytimer = function () {
   enemies += 1;
};
onEnterFrame = function () {
   if (enemiesonstage<enemies) {
      var enemy:MovieClip = attachMovie("enemy", "enemy"+enemiesonstage, _root.getNextHighestDepth());
      enemiesonstage += 1;
      enemy.dir = random(4);
      //This line sets the sizes randomly to begin with
      enemy._xscale = enemy._yscale=random(100)+50;
      if (enemy.dir == 1) {
         enemy._x = random(300);
         enemy._y = random(-50);
         enemy.yspeed = random(7)+1;
         enemy.xspeed = 0;
      } else if (enemy.dir == 2) {
         enemy._x = random(300);
         enemy._y = random(50)+300;
         enemy.yspeed = random(-7)-1;
         enemy.xspeed = 0;
      } else if (enemy.dir == 3) {
         enemy._x = random(-50);
         enemy._y = random(300);
         enemy.yspeed = 0;
         enemy.xspeed = random(7)+1;
      } else if (enemy.dir == 0) {
         enemy._x = random(50)+300;
         enemy._y = random(300);
         enemy.yspeed = 0;
         enemy.xspeed = random(-7)-1;
      }
      if (_root.score>=10) {
         _root.gotoAndStop(1);
         enemy.removeMovieClip();
         stopAllSounds();
      }
      if (_root.clock>=30) {
         _root.gotoAndStop("gameover");
         enemy.removeMovieClip();
         stopAllSounds();
      }
      enemy.onEnterFrame = function() {
         this._y += this.yspeed;
         this._x += this.xspeed;
         if (this.hit.hitTest(_root.player)) {
            if (_root.lives>=1) {
               this.dir = random(4);
               //This line re-randomises the scale of the enmy when it hits the player
               this._xscale = this._yscale=random(100)+50;
               if (this.dir == 1) {
                  this._x = random(300);
                  this._y = random(-50);
                  this.yspeed = random(7)+1;
                  this.xspeed = 0;
               } else if (this.dir == 2) {
                  this._x = random(300);
                  this._y = random(50)+300;
                  this.yspeed = random(-7)-1;
                  this.xspeed = 0;
               } else if (this.dir == 3) {
                  this._x = random(-50);
                  this._y = random(300);
                  this.yspeed = 0;
                  this.xspeed = random(7)+1;
               } else if (this.dir == 0) {
                  this._x = random(50)+300;
                  this._y = random(300);
                  this.yspeed = 0;
                  this.xspeed = random(-7)-1;
               }
               _root.lives -= 1;
               _root.lose_life.gotoAndPlay(1);
               _root.heart.play();
            }
         }
         if (_root.lives<=0) {
            _root.gotoAndStop("gameover");
            this.removeMovieClip();
            stopAllSounds();
         }
         if (this._y>=310 && this.dir == 1) {
            this.dir = random(4);
            //This line re-randomises the scale when the enemy leaves the stage
            this._xscale = this._yscale=random(100)+50;
            if (this.dir == 1) {
               this._x = random(300);
               this._y = random(-50);
               this.yspeed = random(7)+1;
               this.xspeed = 0;
            } else if (this.dir == 2) {
               this._x = random(300);
               this._y = random(50)+300;
               this.yspeed = random(-7)-1;
               this.xspeed = 0;
            } else if (this.dir == 3) {
               this._x = random(-50);
               this._y = random(300);
               this.yspeed = 0;
               this.xspeed = random(7)+1;
            } else if (this.dir == 0) {
               this._x = random(50)+300;
               this._y = random(300);
               this.yspeed = 0;
               this.xspeed = random(-7)-1;
            }
         } else if (this._y<=-20 && this.dir == 2) {
            this.dir = random(4);
            //This line re-randomises the scale when the enemy leaves the stage
            this._xscale = this._yscale=random(100)+50;
            if (this.dir == 1) {
               this._x = random(300);
               this._y = random(-50);
               this.yspeed = random(7)+1;
               this.xspeed = 0;
            } else if (this.dir == 2) {
               this._x = random(300);
               this._y = random(50)+300;
               this.yspeed = random(-7)-1;
               this.xspeed = 0;
            } else if (this.dir == 3) {
               this._x = random(-50);
               this._y = random(300);
               this.yspeed = 0;
               this.xspeed = random(7)+1;
            } else if (this.dir == 0) {
               this._x = random(50)+300;
               this._y = random(300);
               this.yspeed = 0;
               this.xspeed = random(-7)-1;
            }
         } else if (this._x>=320 && this.dir == 3) {
            this.dir = random(4);
            //This line re-randomises the scale when the enemy leaves the stage
            this._xscale = this._yscale=random(100)+50;
            if (this.dir == 1) {
               this._x = random(300);
               this._y = random(-50);
               this.yspeed = random(7)+1;
               this.xspeed = 0;
            } else if (this.dir == 2) {
               this._x = random(300);
               this._y = random(50)+300;
               this.yspeed = random(-7)-1;
               this.xspeed = 0;
            } else if (this.dir == 3) {
               this._x = random(-50);
               this._y = random(300);
               this.yspeed = 0;
               this.xspeed = random(7)+1;
            } else if (this.dir == 0) {
               this._x = random(50)+300;
               this._y = random(300);
               this.yspeed = 0;
               this.xspeed = random(-7)-1;
            }
         } else if (this._x<=-20 && this.dir == 0) {
            this.dir = random(4);
            //This line re-randomises the scale when the enemy leaves the stage
            this._xscale = this._yscale=random(100)+50;
            if (this.dir == 1) {
               this._x = random(300);
               this._y = random(-50);
               this.yspeed = random(7)+1;
               this.xspeed = 0;
            } else if (this.dir == 2) {
               this._x = random(300);
               this._y = random(50)+300;
               this.yspeed = random(-7)-1;
               this.xspeed = 0;
            } else if (this.dir == 3) {
               this._x = random(-50);
               this._y = random(300);
               this.yspeed = 0;
               this.xspeed = random(7)+1;
            } else if (this.dir == 0) {
               this._x = random(50)+300;
               this._y = random(300);
               this.yspeed = 0;
               this.xspeed = random(-7)-1;
            }
         }
      };
   }
};


Primero quiero cambiar las dimensiones del documento y no se que tengo que cambiar en el codigo para que los enemigos aparescan mas lejos y segundo en la parte que dice:

Código ActionScript :

if (_root.score>=10) {
         _root.gotoAndStop(1);
         enemy.removeMovieClip();
         stopAllSounds();
      }
      if (_root.clock>=30) {
         _root.gotoAndStop("gameover");
         enemy.removeMovieClip();
         stopAllSounds();
      }


Va al fotograma indicado pero no me borra el clip de pelicula y ademas tarda un rato en pasar al fotograma.

SWF
FLA

AYUDA!!!

Por thegamesx

4 de clabLevel



 

opera
Citar            
MensajeEscrito el 06 Ago 2009 10:43 am
El "remove" que dices, creo que será unloadMovie

Por Wyrm

Claber

1545 de clabLevel

15 tutoriales

 

firefox
Citar            
MensajeEscrito el 06 Ago 2009 01:31 pm
Muchas por responder pero no me funciono, me sigue pasando lo mismo.
Capaz puse mal alguna parte del codigo.

Por thegamesx

4 de clabLevel



 

opera

 

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