Create actor at random point from x/y +10 or -10

Non-platform specific questions.

Create actor at random point from x/y +10 or -10

Postby littlekruser » Sat Apr 14, 2007 4:51 am

I was wondering how I can create an actor at a random distance away from the creating actor but only within about +/-10 of the x/y coordinate.
littlekruser
 
Posts: 15
Joined: Wed Apr 11, 2007 6:22 am
Score: 0 Give a positive score

Postby makslane » Sat Apr 14, 2007 2:46 pm

In the creator actor put:

Code: Select all
double newx, newx;

newx = x + rand(20) - 10;
newy = y + rand(20) - 10;


Put the newx and newy variables in the CreateActor function.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby littlekruser » Sat Apr 14, 2007 7:38 pm

thank you very much :)
littlekruser
 
Posts: 15
Joined: Wed Apr 11, 2007 6:22 am
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron