displaying distance to closest target with multiple targets...

jedikanjedikan Member Posts: 10
edited March 2014 in Working with GS (PC)

How to get distance reading from my player to multiple targets aproaching and get the distance to the closest one.
I known that I need to use functions to get reading to one target but I am lost when I have lots of targets.
The calculation on display are crazy...
Please help step by step as I am new to the advance coding...
Cheers for your help people!

Comments

  • JScottJScott Member Posts: 143

    For multiple targets you will have to make game attributes for the position of each one. And constrain their positions to the game attributes.
    Then use the magnitude function to calculate distances, and choose the closest one.
    There are lots of explanations on here about the magnitude function.
    Not simple what you're doing, though, start small and build up!

  • jedikanjedikan Member Posts: 10

    thank you JScott for answer.
    the targets are spawed from 12 diferent points.. so what next? location of spawing points? No... hmmm

  • UtopianGamesUtopianGames Member Posts: 5,692
    edited March 2014

    @jedikan You got the title of your 2 posts mixed up, thought i was going mad for a minute lol.

    I have a old Homing missiles project that might help, project attached.

    Space to fire.

    Darren.

  • jedikanjedikan Member Posts: 10

    HEHEHEHEheheheh.......
    sorting this out...

  • jedikanjedikan Member Posts: 10

    thank you...

  • jedikanjedikan Member Posts: 10

    Hi Darren
    the template is grate and i worked for long...
    I discovered some problem. your missiles are visible and my are spawed and i still can not do the display to work...
    I did the constining the locations and they are working as I got the display separately.
    but when i do the distances1 smaller than other attributes
    and then display text atribute distance1
    nothing is happening.
    .... ehhhh
    any ideas what is going wrong.
    ps I did as well exact way as yours
    change attribute to 1...
    and
    when attribute is 1 then display text...still not working...
    hmmm

Sign In or Register to comment.