Discuss Scratch

Daysquirrell3408
Scratcher
4 posts

how to make clones detect if they are touching with another clone of THEMSELVES

how do i detect if a clone is touching itself? i really need this information for my space themed game with a ship building and wiring system
NMario84
Scratcher
1000+ posts

how to make clones detect if they are touching with another clone of THEMSELVES

You can set variables to its own sprite (for this sprite only). Set the ID of the variable before the sprite is cloned. When you clone the sprites, they will have its own ID that you set the variable to.

During the check sequence, when the 2 sprites touch, assume to check the ID's of the clones.

You can save the ID's of the clones in a list if needed.
ZanePro123
Scratcher
35 posts

how to make clones detect if they are touching with another clone of THEMSELVES

Daysquirrell3408 wrote:

how do i detect if a clone is touching itself? i really need this information for my space themed game with a ship building and wiring system
If you're only trying to see whether a clone is touching another clone of the same sprite, then can do something like this:

if <touching (join [NAME OF THE CLONE(SPRITE NAME)] [])  ?> then
code
end

Basically scratch actually lets you detect touching anything if you manage to put the name of the sprite in it (even the same sprite itself), so by putting the join block in there with the clone's sprite name, it can detect other clones of the same sprite.
Just make you write the exact name of the sprite with the correct capitals , and don't put anything in the second box for the join block
qwertycodechamp90411
Scratcher
100+ posts

how to make clones detect if they are touching with another clone of THEMSELVES

If you want just the coordinates.
delete all of [list v]::list
broadcast [get coordinates v]

when I receive [get coordinates v]
add (x position) to [list v]
add (y position) to [list v]
deck26
Scratcher
1000+ posts

how to make clones detect if they are touching with another clone of THEMSELVES

ZanePro123 wrote:

Daysquirrell3408 wrote:

how do i detect if a clone is touching itself? i really need this information for my space themed game with a ship building and wiring system
If you're only trying to see whether a clone is touching another clone of the same sprite, then can do something like this:

if <touching (join [NAME OF THE CLONE(SPRITE NAME)] [])  ?> then
code
end

Basically scratch actually lets you detect touching anything if you manage to put the name of the sprite in it (even the same sprite itself), so by putting the join block in there with the clone's sprite name, it can detect other clones of the same sprite.
Just make you write the exact name of the sprite with the correct capitals , and don't put anything in the second box for the join block
You can also copy the touching sprite block from another sprite.

SpriteA does not appear in the drop down list for the touching block when working on spriteA but it will if working on spriteB. So in spriteB you create the block with spriteA selected in the drop down. You can then copy that to spriteA's coding area and use it there.
trailoft
Scratcher
16 posts

how to make clones detect if they are touching with another clone of THEMSELVES

Im so confused
Ronomix
Scratcher
1 post

how to make clones detect if they are touching with another clone of THEMSELVES

when green flag clicked
forever
if <(X) = (x position)> then
change [ v] by (1)
end
end



when green flag clicked
forever
if <(Y) = (y position)> then
change [ v] by (1)
end
end


when green flag clicked
forever
set [ Y] to (y position)
end






when green flag clicked
forever
set [ X] to (x position)
end
Daysquirrell3408
Scratcher
4 posts

how to make clones detect if they are touching with another clone of THEMSELVES

when I start as a clone
forever
if <> then
<touching [(join [clone name] [world]) v] ?>
end
end
LearnerYetCoder
Scratcher
10 posts

how to make clones detect if they are touching with another clone of THEMSELVES

when I start as a clone
forever
if <touching (join [sprite name here] []) ?> then // hide the original sprite to avoid non-clone collision
...
end

// I think this could work...?
FunkySausage
Scratcher
1 post

how to make clones detect if they are touching with another clone of THEMSELVES

ZanePro123 wrote:

Daysquirrell3408 wrote:

how do i detect if a clone is touching itself? i really need this information for my space themed game with a ship building and wiring system
If you're only trying to see whether a clone is touching another clone of the same sprite, then can do something like this:

if <touching (join [NAME OF THE CLONE(SPRITE NAME)] [])  ?> then
code
end

Basically scratch actually lets you detect touching anything if you manage to put the name of the sprite in it (even the same sprite itself), so by putting the join block in there with the clone's sprite name, it can detect other clones of the same sprite.
Just make you write the exact name of the sprite with the correct capitals , and don't put anything in the second box for the join block

YOU ARE A LEGEND YOU JUST SAVED MY GAME

bRuHbRuHmEmEmAn
Scratcher
500+ posts

how to make clones detect if they are touching with another clone of THEMSELVES

FunkySausage wrote:

ZanePro123 wrote:

Daysquirrell3408 wrote:

how do i detect if a clone is touching itself? i really need this information for my space themed game with a ship building and wiring system
If you're only trying to see whether a clone is touching another clone of the same sprite, then can do something like this:

if <touching (join [NAME OF THE CLONE(SPRITE NAME)] [])  ?> then
code
end

Basically scratch actually lets you detect touching anything if you manage to put the name of the sprite in it (even the same sprite itself), so by putting the join block in there with the clone's sprite name, it can detect other clones of the same sprite.
Just make you write the exact name of the sprite with the correct capitals , and don't put anything in the second box for the join block

YOU ARE A LEGEND YOU JUST SAVED MY GAME

It's nice that you're thanking them, but please don't necropost. It's considered spam.
LosingAccounts
Scratcher
21 posts

how to make clones detect if they are touching with another clone of THEMSELVES

when this sprite clicked
replace item (<touching [ v] ?> v) of [Clones detect v] with [something else]

Last edited by LosingAccounts (Dec. 26, 2024 06:40:13)

Powered by DjangoBB