playMaker

Author Topic: Find Closest in a chain [SOLVED]  (Read 698 times)

RobotGoggles

  • Playmaker Newbie
  • *
  • Posts: 35
Find Closest in a chain [SOLVED]
« on: February 17, 2021, 01:44:35 AM »
I'm trying to create a lightning attack that hits one target, checks to see if there's a new target within a range (using Find Closest and checking the distance) and hits the new target. This would repeat a number of times, finding a new target each time.

The problem I'm running into is that the closest object to the initial target keeps returning the same object. How can I repeatedly find the closest object in a range but not include the same object twice?
« Last Edit: February 17, 2021, 10:35:06 PM by RobotGoggles »
When life hands you insomnia, make video games.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Find Closest in a chain
« Reply #1 on: February 17, 2021, 08:33:16 AM »
Hi.
You could change the tag on the one that was already hit.

in our game we have a chain lightning effect,
but i use a 'overlap box 2d' to get the targets.
then when i send to 1, i then add it to a list and use compare gameobject.
this way i can see that it was hit already.

RobotGoggles

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Find Closest in a chain
« Reply #2 on: February 17, 2021, 10:34:16 PM »
Thanks this absolutely did the trick :D
When life hands you insomnia, make video games.