In order to detect properties of specific clones. a variety of lists and local variables need to be used. Local variables are duplicated with a clone's properties, but a sprite cannot detect an individual clone's local variable's value. However, a clone can detect a sprite, which can therefore send a message to trigger the sprite's scripts. In order for a sprite to detect the properties of a clone, the clone must use lists in order to "communicate" with the sprite.
Sensing When Touching a Clone
To make a sprite detect when it is touching a specified clone of a specified sprite, the clone must sense instead when it is touching the sprite. Then, it adds a "true" to the item number corresponding to the clone in a list of true/false touching clones. For the following scripts, assume the following:
— a global variable used to count how many clones have been created.
— a local variable duplicated with the clone that represents what clone number in chronological order of creation it is. (ex. Clone 5)
(touching?) // category=list
— a list used to store the true/false statements for each clone if its touching the specified sprite.
— the sprite which creates the clones
— the sprite that will sense when touching one of sprite1's clones These following scripts would go in sprite1
when gf clicked //when the flag is clicked delete [all v] of [touching? v] set [clones v] to (0) //set the current amount of clones to 0 add  to [touching? v] //adds a new item to the list, representing the upcoming clone's "touching sprite2" statement change [clones v] by (1) //right before cloning, change the amount of clones by one create clone of [myself v] //clone when I start as a clone set [clone id v] to (clones) //this sets the clone's number to the amount of clones there are, since it is the most recent to be created forever if <touching [sprite2 v]?> then //this senses if the clone is touching sprite2 replace item (clone id) of [touching? v] with [true] //then, in the item number of "touching?" of the clone's number, "true" is inserted to show it is being touched wait until <not <touching [sprite2 v]?>> //the clone waits until it is not touching sprite2 anymore replace item (clone id) of [touching? v] with [false] //turns the statement to false
Then, the following script would be inserted into sprite2, which will detect when touching the specified clone:
when gf clicked forever move (3) steps turn right (3) degrees //just for example if <(item (4) of [touching? v]) = [true]> then //if item 4 of the list is "true", that means clone 4 is touching sprite2, and vice-versa say [Hi there, clone 4!] for (2) secs
There are too many boolean reporter sensing arguments to have each one stated. Whether one is sensing a clone's costume, local variable, or x and y coordinates, the method above can be used with some minor tweaks. For example, to sense a clone's costume, instead of the clone checking if it is touching sprite 2 and then adding "true" to a list, a different list can be used called "costumes" in which each clone perpetually stores its costume#, allowing for, in the scenario above, sprite 2 to check the costume# of an individual, particular clone. In alternative to the clone's script above, this can be used for costume detection:
when I start as a clone set [clone id v] to (clones) forever replace item (clone id) of [costumes v] with (costume#)
Therefore, sprite2's script would have to be modified as the following:
when gf clicked forever if <(item (4 v) of [costumes v]) = > then //meaning if clone 4's costume# is 2 say [Clone 4 is in costume 2] //for example
|Note:||Many of the parameters used in the scripts above are just for example, and can be modified to serve a particular script.|