Page 1 of 1

He he he another Clone question

PostPosted: Thu Feb 04, 2010 1:48 pm
by amanuob
I understand that you can change an Actors X position or its variable from another Actor by doing this=>

Actors.x=x+1;
or
Actors.variable=variable-1;

so

how do I do it in a clone???
clone.1
???=>
clone.1.x=x+1;
I tried this and it didn't work so what do I have to do to make it work???

Re: He he he another Clone question

PostPosted: Thu Feb 04, 2010 1:54 pm
by Superbeni
The clones have special names: actor.1, actor.2,...
Code: Select all
actor.1.x = x + 1;

This should work, but it didnĀ“t test it.

Re: He he he another Clone question

PostPosted: Thu Feb 04, 2010 10:58 pm
by amanuob
Ive tried that and the name of my character is clone
but it didn't work.

clone.1.x = x + 1;

so what do I do XD.
help please...T,T
tanx in advance.

Re: He he he another Clone question

PostPosted: Fri Feb 05, 2010 1:02 am
by Bee-Ant
So, you want to control some actor through other actor???

1. This is to control 1 of hundreds cloned actor
-) make 2 integer global variables "PosX" and "PosY"
-) Controlled Actor -> Draw Actor
Code: Select all
if(cloneindex==3) //or which cloneindex do you want
{
    x=PosX;
    y=PosY;
}

-) Controller Actor -> Keydown
Code: Select all
PosX+=3;
//or
PosY+=3;
//or any moving code do you want


2. This is to control any cloned actor
-) make 2 integer global arrays "PosX[99]" and "PosY[99]" -> change 99 to the total clones do you have
-) Controlled Actor -> Draw Actor
Code: Select all
x=PosX[cloneindex];
y=PosY[cloneindex];

-) Controller Actor -> Keydown
Code: Select all
PosX[3]+=5;
//or
PosY[3]-=5;
//or any moving code do you want
//change 3 to the cloneindex you want to move

Re: He he he another Clone question

PostPosted: Fri Feb 05, 2010 1:05 am
by skydereign
If you want to grab information about a clone, than you will need to use its Actor*. To do this I suggest using this function, you need to place it into Global Code.

Code: Select all
Actor *
getCloneIdx (const char *cname, int cindex)
{
    char buffer[50];
    sprintf(buffer,"%s.%i",cname,cindex);
    return(getclone(buffer));
}


An example of how to use it in script.
Code: Select all
Actor * cloneactor = getCloneIdx("desiredActor", 5);
cloneactor->x+=10;


This will get desiredActor.5, and using the syntax below the getCloneIdx will allow you to manipulate the desired variables. Remember that you need to use -> instead of . or it won't work.

Re: He he he another Clone question

PostPosted: Fri Feb 05, 2010 1:36 am
by Bee-Ant
skydereign wrote:If you want to grab information about a clone, than you will need to use its Actor*. To do this I suggest using this function, you need to place it into Global Code.

Code: Select all
Actor *
getCloneIdx (const char *cname, int cindex)
{
    char buffer[50];
    sprintf(buffer,"%s.%i",cname,cindex);
    return(getclone(buffer));
}


An example of how to use it in script.
Code: Select all
Actor * cloneactor = getCloneIdx("desiredActor", 5);
cloneactor->x+=10;


This will get desiredActor.5, and using the syntax below the getCloneIdx will allow you to manipulate the desired variables. Remember that you need to use -> instead of . or it won't work.

Nicely done L :D

Re: He he he another Clone question

PostPosted: Fri Feb 05, 2010 11:13 am
by amanuob
tanx it worked great XD..