D
Dewarriorz
Guest
This is my code, it is supposed to spawn 5 asteroids if none are present in the game room. It spawns the initial 5 but none after that.
if (!instance_exists(obj_astroid))
{
instance_create(random(room_width),random(room_height),obj_astroid);
instance_create(random(room_width),random(room_height),obj_astroid);
instance_create(random(room_width),random(room_height),obj_astroid);
instance_create(random(room_width),random(room_height),obj_astroid);
instance_create(random(room_width),random(room_height),obj_astroid);
}
If I use the code below it spawns asteroids continuously
if (!instance_exists(obj_astroid))
instance_create(random(room_width),random(room_height),obj_astroid);
instance_create(random(room_width),random(room_height),obj_astroid);
instance_create(random(room_width),random(room_height),obj_astroid);
instance_create(random(room_width),random(room_height),obj_astroid);
instance_create(random(room_width),random(room_height),obj_astroid);