Page 1 of 1

Cloning

PostPosted: Thu May 28, 2009 12:31 am
by He360
I'm having trouble individualizing my clones. In the game when one clone dies, all of them die. Thus, I was wondering how do I fix this problem?

Thanks,
HE

Re: Cloning

PostPosted: Thu May 28, 2009 12:59 am
by skydereign
Well you know that clones are done by cloneindex, so you can use this to get the actual Actor*. This is a pointer to the clone itself, there are several functions to get the right actor, this is the one I use.
Code: Select all
Actor *
getCloneIdx (const char *cname, int cindex)    //g_GetCloneByIndex, its original name
{
    char buffer[50];

    sprintf(buffer,"%s.%i",cname,cindex);

    return(getclone(buffer));
}

DestroyActor, instead of the actor name, can take an Actor*, so you would just plug in the actors name and index. If this is not what you wanted, or doesn't make sense, I can give an example.

Re: Cloning

PostPosted: Thu May 28, 2009 1:07 am
by Caaz Games
lol couldn't on the clone actor,
just on collision destroy event actor?

Re: Cloning

PostPosted: Thu May 28, 2009 1:09 am
by skydereign
Yeah, but if you have a lot of clones, and they are all waiting for this collision, also He360 did not specify how they are being destroyed.

Re: Cloning

PostPosted: Thu May 28, 2009 2:18 am
by He360
skydereign wrote:Yeah, but if you have a lot of clones, and they are all waiting for this collision, also He360 did not specify how they are being destroyed.



Part of the game involves the enemies being destroyed with a punch. But I cloned a lot of the same enemies (kind of like the Teenage Mutant Ninja Turtles game on PS2 with their enemies.

Also, I have a sort of space shooter level in which I'm trying to destroy the same looking enemies (clones) with a bullet.

A side note is, I admit I'm not good at programming (I will study it MUCH more after finishing my Master's). Thus, what is the best way to make individualized destroyable clones without much knowledge of programming and without them all dying after one of them is shot.

Thanks again,
HE

Re: Cloning

PostPosted: Thu May 28, 2009 2:59 am
by BlarghNRawr
instead of destroying the actor on a collision, destroy collide actor or event actor
that way only the 1 clone will be destroyed

(also if you want do destry one clone explicitly you can click the little [+] sign next to the actor and choose the clone you want)