Q: Random start of several actors at specific points?

Game Editor comments and discussion.

Q: Random start of several actors at specific points?

Postby jonas » Thu Sep 18, 2008 8:37 pm

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
jonas
 
Posts: 5
Joined: Fri Jan 12, 2007 12:52 am
Score: 0 Give a positive score

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

Postby jimmynewguy » Fri Sep 19, 2008 1:56 am

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....
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

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

Postby jonas » Fri Sep 19, 2008 10:46 am

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
jonas
 
Posts: 5
Joined: Fri Jan 12, 2007 12:52 am
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron