change animation question

Posted:
Wed Dec 26, 2007 2:01 pm
by otro
hello !
i'd like to know how i can change animations by clicking on one button?
i tried to do this by 'key down' 'change animation' but it only changes one animation and i'd like to make it change each time a new animation (like 3 or 4 four animations and get a loop after this) !
if someone could help me !
thanx !
Re: change animation question

Posted:
Wed Dec 26, 2007 2:09 pm
by j2graves
do you mean change to a random animation?
Re: change animation question

Posted:
Wed Dec 26, 2007 2:29 pm
by otro
yep exactly changing to a random animation ! i tried to seek in the tutorials of GE about this 'change animation' option but didnt found anything =/
Re: change animation question

Posted:
Wed Dec 26, 2007 3:26 pm
by speckford123
i didnt memorize code so this is probably wrong but try something like this,
create a variable like randanim, and on your key down event try this
randanim=rand(5); // the number in rand needs to be how many animtions you have, including 0.
if(randanim==0)changeanimation("actor","animation 0",FORWARD); // the changeanimation is wrong (I think) you need to fix that
else if(randanim==1)changeanimation("actor","animation 1",FORWARD);
else if(randanim==2)changeanimation("actor","animation 2",FORWARD);
else if(randanim==3)changeanimation("actor","animation 3",FORWARD);
else if(randanim==4)changeanimation("actor","animation 4",FORWARD);
else if(randanim==5)changeanimation("actor","animation 5",FORWARD);
something like that
Re: change animation question

Posted:
Wed Dec 26, 2007 5:18 pm
by otro
i'm sorry i really get stuck on this script and i am new to these variables functions =/ !
Speckford123: i just need to add the script in scripteditor after 'add event' 'keydown' ?
Re: change animation question

Posted:
Wed Dec 26, 2007 5:34 pm
by Kalladdolf
ok, you made 2 mistakes:
1st: you forgot to actually create the variable randanim.
2nd: you forgot those { } brackets and that messed the whole thing up.
now this might work better:
Re: change animation question

Posted:
Wed Dec 26, 2007 6:40 pm
by otro
Thanks for the help !!!! that's very cool from you ==Kalladdolf== =)
I should really get on these variable functions.... that's the main thing to create an original program it seems =)