Discuss Scratch

bluedragonsarecool
Scratcher
28 posts

How to get clones to touch eachother?

Hey! I know clones with different sprites can use the
<touching [ v] ?>
block. But what about clones that are part of the same sprite? I'm making a physics engine and need to know how to do this. Thanks!

Last edited by bluedragonsarecool (Aug. 4, 2024 12:11:36)

lion334
Scratcher
100+ posts

How to get clones to touch eachother?

Hi

As far as I know, Clones can detect touching perfectly fine, both for Clone to Sprite aswell as Clone to Clone.

Keep in mind that
([SomeVariable v] of [Sprite1 v])
will still call the MainSprite (if the Variable is for Sprite only). I found out that this can be confusing.


Kind regards
bluedragonsarecool
Scratcher
28 posts

How to get clones to touch eachother?

Yeah, I guess what I could do is come up with a radius for the clone, and track the x and y in a list… and then just see if the distance is greater than the radius*2, to account for the other radius… Well, I'm just rubber ducking!
Jlerpy
Scratcher
1000+ posts

How to get clones to touch eachother?

The trick is that the sprite they're a clone of won't appear in the list of available sprites, BUT you can go to a DIFFERENT sprite, find the sprite you want in ITS touching list, then copy that across to the first sprite and it will retain it.
bunnyCoder16
Scratcher
500+ posts

How to get clones to touch eachother?

Does this work?
https://scratch.mit.edu/projects/1052791440/
I got a little carried away…… But I hope it helps!
bluedragonsarecool
Scratcher
28 posts

How to get clones to touch eachother?

Jlerpy said: Jlerpy said: Jlerpy said: Jlerpy said: Jlerpy said: Jlerpy said: Jlerpy said: Jlerpy said: Jlerpy said: The trick is that the sprite they're a clone of won't appear in the list of available sprites, BUT you can go to a DIFFERENT sprite, find the sprite you want in ITS touching list, then copy that across to the first sprite and it will retain it.
OH. I can't believe I didn't try to break the laws of the universe like that! Thanks!
Jlerpy
Scratcher
1000+ posts

How to get clones to touch eachother?

It's a neat little trick. Happy to help.

Powered by DjangoBB