Suppose you click on one sprite and you want other sprites to move accordingly? I have that problem when I click on the waypoint button and want the turn and move controls for servo timing to show the values selected for that particular waypoint. Since all Scratch code must be attached to a sprite and triggered by an event, the solution is to use Scratch’s broadcast command.
On the left of this example, I click the wp_button sprite to change the waypoint, and at the bottom you see that this broadcasts the word ‘wpchange.’ On the right, you see that the move button sprite responds to the broadcasting of the same word. Now, there’s nothing special about the word ‘wpchange,’ it’s just the word that I chose to broadcast and receive. You could have a hundred, or a thousand, or who knows how many events occur in the coding of one sprite, and then broadcast them to other sprites to trigger respective actions, so long as you choose to broadcast and receive different words each time.
In a nutshell, it’s kind of like you’re making up a language for the sprites in your program to communicate with each other.
Having grasped and implemented this concept, I am now done with the servo timing slider bars. I’ll work on the left/right forward/back buttons next, and then it’s on to flashing the robot commands, and then I’m done with Scratch for now.