Page 1 of 1

Q: Random start of several actors at specific points?

PostPosted: Thu Sep 18, 2008 8:37 pm
by jonas
I probably should have figured this one out myself, but I can't seem to figure out å good way to do it which works- been over a year since a messed around with GE...
I have three cars; one red, one yellow and one blue placed like in the illustration. They should start in the 3 different lanes on the screen but randomly each time, like, the red sometimes start from lane 1, another time from lane 2 and so on. The same with the two other actors- and they should of course not share the same lane. Hope you can help me, kind people. :D

Image

Re: Q: Random start of several actors at specific points?

PostPosted: Fri Sep 19, 2008 1:56 am
by jimmynewguy
just have a variable "lane" and on create actor of each circle
Code: Select all
 lane = rand(3);

then if lane = 1 move actor to lane one and so forth I could make a demo if i dont make sense....

Re: Q: Random start of several actors at specific points?

PostPosted: Fri Sep 19, 2008 10:46 am
by jonas
Thank you. But there will be a chance that the cars end up in the same lane, right? And that is something I want to avoid. An example code would be great! :)

EDIT: I finally got it to work. Thanks! :D