Discuss Scratch

Jaaura
Scratcher
66 posts

How do I detect if clones have the same costume

I am making a merge game and need the costumes of clones to be the same if I want the merge to take place. How do I detect it?

Here is what I tried
if <([Costume # v] of [Sprite1 v]) = ([Costume # v] of [Sprite1 v])> then 


switch costume to [((costume #) + (1)) v]

else
delete this clone
end

cavicape
New Scratcher
24 posts

How do I detect if clones have the same costume

did you put when i start as a clone? because in the post it looks like your code is not attached to anything. can you send a link? thanks

Last edited by cavicape (Nov. 11, 2023 19:34:31)

Jaaura
Scratcher
66 posts

How do I detect if clones have the same costume

Jaaura
Scratcher
66 posts

How do I detect if clones have the same costume

The script I use does contain a when I start as a clone block
ZADENZERO
Scratcher
69 posts

How do I detect if clones have the same costume

Jaaura wrote:

I am making a merge game and need the costumes of clones to be the same if I want the merge to take place. How do I detect it?

Here is what I tried
if <([Costume # v] of [Sprite1 v]) = ([Costume # v] of [Sprite1 v])> then 


switch costume to [((costume #) + (1)) v]

else
delete this clone
end


The reason this wouldn't work is because (Costume # of (Sprite 1)) doesn't check for clone costumes, just the main costume.
What I'd do is make a variable for each tile/item/whatever your merging game is like, and in that variable, stating what costume number it is, and then try to make it that when two tiles are touching, make them combine if they have the same costume.

This is the best thing I can think of, as I'm not the most technical Scratcher. Hoped this helped, even if only a little!
broskinumber3
Scratcher
41 posts

How do I detect if clones have the same costume

Jaaura wrote:

The script I use does contain a when I start as a clone block

i tend to overcomplicate my ideas, but ill try to have a somewhat reasonable way of detecting the clones costume

you could have a unique color identifier for specific costumes, which would fall into the touching color block.
<touching color [#764c1b] ?>
Rafael_Bagi123
Scratcher
86 posts

How do I detect if clones have the same costume

create a list called “clone costumes”
and variable called “clone id” for this sprite only
put this clone when generate the clones:

set [clone id] to [0]
repeat (number of clones)
add [palceholder] to [clone costumes]
change [clone id] by (1)
create clone of [myself]

end

when I start as a clone
insert (costume #) at (clone id) of [clone costumes]

now you can take track of every costume of every clone by their id
i hope that help

Last edited by Rafael_Bagi123 (Nov. 12, 2023 16:59:07)

Powered by DjangoBB