Discuss Scratch
- Discussion Forums
- » Questions about Scratch
- » Is there any way to do same-frame or sub-frame detection of clones?
- redspacecat
-
Scratcher
1000+ posts
Is there any way to do same-frame or sub-frame detection of clones?
This is more of a question about the capabilities of the Scratch language, so I'm not sure if it should go here or in HwS.
I'm trying to detect, from a clone of a sprite, if that clone is touching a specific different clone of that sprite.
Basically, something similar to what's demoed here except it works in one frame.
Right now the best I know how to do is getting a response on the next frame, which isn't ideal.
I'm trying to detect, from a clone of a sprite, if that clone is touching a specific different clone of that sprite.
Basically, something similar to what's demoed here except it works in one frame.
Right now the best I know how to do is getting a response on the next frame, which isn't ideal.
- yesers12345
-
Scratcher
64 posts
Is there any way to do same-frame or sub-frame detection of clones?
maybe try a run without screen refresh block or sending a broadcast to detect it?
- redspacecat
-
Scratcher
1000+ posts
Is there any way to do same-frame or sub-frame detection of clones?
maybe try a run without screen refresh block or sending a broadcast to detect it?Could you give specifics on how that would work? I'm not sure of what you mean.
- redspacecat
-
Scratcher
1000+ posts
Is there any way to do same-frame or sub-frame detection of clones?
bump
- awesome-llama
-
Scratcher
1000+ posts
Is there any way to do same-frame or sub-frame detection of clones?
I'm not aware of any practical methods. I don't think any of the hats allow for running multiple times per frame, which would be needed to precisely communicate between clones. Custom blocks are not useful here.
It is possible to control individual clones with separate broadcast messages, but you probably don't want to do this:
I think scripts that run in all clones are done in the order of their layers, which you could find some use for, but again, likely not practical.
Of course, there are also lists if you want to loop over data and check it that way (without touching blocks), but then the clones are unnecessary complexity and can be avoided entirely.
It is possible to control individual clones with separate broadcast messages, but you probably don't want to do this:
broadcast [update clone 1 v]
broadcast [update clone 2 v]
broadcast [update clone 3 v]
broadcast [update clone 4 v]
broadcast [update clone 5 v]
...
broadcast [update clone 300 v]
I think scripts that run in all clones are done in the order of their layers, which you could find some use for, but again, likely not practical.
Of course, there are also lists if you want to loop over data and check it that way (without touching blocks), but then the clones are unnecessary complexity and can be avoided entirely.
Last edited by awesome-llama (Oct. 7, 2026 06:12:59)
- colinmacc
-
Scratcher
1000+ posts
Is there any way to do same-frame or sub-frame detection of clones?
This is more of a question about the capabilities of the Scratch language, so I'm not sure if it should go here or in HwS.
I'm trying to detect, from a clone of a sprite, if that clone is touching a specific different clone of that sprite.
Basically, something similar to what's demoed here except it works in one frame.
Right now the best I know how to do is getting a response on the next frame, which isn't ideal.
The way I've done this before, is with broadcasts.
1. Send a broadcast to hide all the clones you don't care about
2. Send a broadcast to check if your clone is touching another clone
3. Send a broadcast to show all the clones again.
Because hidden clones return false to the touching sensor block, if the result at step 2 is TRUE, then you know it must be touching the clone you care about.
Make sure you use “broadcast”, and not “broadcast and wait”.
Broadcast blocks get added to the end of the current stack, and will all process in the same frame.
(If you want to see this in action, check out my “Rock Paper Scissors” project)
Last edited by colinmacc (Oct. 7, 2026 11:39:46)
- nembence
-
Scratcher
1000+ posts
Is there any way to do same-frame or sub-frame detection of clones?
It's possible to make the clones receive the same broadcast multiple times by replacing them with new clones.
Then you can do
Then you can do
set [selected clone v] to [<ID for the clone to check>]
broadcast (hide all except selected v)
broadcast (check if touching v)
broadcast (reclone v)
broadcast (do something with the results v)
when I receive [reclone v]
create clone of (myself v)
delete this clone
- redspacecat
-
Scratcher
1000+ posts
Is there any way to do same-frame or sub-frame detection of clones?
Thanks for all the info, I'll test it out when I have time 

- Discussion Forums
- » Questions about Scratch
-
» Is there any way to do same-frame or sub-frame detection of clones?