1
I am following a tutorial to create an infinite racing game (Temple Run style), the tutorial is old and the classes etc changed in Unity 5, so I could not play the code, it is made to control and execute the animations of the character.. If the Start key has been pressed it starts the animation of walking, but the jumping one is not possible because I would have to use Wrapmode to prioritize it, but this is not working.. So by logic I tried like this (tried in other ways, but the game hangs, as in this way).
#pragma strict
var anim : Animator;
function Start () {
anim = GetComponent.<Animator>();
}
function Update () {
/* if(Controle.Start == false){
anim.SetBool ("ande", false) ;
}*/
if(Controle.Start == true){
anim.SetBool ("ande", true); // Verifica se deu start e inicia a anim de andar
}
/*if(Controle.cair == true){
anim.SetBool ("morra", true); // essa era a de morrer mas está com o mesmo problema
}*/
Teste();
}
/* Tentei arrumar criando essa função que enquanto o espaço tiver pressionado ele desativa
o start e logo após ele executa a animação de pulo, mas não deu, tentei outros jeitos usando
while mas sem sucesso */
function Teste(){
if(Input.GetKey("space")){
while(Input.GetKey("space")){
Controle.Start = false;
}
anim.SetBool ("pule", true);
}
}
How do I fix this? I tried everything, Wrapmode would be with Getcomponent, but the animations didn’t work with Animation.
Usually you say what the mistake is and we try to help you solve it. rs* But why go all the way around to make a Runner? You only need to capture the pressed key and fire a trigger on the animmature, it takes care of the rest.
– Nils