Discuss Scratch

Zuhair12345
Scratcher
100+ posts

How to access data from a clone using another sprite?

Let's say there are 2 sprites. 1 sprite makes many clones of itself with different costumes.
The other will get the costume name and then say it once it touches the sprite

How do you do that?
No visual cues allowed, so no “when touching color” blocks
brun7
Scratcher
100+ posts

How to access data from a clone using another sprite?

I think the best way to do this would be to detect the collision on the clone's side. For example, if a clone is touching that sprite, and it currently has a specific costume, it will send a broadcast that will be received by the other sprite.

To expand this to multiple costumes, you can drop one of the “if” statement entirely and use a variable with “for all sprites” clicked instead. What this would look like in practice is basically this:

when I start as a clone
forever
if <touching [ Sprite2] ?> then
set [costume ] to (costume [name v])
broadcast [ Touching]
end
end

when I receive [ Touching]
say [(costume)]

I hope this helped, and please let me know if you have any follow-up questions.

Last edited by brun7 (May 5, 2026 16:27:21)

scrabl_bean
Scratcher
13 posts

How to access data from a clone using another sprite?

brun7 wrote:

I think the best way to do this would be to detect the collision on the clone's side. For example, if a clone is touching that sprite, and it currently has a specific costume, it will send a broadcast that will be received by the other sprite.

To expand this to multiple costumes, you can drop one of the “if” statement entirely and use a variable with “for all sprites” clicked instead. What this would look like in practice is basically this:

when I start as a clone
forever
if <touching [ Sprite2] ?> then
set [costume ] to (costume [name v])
broadcast [ Touching]
end
end

when I receive [ Touching]
say [(costume)]

I hope this helped, and please let me know if you have any follow-up questions.
Its better to make lists, since if two clones are touching, some data will be overriden
brun7
Scratcher
100+ posts

How to access data from a clone using another sprite?

scrabl_bean wrote:

brun7 wrote:

-snip-
Its better to make lists, since if two clones are touching, some data will be overriden
That may be true, though in this particular case, I don't think the clones are detecting each other.

Powered by DjangoBB