Here's what the GE Script Reference says about getclone().
http://game-editor.com/docs/script_refe ... m#getcloneGE Script Reference wrote:getclone: Get Actor with name cloneName.
Actor *getclone(char *cloneName)
cloneName: nameactor.cloneindex
(Example: ship.1, ship.2, ...)
Return Actor if successful, invalid Actor (with cloneindex = -1 and name = "") on error.
So, it is a function that returns an Actor pointer (Actor *) to the given actor.
Here's an example code that makes all the clones of the actor "myActor" red by setting their g (=green) and b (=blue) attributes to 0. For this code to work, there has to be a global integer variable called "highestCloneindex" that contains the cloneindex of the newest clone of "myActor" i.e. the clone that has the highest cloneindex.
- Code: Select all
int i; // Iterator variable
char tempName[50]; // Temporary string for the name of the clone to be handled
Actor *actorPointer = NULL; // Pointer to the clone to be handled
for (i = 0; i <= highestCloneindex; i ++) // Iterate through all the clones of the actor
{
sprintf(tempName, "myActor.%i", i); // Build the clonename for the clone of cloneindex i
// Example: if i is 3, tempName will be: "myActor.3"
actorPointer = getclone(tempName); // Get a pointer to the clone
actorPointer->g = 0; // Set the green value of the clone to 0 via the pointer
actorPointer->b = 0; // Set the blue value of the clone to 0 via the pointer
}
You can use a similar code to add lights to the positions of the clones.
ZeldaFan wrote:SetLight is used by the canvas, not by the actor. Even so, will it work?
Yes, what I meant is that in the code of the canvas actor, you call the function for drawing lights to the positions of the clones. As SetLight() is a drawing function it can only be used on a canvas actor.