Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make code for colliding clones?
- -starlit_puma-
-
31 posts
How to make code for colliding clones?
Hello!
I'm looking for a code for clones of the same sprite that are touching each other but can also move around (like if they were marbles in a jar). See this game on Poki to know what I'm talking about.
https://poki.com/en/g/cats-drop
Disclaimer! This is an external link, meaning you'll leave Scratch.
If anyone knows some code for this, that would be great. I'm making a similar game to the one above. I will make sure to give credit in the game description : )
I'm looking for a code for clones of the same sprite that are touching each other but can also move around (like if they were marbles in a jar). See this game on Poki to know what I'm talking about.
https://poki.com/en/g/cats-drop
Disclaimer! This is an external link, meaning you'll leave Scratch.
If anyone knows some code for this, that would be great. I'm making a similar game to the one above. I will make sure to give credit in the game description : )
Last edited by -starlit_puma- (Today 01:37:27)
- NMario84
-
1000+ posts
How to make code for colliding clones?
Can't you just use the touching sprite block for this?
<touching [ v] ?>
- -starlit_puma-
-
31 posts
How to make code for colliding clones?
I tried that, however, I'm using clones for my project and I can't get it to work, ie..
when I start as a clonebut since it in and of itself is a clone and what it's touching is a clone, this code ⬆ would only work if the clone was touching the sprite itself rather than another clone, if that makes sense.
forever
if <(costume [number v]) = (1)> then
if <touching <(costume [number v]) = [1]>> then
etc...
end
end
end
- hi_bobux725
-
100+ posts
How to make code for colliding clones?
if a boolean is true, the value is 1 so if the costume number is 1 then the if statement will be I tried that, however, I'm using clones for my project and I can't get it to work, ie..when I start as a clonebut since it in and of itself is a clone and what it's touching is a clone, this code ⬆ would only work if the clone was touching the sprite itself rather than another clone, if that makes sense.
forever
if <(costume [number v]) = (1)> then
if <touching <(costume [number v]) = [1]>> then
etc...
end
end
end
if <touching (1 v)> thenhope this helped
end
- -starlit_puma-
-
31 posts
How to make code for colliding clones?
thank you! I'll try itif <touching ( 1 v)> then
end
Last edited by -starlit_puma- (Today 03:59:51)
- Discussion Forums
- » Help with Scripts
-
» How to make code for colliding clones?