Discuss Scratch

-Your_Nightmare-
Scratcher
10 posts

how to make 2 clones share private information in scratch

How do I make a clone that can share information with another clone using the list block?

I'm working on a simulation game where little Goblets try to survive in an environment. I want them to eat, drink, and mate, but to do that, they need to share information with food and other Goblets.

Here's what I have so far:

* Each Goblet's ID is represented by its color.

* Goblets can eat food, but if multiple Goblets are touching the same food, only one gets to eat.

* They move around and search for food.

* I created lists to communicate between clones, but there's a problem: If multiple clones are touching different clones, the list only stores the smallest ID of the Goblet it's touching, instead of handling multiple interactions correctly.


The Problem:
I need a way for each clone to properly communicate with other clones and food without overwriting important data. How can I do this effectively using lists in Scratch?

( If you want more info message me on my scratch account )

10goto10
Scratcher
500+ posts

how to make 2 clones share private information in scratch

It’s probably best to continue the topic here because otherwise the discussion may get divided.

it would help if you’d share a link to project.

A couple of things that are not clear to me. You said that the ID is represented by a color but then also said that the list stores the ID.

Are you using color touching to determine which clones are touching other clones?

Usually people use a local variable for each clone as an index into a list or set of lists, so that should work for your project but seeing it would help.

And perhaps this clone tutorial would help: https://scratch-mit-edu.ezproxyberklee.flo.org/projects/592014908

HighlaneGamingStudio
Scratcher
100+ posts

how to make 2 clones share private information in scratch

Try making one of the clones go to the front layer when it starts. You can do this by dragging it in the editor once you start the project or by using a go to front layer block. Sprites run scripts from front to back, and that may be your issue. I'm not sure how to fix it without being able to see the project, though.

Powered by DjangoBB