while(bounds_dist(src, target) > X)
if(step_towards(src, target)) continue
Problem description:
I'm trying to move src to be X pixels from the target. The issue is, it doesn't align the object with the target. Is there a way to capture the alignment of objects?
I'm currently concocting a rather complicated step control system using bounds() but I was hoping there'd be an easier way.
+++++++++++++
+X+++++++++++
+++++++++++++
++O++++++++++
+++++++++++++
I want to move X so that it aligns with O's bounding box from any given direction. Suppose that direction is NORTH. Using my code, I'll get:
+++++++++++++
+++++++++++++
+X+++++++++++
++O++++++++++
+++++++++++++
Because it moves X towards O, and their bounding boxes are 1 pixel apart. I used an alternative, using get_dir() for direction, and it still produces similar results. The desired result it:
+++++++++++++
+++++++++++++
++X++++++++++
++O++++++++++
+++++++++++++