How do I do random?

Game Editor comments and discussion.

Postby Zehper48 » Wed Aug 08, 2007 11:50 am

what is the code to make randomly create 2 actors, like 50% chance actor 1 and 50% chance actor 2?
User avatar
Zehper48
 
Posts: 241
Joined: Sun Jun 11, 2006 1:34 am
Location: Advanced Noob
Score: 4 Give a positive score

Postby makslane » Wed Aug 08, 2007 1:08 pm

Try this:

Code: Select all
if(rand(100) > 50)
{
  //Create 1
}
else
{
  //Craete 2
}
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Previous

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron