New Gs user,help with Actor following other/closest actors?

dereklaruedereklarue Member Posts: 121
edited November -1 in Working with GS (Mac)
Im new at using gamesalad, just bought the express.
So hi to everyone! I got a question. :(
How do i make it so one actor follows another/closest actor?
I want actor 1 to follow the closest actor 2.

Comments

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    tricky as there is no link function as yet in GameSalad...sure the is a work around, possibly using the rule if actor 1 collides with actor 2 change actor 1 attributes position every 0.1 second to equal actor 2's. Not sure how you would then get it to follow another actor 2, if it hits it....but I'm sure there would be a work around.

    sorry for vagueness, but at work and away from GameSalad...but still able to kill time during video renders to browse the forum...
  • BeyondtheTechBeyondtheTech Member Posts: 809
    I would use Game Attributes to "link up" the two.

    For instance, I would create two Game Attributes: PlayerPosX and PlayerPosY.

    In the Player Actor, I would Constrain PlayerPosX and PlayerPosY to the Player's actual position.

    In the Enemy Actor, I would then use the MoveTo or some other AI technique using the Actor's position against the PlayerPosX/Y that's accessible from within that Actor.

    `
    UPDATE: Looks like they have it in the Wiki already, exactly as I was picturing...
    http://gamesalad.com/wiki/how_tos:gsc_follow_another_actor?s[]=move&s[]=actor
    `
  • dereklaruedereklarue Member Posts: 121
    @ damper300:
    Thanks for the idea, any help is better than no help :)

    @ BeyondtheTech:
    Thanks for the help and the link,
    Using Global attributes looks like the only way to do this, thanks :D

    Didnt think to browse the wiki.. :p
  • rebumprebump Member Posts: 1,058
    I would combine FireMaple's magnitude demo (or the other magnitude/distance demo that is out there) and combine it with Bluefusion's enemies follow and face the player demo. Basically, you would implement Bluefusion's logic after using the magnitude function to find the actor who is the closest.
Sign In or Register to comment.