Ok vamos a ver si me explico bien...cualquier duda me escribe.
Lo que esten en "" son los nombre de instancia
En el juego controla a un personaje "Orion" ok
el tiene varios estados en el clip (COrrer, saltar, atacar, etc....)
se recogen monedas "coin"
se atacan a los enemigos "enemigo1"
el mundo donde camina es "piso"
El problema se da que si permanezco mas de 6 o 7 minutos jugando el juego se pone super lento y a raiz de ese problema lo he dejado de lado un poco.....no encuentro cual es el problema especificamente...
Si alguien me ayuda a chequear....lo que si me he dado cuenta que luego d elos 7 min el problema se nota SOLO cuando muevo el personaje...
De antemano gracias a los que se interesen en ayudarme......!!!
Aqui el codigo que utilizo:
Código ActionScript :
stop(); //Variables// var monedas:Number = 0; var numataque:Number = 1 var atacando:Boolean = false var velLateral:Number = 3; var friccion:Number = .6; var friccionAire:Number = .6; var gravedad:Number = -4.5; var tiempoSalto:Number = 4; var salto:Number = 30/tiempoSalto; var velMaxima:Number = 20; var puntoIzq:Number = -10; var puntoDer:Number = 10; var puntoBajo:Number = 17.5; var puntoArriba:Number = -17.5; var vermenu:Boolean=true var muerto:Boolean=false //Inicializar Personaje// function inicializarPersonaje(mc:MovieClip):Void{ if(mc.dx==undefined){ mc.dx = 0; mc.dy = 0; mc.saltando = true; mc.empezoSalto=0; } mc.friccion = friccion; mc.vel = velLateral; mc.salto = salto; } //Manejar Personaje// function manejarPersonaje():Void{ if(Key.isDown(Key.SPACE)&&_root.atacando==false){ _root.atacando=true orion.gotoAndPlay("atq"+numataque); } if(Key.isDown(Key.LEFT)&&_root.atacando==false){ orion.dx -= orion.vel; correIzq(orion); orion._xscale=-100 orion.gotoAndStop("andando"); if(Key.isDown(Key.SHIFT)&&orion.saltando==true){ orion._x-=3 orion.gotoAndStop("andandoturbo"); } } if(Key.isDown(Key.RIGHT)&&_root.atacando==false){ orion.dx += orion.vel; orion._xscale=100 orion.gotoAndStop("andando"); if(Key.isDown(Key.SHIFT)&&orion.saltando==true){ orion._x+=3 orion.gotoAndStop("andandoturbo"); } } if(Key.isDown(Key.DOWN)&&_root.atacando==false&&orion.saltando==false){ orion.gotoAndStop("agachado"); atacando=true } if(Key.isDown(Key.UP)&&orion.saltando==false&&_root.atacando==false){ salta(orion); orion.gotoAndStop("saltando"); }else if(Key.isDown(Key.UP)&&orion.empezoSalto>0){ orion.dy-=orion.salto; } orion.empezoSalto--; var listKey:Object = new Object(); listKey.onKeyUp = function () { switch (Key.getCode()) { case Key.LEFT: if(Key.isDown(Key.RIGHT)&&_root.atacando==false) { orion.gotoAndStop("andando"); } else if(_root.atacando==false) { orion.gotoAndStop("detenido"); } break; case Key.UP: if(Key.isDown(Key.RIGHT)&&_root.atacando==false) { orion.gotoAndStop("andando"); } else if(Key.isDown(Key.LEFT)&&_root.atacando==false) { orion.gotoAndStop("andando"); } else if(_root.atacando==false) { orion.gotoAndStop("detenido"); } break; case Key.RIGHT: if(Key.isDown(Key.RIGHT)&&_root.atacando==false) { orion.gotoAndStop("andando"); } else if(_root.atacando==false) { orion.gotoAndStop("detenido"); } break; case Key.DOWN: atacando=false if(Key.isDown(Key.RIGHT)&&_root.atacando==false) { orion.gotoAndStop("andando"); } else if(Key.isDown(Key.LEFT)&&_root.atacando==false) { orion.gotoAndStop("andando"); } else if(_root.atacando==false) { orion.gotoAndStop("detenido"); } break; } } Key.addListener(listKey); } function salta(mc:MovieClip):Void{ inicializarPersonaje(mc); mc.friccion = friccionAire; mc.dy -= mc.salto; mc.saltando = true; mc.empezoSalto=tiempoSalto; } //Checar Colisiones//Puertas//Piso Negativos function checarColisiones(mc:MovieClip):Void{ while(piso.hitTest(mc._x,mc._y+puntoArriba,true)){ mc._y++; mc.dy = Math.abs(mc.dy); } while(piso.hitTest(mc._x,mc._y+puntoBajo,true)){ mc.saltando = false; mc._y--; mc.dy = 0; } while(pisonegativo.hitTest(mc._x,mc._y+puntoBajo,true)&&muerto==false){ mc.saltando = false; mc._y--; mc.dy = 0; _root.vida=_root.vida-1 orion.gotoAndStop("herido"); if(muerto==true) { _root.atacando=true this.barradevida.gotoAndStop(1); _root.orion.gotoAndStop("muerto"); } } while(piso.hitTest(mc._x+puntoIzq+1,mc._y,true)){ mc._x++; mc.dx=0; } if (caida.hitTest(mc._x+puntoIzq+1,mc._y,true)){ gotoAndStop("gameover",1); } while(piso.hitTest(mc._x+puntoIzq+1,mc._y+puntoBajo/2,true)){ mc._x++; mc.dx=0; } if (salida.hitTest(mc._x+puntoIzq+1,mc._y,true)){ nextFrame(); } if (salida.hitTest(mc._x+puntoDer+1,mc._y,true)){ nextFrame(); } while(piso.hitTest(mc._x+puntoDer-1,mc._y,true)){ mc._x--; mc.dx=0; } while(piso.hitTest(mc._x+puntoDer-1,mc._y+puntoBajo/2,true)){ mc._x--; mc.dx=0; } } //Aplicar Movimiento// function aplicarMovimiento():Void{ this._x+=this.dx; this.dx*=this.friccion; if(this.dx>velMaxima){ this.dx=velMaxima; }else if(this.dx<-velMaxima){ this.dx=-velMaxima; } this._y+=this.dy; if(!piso.hitTest(this._x,this._y+puntoBajo+1,true)){ this.saltando = true; } if(this.saltando){ this.suelo = 0; this.dy-=gravedad; if(this.dy>salto*tiempoSalto){ this.dy = salto*tiempoSalto; } } checarColisiones(this); } //Menu de Datos// function menudedatos() { if(Key.isDown(Key.CONTROL)&&vermenu==true){ this._visible=0 this.play(); } if(Key.isDown(Key.CONTROL)&&vermenu==false){ this._visible=1 this.play(); } this.espada.gotoAndStop(_root.numespada); this.barradevida.gotoAndStop(Math.round((_root.vida*100)/_root.maxvida)); this.esp="+"+espada this.frz=fuerza this.def=defensa this.nvl=nivel this.vidaa=vida this.expe=experiencia this.proxnvl=proxnivel this.mon=monedas if(experiencia >= proxnivel) { proxnivel = Math.round(proxnivel+((50*proxnivel)/100)) nivel = nivel+1 maxvida = Math.round(maxvida+((10*maxvida)/100)) vida=maxvida fuerza = Math.round(fuerza+((12*fuerza)/100)) defensa = Math.round(defensa+((10*defensa)/100)) subenivel.play(); subenivel._x=orion._x subenivel._y=orion._y } if(vida <= 0&&muerto==false) { vida = 0 muerto=true _root.atacando=true this.barradevida.gotoAndStop(1); _root.orion.gotoAndStop("muerto"); } if(vida > maxvida) { vida = maxvida } if(nivel >= 10) { ataque2=true this.atq2._visible=1 } else if(nivel <= 10) { ataque2=false this.atq2._visible=0 } if(nivel >= 20) { ataque3=true this.atq3._visible=1 } else if(nivel <= 20) { ataque3=false this.atq3._visible=0 } if(nivel >= 30) { ataque4=true this.atq4._visible=1 } else if(nivel <= 30) { ataque4=false this.atq4._visible=0 } if(nivel >= 40) { ataque5=true this.atq5._visible=1 } else if(nivel <= 40) { ataque5=false this.atq5._visible=0 } if(nivel >= 50) { ataque6=true this.atq6._visible=1 } else if(nivel <= 50) { ataque6=false this.atq6._visible=0 } if(Key.isDown(49)) { _root.numataque = 1; this.destello._x=this.atq1._x this.destello._y=this.atq1._y } if(Key.isDown(50)&&ataque2==true) { _root.numataque = 2; this.destello._x=this.atq2._x this.destello._y=this.atq2._y } if(Key.isDown(51)&&ataque3==true) { _root.numataque = 3; this.destello._x=this.atq3._x this.destello._y=this.atq3._y } if(Key.isDown(52)&&_root.ataque4==true) { _root.numataque = 4; this.destello._x=this.atq4._x this.destello._y=this.atq4._y } if(Key.isDown(53)&&_root.ataque5==true) { _root.numataque = 5; this.destello._x=this.atq5._x this.destello._y=this.atq5._y } if(Key.isDown(54)&&_root.ataque6==true) { _root.numataque = 6; this.destello._x=this.atq6._x this.destello._y=this.atq6._y } } //Enemigos// function enemigo() { this.barradevida.gotoAndStop(Math.round((this.vida*100)/this.vidamax)); if (this.vida <= 0&& this.vida ne "muerto"){ this.vida = "muerto" this.gotoAndPlay("muerto"); _root.experiencia=_root.experiencia+this.experiencia } var status:Boolean=orion.cuerpo.hitTest(this) var impacto:Boolean=orion.daño.hitTest(this) if (this.desplazamiento >= this.desplazamientomax&&this.direccion eq "derecha"&&this.vida > 0){ this.desplazamiento=0; this.direccion="izquierda"; } else if (this.desplazamiento >= this.desplazamientomax&&this.direccion eq "izquierda"&&this.vida > 0){ this.desplazamiento=0; this.direccion="derecha"; } if (status==false&&this.direccion eq "derecha"&&this.vida > 0&&this.ocupado==false){ this._x=this._x+1 this._xscale=100 this.desplazamiento=this.desplazamiento+1 this.gotoAndStop("andar"); } else if (status==false&&this.direccion eq "izquierda"&&this.vida > 0&&this.ocupado==false){ this._x=this._x-1 this._xscale=-100 this.desplazamiento=this.desplazamiento+1 this.gotoAndStop("andar"); } else if (status==true&&this.vida > 0&&_root.muerto==false&&this.ocupado==false){ this.gotoAndPlay("atacar"); } if (impacto==true&&this.vida > 0){ this.gotoAndPlay("herido") if (_root.fuerza > this.defensa){ this.vida=this.vida-((_root.fuerza+_root.espada)-this.defensa) _root.boom._x=this._x _root.boom._y=this._y _root.boom.daño=(_root.fuerza-this.defensa)+_root.espada _root.boom.play(); } else if (_root.fuerza <= this.defensa){ _root.boom._x=this._x _root.boom._y=this._y _root.boom.daño=1 _root.boom.play(); } } } //Morirse// function die() { gotoAndStop("gameover",1); } //Monedas// function moneda() { if (this.recogida==false&&orion.cuerpo.hitTest(this)){ this.gotoAndPlay("tomada"); _root.monedas=_root.monedas+1 } } //Ejecutar en Orion// onEnterFrame = manejarPersonaje; inicializarPersonaje(orion); orion.onEnterFrame = aplicarMovimiento; menu.onEnterFrame = menudedatos; coin1.onEnterFrame = moneda; coin2.onEnterFrame = moneda; coin3.onEnterFrame = moneda; enemigo4.onEnterFrame = enemigo; enemigo1.onEnterFrame = enemigo; enemigo2.onEnterFrame = enemigo; enemigo3.onEnterFrame = enemigo;