Discuss Scratch

belugawhale
Scratcher
25 posts

Sensing Differences in Clones

I am making an atomic simulator game, and I found myself a at coder's block, as I can't seem to find a way to allow a clone to detect the costume number/name of another clone that it's touching.
The entire basis of Fusion in my simulator is based off of detecting costume numbers to check for compatibility.
If anyone has a workaround, it would be very appreciated

Thanks!

–belugawhale
drmcw
Scratcher
1000+ posts

Sensing Differences in Clones

I'm afraid you'll have to do all the hard work for this. You'll need to assign each clone an id when they are created and keep its costume# in a list. You can then look up each clones costume in the list.

10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
armique
New to Scratch
39 posts

Sensing Differences in Clones

If you know previously the total amount of clones you will need, then you can make two lists, one with the number Id of the clones and the other the assigned custom.
If you don't know it, you must create a variable increasing by 1 every time a new Clone is created, and the Store it in a list as Clone Id numbers.. In my last proyect you can see an example:
http://scratch.mit.edu/projects/10283711/
Look at the sun-rays way of generate clones
Wish it helps
armique
New to Scratch
39 posts

Sensing Differences in Clones

Sorry, instead of custom read costume
:-)
SWstudios
Scratcher
12 posts

Sensing Differences in Clones

You can make all your clones the same color and make them sense that color. for example:

Instead of doing:

When green flag clicked:
Forever:
If touching (sprite name here):
(Whatever)

Do this:

When green flag clicked:
Forever:
If touching color (sprite color here):
(Whatever)

Hope that helps.


when (you see SWstudios)
if (you click SWstudios)
Your cool
if (you follow SWstudios)
YOUR AWESOME
end
else
you suck //(no offence)
eastons
Scratcher
25 posts

Sensing Differences in Clones

Here is a sample project that shows how to track the status of clones.
http://scratch.mit.edu/projects/11112307/

eastons
_-RoaringBrute-_
Scratcher
1 post

Sensing Differences in Clones

How do I get a ship to dissapear when varible at 4
TheGodOfHedgehogs
Scratcher
17 posts

Sensing Differences in Clones

If you are using one sprite, then do this:
when green flag clicked
forever
if <(variable) > [3]> then
hide
end
end

If you are using clones, you would have to make clone IDs for each on to keep track of which clone disappears

Last edited by TheGodOfHedgehogs (Jan. 2, 2022 19:07:29)

Powered by DjangoBB