char array for change animation?

Non-platform specific questions.

char array for change animation?

Postby phyzix5761 » Wed Apr 25, 2012 4:03 am

Trying to make an array that stores animation names. Then I want to be able to randomly select an index from the array and put that string as the animation of the change animation parameter. How do I pass the randomly selected index? Do I need to use strcpy? If so, how?

Thanks.
phyzix5761
 
Posts: 261
Joined: Sun Feb 27, 2011 4:28 am
Score: 18 Give a positive score

Re: char array for change animation?

Postby skydereign » Wed Apr 25, 2012 4:20 am

You mean something like this?
Global Code
Code: Select all
char anim_names[3][30] = {"water",
                                     "dirt",
                                     "grass"};

Some event.
Code: Select all
ChangeAnimation("Event Actor", anim_names[floor(rand(3)], FORWARD);
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: char array for change animation?

Postby Hblade » Wed Apr 25, 2012 4:46 am

Thats Engenius. I'm going to use this one day maybe.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: char array for change animation?

Postby phyzix5761 » Wed Apr 25, 2012 7:51 am

Thank you.
phyzix5761
 
Posts: 261
Joined: Sun Feb 27, 2011 4:28 am
Score: 18 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest