change animation question

Game Editor comments and discussion.

change animation question

Postby otro » Wed Dec 26, 2007 2:01 pm

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 !
otro
 
Posts: 5
Joined: Mon Dec 25, 2006 8:54 am
Score: 0 Give a positive score

Re: change animation question

Postby j2graves » Wed Dec 26, 2007 2:09 pm

do you mean change to a random animation?
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: change animation question

Postby otro » Wed Dec 26, 2007 2:29 pm

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 =/
otro
 
Posts: 5
Joined: Mon Dec 25, 2006 8:54 am
Score: 0 Give a positive score

Re: change animation question

Postby speckford123 » Wed Dec 26, 2007 3:26 pm

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
speckford123
 
Posts: 334
Joined: Fri May 05, 2006 6:33 pm
Score: 49 Give a positive score

Re: change animation question

Postby otro » Wed Dec 26, 2007 5:18 pm

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' ?
Attachments
randomanim.zip
(10.37 KiB) Downloaded 74 times
otro
 
Posts: 5
Joined: Mon Dec 25, 2006 8:54 am
Score: 0 Give a positive score

Re: change animation question

Postby Kalladdolf » Wed Dec 26, 2007 5:34 pm

:D

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:
randanim.zip
(11.61 KiB) Downloaded 80 times
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: change animation question

Postby otro » Wed Dec 26, 2007 6:40 pm

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 =)
otro
 
Posts: 5
Joined: Mon Dec 25, 2006 8:54 am
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron