Discuss Scratch

nicmower
Scratcher
12 posts

Help with an animal breeding script? (dealing with clones)

So the way my script is set up is that these clones of different sexes mature over time, and once they reach maturity, they can interact with one another. I tried having it so when both the male and female sprites collide, they broadcast the same message, and the stage registers both of these broadcasts and increases a variable starting at 0. So when this variable reaches 2 (for both the male and the female), the stage resets it to 0. The female is supposed to recognize that the variable is 2 IMMEDIATELY after the broadcast is sent out, because I don't want clones that aren't interacting giving birth. I was hoping a quick interaction would make it virtually impossible for any other sprite to pick up the signal and give birth.

At the moment, I can see the variable increasing to 2, but the female sprites seem to miss the queue, and it just resets again.
If anyone's interested in reviewing the script and trying to work it out, its here:
http://scratch.mit.edu/projects/13097332/

I plan on implementing a gestation period as a sort of cool-down, so for now, if the script works as intended, the females should be popping out babies all over the place.
scubajerry
Scratcher
1000+ posts

Help with an animal breeding script? (dealing with clones)

I see no such broadcasts in your project.
nicmower
Scratcher
12 posts

Help with an animal breeding script? (dealing with clones)

Look for the confirmAge broadcast. It is only sent if the clone is in costume 1 (which is the costume the clone is changed to once it matures) and if it is touching an opposite gender clone. I figured if one clone touched another, the other would register the same thing at the same time. In the stage's script, you should see the confirmAgelist variable, which resets to 0 once it increases to 2.
nicmower
Scratcher
12 posts

Help with an animal breeding script? (dealing with clones)

Issue solved. Took a bit of tinkering.

Powered by DjangoBB