"Move To" Random Target

jasonpbrucejasonpbruce Member Posts: 35
edited November -1 in Working with GS (Mac)
Hi All! Is there a way to move an actor to a random target?

I have a actor that spawns randomly on the Y axis from the top and I want it to "Move To" a random one of six targets at the bottom of the screen. I made the random spawner to start the actor, but don't know how to make it randomly target one of the six objects at the bottom of the screen.

Comments

  • jasonpbrucejasonpbruce Member Posts: 35
    Oh and all the targets at the bottom share the tag "Target" if that helps.... or I also made a new attribute called "RandomTarget".... didn't know which route to go
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    youll have to do something like this: have a attribute called random number set it to 0

    then for each target have 2 real attribute and have 2 change attibute behaviors changing the attrubutes to its self position x and y position and have that for each target, for each targets 2 attributes

    so target1x target1y with chage attributes changeing targetx to selfposition x in the first target, same for the y,then the same for target2x,target2y, ect till you get to the 6th one

    then in the actor u want to move have a rule when attribute random number=1 interpolate self position x to target1x and self position y to target1y

    then another rule when attribute random number=2 interpolate self position x to target2x and self position y to target2y and so on havin a rule for each number till u get to 6

    then whenevr you want the random move to happen, just have a chnage attribute behavior changing attribute random number to random(1,6)

    cheers
  • jasonpbrucejasonpbruce Member Posts: 35
    Cool, thanks! Is there a way to do it where all the targets uses the same "tag" and have the actor randomly target the "tag"?

    Thanks!
  • GLGAMESGLGAMES SingaporeMember Posts: 988
    i dun think using tag for random is possible yet. though that will really simplify AI creation.
Sign In or Register to comment.