F
Fyre
Guest
Hello!
For my game I'd like to spawn cars in randomized places (either a or b), randomized gaps between the spawns and then also randomized speed (altough I havent written the code for that yet)
However, I encountered the issue that it is random at the start of the game but then it continues to continue with the same values. (Always spwaning at the same place in the same frequency during the run of the game)
In the create Event:
Alarm[0]
For my game I'd like to spawn cars in randomized places (either a or b), randomized gaps between the spawns and then also randomized speed (altough I havent written the code for that yet)
However, I encountered the issue that it is random at the start of the game but then it continues to continue with the same values. (Always spwaning at the same place in the same frequency during the run of the game)
In the create Event:
Code:
randomize();
{
alarm[2] = random_range(1,6) * room_speed;
spawnrate = random_range(60,200);
alarm[0] = spawnrate;
spawnplace = irandom_range(1,2)
}
Code:
if(spawnplace %2 == 1)
{
instance_create_layer(-100, 270 , "CarLayer", obj_car);
}
else
{
instance_create_layer(-100, 510 , "CarLayer", obj_car);
alarm[0] = spawnrate;
}