Page 1 of 1

About clones

PostPosted: Sun Dec 27, 2009 7:56 pm
by Leif
Need help ((
here is my file. I'm trying to do the hext:
1. Each of red elements has it's own ID (from 1 to 4). Pressing button (arrow) must increase ID of all the elements by 1, but it increases only the first by 5. Why? how to correct?
2. Words to the left - animation names of elements. They are added to array when elements were created and displayed after that. How to add to array full names of elements instead of anim.names? To use them after ?

Help me please

Re: About clones

PostPosted: Sun Dec 27, 2009 8:18 pm
by DST
You forgot the data folder.

Re: About clones

PostPosted: Sun Dec 27, 2009 10:28 pm
by Leif
Sorry :)
See below

Re: About clones

PostPosted: Sun Dec 27, 2009 10:53 pm
by skydereign
Well, fixed the first problem. The problem was that you were getting the clone "SQUARE.i", instead of the actor with a cloneindex of i, which is what you want. To do what you wanted you would need something like what I put in, which actually puts the .i to the end of the string, but uses the actual number. To do this I put a function into global code. Not really sure what you mean by the second. What are the full names, and do you mean saving the names when you say to use them after?

Re: About clones

PostPosted: Mon Dec 28, 2009 6:15 am
by Leif
Thanks ))
Full name - I mean "name+cloneindex". I Intend to put of them into array (some elements) and if needed take actors by the name from array.

Re: About clones

PostPosted: Mon Dec 28, 2009 6:48 am
by skydereign
Code: Select all
char*
getFullName (const char *cname, int cindex)
{
    char* buffer = calloc(50,1);
    sprintf(buffer,"%s.%i",cname,cindex);
    return(buffer);
}


You can use this to get the full name to put into the array.

Re: About clones

PostPosted: Mon Dec 28, 2009 7:25 am
by Leif
:D super )))

Thanks a lot ))

My C programming leaves much to be desired...