I'd like a message received block which catches when the sprite has been cloned/created. Additionally a block : "when message <variable> received"
how i imagine the blocks being used:
when green flag pressed.
set <numOfClones> to 0.
<clone>
when cloned
set <spriteId> to <numOfClones>
change <numOfClones> by 1.
when message < join <"hello", spriteId> > received
say < join <"I'm clone with id:", spriteId> >
Why is this useful? Now you can manage 1 specific clone. The way we have to handle this now is duplicate the sprite and make new messages, like "hello1","hello2","hello3" for 3 duplicate sprites.
Offline
a problem i didn't consider: many blocks only refer to a sprite name.
many sprites could exist which have the same name.
for example, if touching "bird" would check if touching any birds rather than a specific cloned bird.
i'm sure there are many ways to think about to solve all these cloning blocks issues.
1 set of new suggestions:
* Every sprite has a read-only variable called "id" which scratch sets as a unique number when sprite is cloned/created.
* BLOCK < Each Referring Clone > which is an variable list block containing all the clone's ids of the last block which referred to the sprite's name.
* A new message receiving block: "When signal <messageName> received". A signal is a message for specifically one unique clone.
* A new message sending block which has two inputs: "signal <messageName> , <id>"
* A new loop block which has two inputs: "For each <item> , <list>". this would allow you to loop through each item of a list more easily.
new blocks using example:
When green flag pressed
Clone
set <touchingId> to 0.
forever
if <touching <"SpriteName"> >
for each <touchingId> , < Each Referring Clone >
signal "hello", touchingId
when signal "hello" received
say "hello, another clone is touching me"
does this make sense?
Offline
This seems to be assuming Scratch has sprite cloning features - which it currently does not. I think the Scratch Team is considering it but still has some qualms about how it would work. This definitely seems like a good way to handle clones if the feature is implemented though.
Last edited by Harakou (2011-06-25 22:50:05)
Offline
Cloning is implemented in the project creator pre-alpha.
Offline