He he he another Clone question

Non-platform specific questions.

He he he another Clone question

Postby amanuob » Thu Feb 04, 2010 1:48 pm

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???
Questions are necessary for the development of our own knowing, without questions How would we know??? and lesser would be my posts or none...therefore I know little or none.
User avatar
amanuob
 
Posts: 33
Joined: Sat Aug 29, 2009 11:47 am
Location: In Earth
Score: 1 Give a positive score

Re: He he he another Clone question

Postby Superbeni » Thu Feb 04, 2010 1:54 pm

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.
User avatar
Superbeni
 
Posts: 130
Joined: Sun Aug 02, 2009 1:23 pm
Location: Vienna, Austria
Score: 31 Give a positive score

Re: He he he another Clone question

Postby amanuob » Thu Feb 04, 2010 10:58 pm

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.
Questions are necessary for the development of our own knowing, without questions How would we know??? and lesser would be my posts or none...therefore I know little or none.
User avatar
amanuob
 
Posts: 33
Joined: Sat Aug 29, 2009 11:47 am
Location: In Earth
Score: 1 Give a positive score

Re: He he he another Clone question

Postby Bee-Ant » Fri Feb 05, 2010 1:02 am

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
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: He he he another Clone question

Postby skydereign » Fri Feb 05, 2010 1:05 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: He he he another Clone question

Postby Bee-Ant » Fri Feb 05, 2010 1:36 am

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
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: He he he another Clone question

Postby amanuob » Fri Feb 05, 2010 11:13 am

tanx it worked great XD..
Questions are necessary for the development of our own knowing, without questions How would we know??? and lesser would be my posts or none...therefore I know little or none.
User avatar
amanuob
 
Posts: 33
Joined: Sat Aug 29, 2009 11:47 am
Location: In Earth
Score: 1 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest