How to make a actor move randomly x & y axis????HELP
kajuto
Member Posts: 314
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
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)
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 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.
why?