- Home /
How can I play an queued animation based on sprites?
Hello,
Well, here's the thing. I'm making a 2D game. So, I have a prefab and starts with an animation ("aparecer") That's Ok, then after some seconds (that I made with "yield WaitForSeconds"), I trigger the second animation ("parpadear")... That's Ok too (because these two animations doesn't change the sprite, these animations are just some scale changes). But the third one is an explosion and I made a sprite animation called "explotar". (frame per frame it's a different sprite). So, when I try to trigger the third animation... I have to mark it as legacy. That's not a trouble, so I mark that animation as legacy. When I do it, The animation doesn't happen.
I don't know how to proceed now :(... Please, any help would be appreciated.
Here's the code, Thank you so much in advance to all of you.
Regards,
function animacion(){
animation["aparecer"].speed = 1;
// TIEMPO DE ESPERA, DESPUES DE APARECER EL TIEMPO QUE TIENE PARA PRESIONAR
yield WaitForSeconds (2);
//INICIO ANIMACION DE ALERTA, PARPADEO DE QUE EL TIEMPO SE ACABA
parpadearQueued = animation.PlayQueued("parpadear", QueueMode.PlayNow);
//LA PONGO EN LOOP INFINITO
animation.wrapMode = WrapMode.Loop;
// FIJO LA VELOCIDAD DEL PARPADEO, TOMANDO PARPADEARQUEUED QUE ES EL RETORNADO
parpadearQueued.speed = 1;
// ESTABLEZCO TIEMPO DE LA ALERTA
yield WaitForSeconds (5);
//ANIMO LA EXPLOSION
explotarQueued = animation.PlayQueued("explotar", QueueMode.PlayNow);
animation.wrapMode = WrapMode.Once;
yield WaitForSeconds(1);
//DESTRUYO EL ELEMENTO
Destroy(gameObject);
Destroy(this);
}
Are you sure you didn't name the function wrong? The function itself reads 'animacion' meaning that if you access it like 'animation();' it wouldn't come up with anything. Double check there is no spelling error in the function name, and that you are actually initiating this function.
Your answer
Follow this Question
Related Questions
How do I animate a 2D sprite? 1 Answer
Animation with Transparency Floats Above Ground 1 Answer
Run sprite animation in editor mode? 0 Answers
Animator dialog doesn't pop up when sprites are dragged 0 Answers
Animated GUI sprite not animating. 0 Answers