Simply ask for a variable from A, like so: (create an actor variable called 'alive')
A>CreateActor>
- Code: Select all
alive=1;
B>Draw Actor>
- Code: Select all
animpos=creator.animpos; //give them the same animpos
x=creator.x+100;
y=creator.y;
if(creator.alive==1){ //check only that A is alive
}
else{DestroyActor("Event Actor"); //a dead A cannot return an alive of 1, therefore B dies.
}
See if that works for you. If you need to use animation changes, you can get creator.animindex to see which animation A is on.
As far as the problem with dragging, i don't know what's causing that. In my test, b followed a perfectly, both using creator.x and this->x methods.
I assume you are using A>mousebuttondown>drag:enable> ? And also, A is no longer a parent of B, this method makes the parenting obsolete.
If you want to get more information from the creator actor, you can use *Actor.
Its a bit more complicated, and probably slower, but so it goes. Note that B can get any attribute of A this way; and also can modify A if it needs to. *Actor is a complete I/O method between the two actors, always using this->variable instead of this.variable.
1st, create 2 actor int variables, pid and alive.
B>CreateActor>
- Code: Select all
pid=creator.cloneindex;
A>CreateActor>
- Code: Select all
alive=1;
Then use the getclone2 script
B>Draw Actor>
- Code: Select all
Actor *this=getclone2("A", pid); //stores its creator "A" as "this"
x=this->x+100;
y=this->y;
if(this->alive==1){} //check only that A is alive
else{
DestroyActor("Event Actor"); //a non-existent a will return an alive of 0
}
Notice how in B's draw actor i used an if/else. A must exist in order to return a successful "alive" to B; if A dies, this->alive cannot equal 1 therefor B dies.
Here's the getclone2, in case you don't already have it: (paste it into global script)
- Code: Select all
Actor *getclone2 ( char *actorName, long cloneNumber )
{
char resultString[256] = "";
char cloneNumberAsString[10];
Actor *resultActor;
strcpy ( resultString, actorName );
strncat ( resultString, ".", 1 );
sprintf (cloneNumberAsString, "%i", cloneNumber);
strncat ( resultString, cloneNumberAsString, 10 );
resultActor = getclone(resultString);
return resultActor;
}
Note too that you could run all of this script from actor A, but it requires an extra step as you have to find a way to get B's cloneindex and feed it into A, so it's probably simpler to do it from B.