Question about random numbers.
Posted: Tue Nov 21, 2006 1:43 am
HEY all. I am messing with Game Editor again
I have a quick question for you guys and gals.
Anyways I am wanting to make a random actor placement script (that part I got), but I want to make sure it does not place anything too close to my players actor.
What I have is this:
x=rand(600);
y=rand(430);
x=x+20; These just move actors away from the edge of my boarder
y=y+20;
CreateActor("BlueTriLt", "BlueTriLt", "(none)", "(none)", x, y, true);
This script makes my actors fine other than it will put it on top of my players actor.
What I need is something like this:
x=rand(600);
y=rand(430);
x=x+20;
y=y+20;
if x=290 to 350 then x=rand(600); pick a new number
else
if y=210 to 270 then y=rand(430); pick a new number
else
CreateActor("BlueTriLt", "BlueTriLt", "(none)", "(none)", x, y, true);
I hope that makes sense.
Also one other question. How can I destroy all actors, other than my players actor, at the end of level.
I have a quick question for you guys and gals.
Anyways I am wanting to make a random actor placement script (that part I got), but I want to make sure it does not place anything too close to my players actor.
What I have is this:
x=rand(600);
y=rand(430);
x=x+20; These just move actors away from the edge of my boarder
y=y+20;
CreateActor("BlueTriLt", "BlueTriLt", "(none)", "(none)", x, y, true);
This script makes my actors fine other than it will put it on top of my players actor.
What I need is something like this:
x=rand(600);
y=rand(430);
x=x+20;
y=y+20;
if x=290 to 350 then x=rand(600); pick a new number
else
if y=210 to 270 then y=rand(430); pick a new number
else
CreateActor("BlueTriLt", "BlueTriLt", "(none)", "(none)", x, y, true);
I hope that makes sense.
Also one other question. How can I destroy all actors, other than my players actor, at the end of level.