Author Topic: Find the nearest point  (Read 684 times)

0 Members and 1 Guest are viewing this topic.

Offline VinceBros

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 275
Find the nearest point
« on: November 11, 2009, 11:18:55 am »
Hi guys,

I am trying to improve my skills with Coordinates..

AND I'M BLOCKED, as you will see my problem.

I'm going to show you the problematic part.
Code: [Select]

pointx,pointy : array [1..4] of single;
Here are my variables, simple eh.
Those have all specific coordinates all around the map, like pointx[1] is (-123) and pointy[1] is (456) -> (-123,456)
WELL.
There are four of them, and, is it possible the find the nearest couples by player' coordinates.

Peace!
 

Offline GSx_Major

  • Major
  • *
  • Posts: 97
Re: Find the nearest point
« Reply #1 on: November 11, 2009, 12:05:11 pm »
Loop through the four positions and use the Distance() function. Save the first in a var, compare the others to that. If lower, change the var to that.
...and headbutt the sucker through your banana suit!

Offline VinceBros

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 275
Re: Find the nearest point
« Reply #2 on: November 11, 2009, 01:13:42 pm »
It's a good way to find the lowest distance but it does not find the [1] or [2] or [3] or [4].

Offline GSx_Major

  • Major
  • *
  • Posts: 97
Re: Find the nearest point
« Reply #3 on: November 11, 2009, 04:03:08 pm »
Save which one the loop was on where it found the lowest in a separate var...?
...and headbutt the sucker through your banana suit!