Ver Mensaje Individual
  #4 (permalink)  
Antiguo 05/05/2006, 11:10
sietemonos
 
Fecha de Ingreso: abril-2005
Mensajes: 7
Antigüedad: 19 años
Puntos: 0
Hola :)

Estoy tratando de mover un personaje con el teclado, la idea es que después de cierto tiempo, el personaje deje de responder al teclado y ejecute una serie de acciones. Cada vez que ejecuta una acción, carga un clip diferente de la librería con un attachMovie.

El problema es que solo funciona hasta que llega hasta la condición "getTimer()>=5000"; se queda ejecutando la función y no avanza. Este es el código que llevo hasta ahora, está algo desordenado porque es sobre el que estoy trabajando:

Cita:
//CONTENEDORES
this.createEmptyMovieClip("diana",0);
this.createEmptyMovieClip("diana2",1);
this.diana.attachMovie("caminar","Dan","0");
with(diana){
_x=19.2;
_y=232.2;
}
this.diana.Dan.stop();
diana2.attachMovie("window","ventana","1");
diana2._visible=false;

//NOTIFICADORES DE COMANDOS DEL TECLADO
teclado = new Object();
teclado2 = new Object();
trace ("tiempo inicial: "+getTimer());
//acciones al pulsar y soltar teclas
//this.onEnterFrame = function () {
diana.onEnterFrame = function () {
trace("funcion diana: "+getTimer());
teclado2.onKeyDown= function () {
onEnterFrame = moverDan;
}
teclado.onKeyUp = function () {
onEnterFrame = detenerDan;
}
if (getTimer()<=5000) {
trace("escucha el teclado");
Key.addListener(teclado);
Key.addListener(teclado2);
} else if (getTimer()>=5000) {
anochecer(); trace("funcion anochecer en diana :"+getTimer());
} if (getTimer()>=8000) {
trace("función hambre: "+getTimer()+" , debería dejar de responder al teclado");
hambre();
Key.removeListener(teclado2);
Key.removeListener(teclado);

} else if (getTimer()>=12000){
observar();
} else if (getTimer()>=30000){
morir();
}
}
¿Alguna idea?