Using and altering Set my anchor to (object Anchor)

I am adding features to the Single Sensor Car program and want the car and sensor distance to be adjustable so that the car can move further away from the sensor. This feature would allow the car to overtake another vehicle on the same road.

I'm playing with these blocks but can't think of a way to adjust relative positions on the fly.
image

single sensor car

Any method of achieving the above will suffice; the set ancho approach is just my starting place. Any and all help is welcome.

If the anchor moves, it'll carry its parts with it, at whatever relative position they're already in. Moving the part, therefore, always moves relative to the anchor. No?

Maybe this sort of code might be useful - anchor the sensor but control it's absolute/relative position using tell

image

https://snap.berkeley.edu/snap/snap.html#present:Username=cymplecy&ProjectName=aoc22Day4&editMode

Thank you, your solution has inspired me. See my little test here ... Snap! Build Your Own Blocks

Yes, you are correct. I think my use of the term relative may have been poorly chosen.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.