How to make a actor move randomly x & y axis????HELP

kajutokajuto Member Posts: 314
edited November -1 in Miscellaneous
I'm making a Actor so he can move freely around the park and after let say....5 minutes the Actor go to the exit.., anyone can help me?? please

Comments

  • DrGlickertDrGlickert Member Posts: 1,135
    Timer:
    After 300 seconds;

    Change attribute self.position.X (location of exit)
    Change attribute self.position.Y (location of exit)

    If you want it to "move to exit"

    Interpolate self.position.X (location of exit)
    Interpolate self.position.Y (location of exit)
  • PhoticsPhotics Member Posts: 4,172
    kajuto said:
    I'm making a Actor so he can move freely around the park and after let say....5 minutes the Actor go to the exit.., anyone can help me?? please

    Timer... for 300 seconds

    another timer... every 10 seconds
    change attribute... self.Random.X (0,359)
    move forward based on the new random angle.

    After... 300 seconds... move to the exit.

    That's a rough explanation of it. I explained artificial intelligence better in the enemies chapter of The Unofficial GameSalad Textbook.

    Here's something else...

    change attribute... self.Random X to random(100,self.position.x+100)
    change attribute... self.Random.Y to random(self.position.y-100,self.position.y+100)

    rotate to self.Random.X / self.Random.Y
    move to self.Random.X / self.Random.Y

    I think that might be another way to do it. I just found it easier to use rotate and forward movement based on the actor's angle.

    Basically, it's just messing around with the random expression, timers and move/rotate behaviors
    DrGlickert said:
    Interpolate self.position.X (location of exit)
    Interpolate self.position.Y (location of exit)

    Interpolate would create uneven speed. Like if the character was close the exit, the character would move slowly. If the actor was far away, it would move fast... unless the duration of the interpolate was changed based on the magnitude from the edit.
  • kajutokajuto Member Posts: 314
    Thank You for your reply and I appreciate. Photics after i tried the suggestion of your, my characters don't move, but i put the behavior accelerate toward and he go to the exit directly it won't go around for sometime and after sometime he go then to the exit...for the random X and random Y I create a real type attribute one for random X and the other one for the Y. Or i just make any mistake, correct me please, i'm new here as you can see.. sorry

    why?
Sign In or Register to comment.