Posts: 2,765
Threads: 138
Joined: Nov 2002
how can i have the X move towards the closer * and not the other?
Code:
__________
_* _
_ _
_ _
_ _
_ _
_X _
_ _
_* _
__________
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Posts: 3,616
Threads: 287
Joined: Jan 2003
What I would do is add up the x-distance and y-distance of each * from the X. Then whichever ones' sum is smaller, have it go after.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 2,765
Threads: 138
Joined: Nov 2002
thanks. i was talking with z!re and he helped too.
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Posts: 979
Threads: 27
Joined: Aug 2001
Code:
if (x - x1)^2 + (y- y1)^2 < (x - x2)^2 + (y - y2)^2 then go_to_n1 else go_to_n2
That is, if you needed it in a single line code
.