Detecting Which Instance is Closer

maxerovmaxerov Member Posts: 9
edited November -1 in Working with GS (Mac)
Is there a way for an actor to "detect" which of two instances of a different actor are closer? (seeing if actor 1 is closer to either actor 2instanceA or actor 2instanceB). I could just make several separate actors but if their was a way to do this without creating so many actors it would be very helpful. Thanks

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    you would need to use magnitude. Tshirt booths tutorial is excellent and explains very nicely.
    http://www.youtube.com/user/GameSaladCookbook#p/u/20/_p2s61XVZ0o
  • cbtcbt Member Posts: 644
    I have 5-6 of the same actor recycling to Y:1200 and moving to Y:-100. And random X values, random size.

    I want to detect which one is closer to the "A" actor. To do this, I have to create global att.s for all of the actors, rihgt?
  • RHRH Member Posts: 1,079
    you can probably have just one global attribute. Put something along the lines of when self.distance is < game.closestdistance constrain game.closestdistance to self.distance. you will know that the actor is the closest when self.distance=game.closestdistance.

    just a thought, I'd have to put it into GS to figure it out properly but I don't have the time atm!
Sign In or Register to comment.