Template page without comments: Moving one point with another

Introduction
These two points are created as independent points, but with scripting we can make them move as one object. We can even make one point move both while the other is independent. Try dragging either point in the construction below! [br][br](This side originally created by [url=https://www.geogebra.org/themadmathematician]Jonas Hall[/url])
Sample construction
When to use
This trick with two points may not be useful in itself, but variants of it can be extremely useful, such as these: [br][br][list][*]Define a line through two points, A on the y-axis and B anywhere. Make sure that when you move A, then B moves with it so that the slope isn't changed. Moving B will not affect A and so only the slope is changed (This particular example should go on a page of it's own).[/*][*]"Grouping" objects so that one point acts as the anchor of the entire group.[/*][/list]
How do you do this?
The construction above uses the following KEY ELEMENTS: [br][br][list][*][b]Two points[/b]: Create two points, A and B.[br][/*][*][b]Scripts for each point[/b]: To make the two points move at the same time when either of them is moved you need to do a little scripting. [br][br]In the onUpdate script of point A, type:[br][code]SetValue[B , ( x(A)+1, y(A)+1 ) ][/code][br][br]and In the onUpdate script of point B, type:[br][code]SetValue[A , ( x(B)+1, y(B)+1 ) ][/code][br][br]In this case the offset between the points is (1, 1) but this could obviously be generalized by using a variable (DO give more examples).[br][br]To make A move both points while B is independent, just use the script for point A and leave point B unscripted. [/*][/list]
Screencast of construction
More examples
One point dragging both, but not the other way round: [url=https://www.geogebra.org/m/UEFW7KBV]https://www.geogebra.org/m/UEFW7KBV[/url][br]

Information: Template page without comments: Moving one point with another