Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
moving toward closer object
#1
how can i have the X move towards the closer * and not the other?

Code:
__________
_*       _
_        _
_        _
_        _
_        _
_X       _
_        _
_*       _
__________
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#2
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.
Reply
#3
thanks. i was talking with z!re and he helped too.
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#4
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 Big Grin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)