A Moving Line That Connects 2 Objects
-
Description
You can add a solid line that connects 2 objects, and when these 2 objects move, the line will move with them. To do that, you use the following block:

Parameters:- Object 1 and Object 2: The first 2 inputs should be the names of the 2 objects you are trying to connect. If one or both of these objects are not found, then no line will be added.
- Color: The color of the line.
- Diameter: The thickness of the line.
- Sides: The number of sides of the line. If you would like the line to look like a tube, then you can use 16 or 32 sides.
- Name: The name of this line. This can be used to remove this line later.
Demo
After the moving line is added, whenever one or both objects move, the line will automatically move to stay between the 2 objects.
For example, in this program below, we add 2 boxes named “a” and “b”, then add a moving line that connects them. After that, if we move the 2 objects, the line is always between these 2 objects.
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/27296b60-7ec1-4710-8ee3-e187dfa8466a.gif" width="1200" style="border-radius: 5px; border: 1px solid #29622d;">
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login