I want the monster to spawn randomly between -200 and 0, or 640 and 840.
I know i would have to make 2 random numbers, one to pick which set to choose between, and one to choose from the set chosen.
My problem is making the correct ranges
Last edited on
err..?
1 2 3 4
|
int n = some_fancy_random_number_generator();
if ((n>=-200 && n<=0) || (n>=640 && n<=840)) {
// do your magic
}
|
Edit: Fixed typing error
Last edited on
That wont work because what if the if loop doesnt run? The monster just doesnt spawn? HM?
1 2 3 4
|
srand(time(0));
int first = rand() - 200;
int second = rand() % 840 + 640;
|
Last edited on