I am working on a scrolling shooter and I want certain objects to only spawn once a specific wave has been reached. Currently I have a object that Initializes a variable called "wave" and calls an alarm to increase the wave variable by one every 450 frames. I know this works as a have a GUI element that displays the wave number. I have another object that is supposed to spawn enemies once the wave reaches a certain variable, however when the wave has reached that variable nothing spawns. If I hard code the specific wave number that the enemy is to spawn it works.
Obj_wave Create:
global.wave = 1;
//next wave
alarm[0] = room_speed*15;
obj_wave Alarm [0]:
//new wave
global.wave +=1;
//speed up spawn every wave
obj_spawner.spawn_rate -=5;
//call alarm
alarm[0] = room_speed*15;
Obj_spawner Create:
randomize();
spawn_rate = 50;
spawn_rate1 = 200;
spawn_rate2 = choose(200,400,600);
spawn_rate3 = choose(200,300,400);
spawn_rate4 = choose(500,700);
alarm[0]= spawn_rate;
alarm[1]= spawn_rate1;
alarm[2]= spawn_rate2;
alarm[3]= spawn_rate3;
alarm[4]= spawn_rate4;
obj_spawner alarm[1]:
//random y
randomize();
randY = floor(random(room_height));
//create asteroid
if(global.wave>=2){
instance_create(room_width+40,randY, obj_shooter);
alarm[1] = spawn_rate1;
}
I am working on a scrolling shooter and I want certain objects to only spawn once a specific wave has been reached. Currently I have a object that Initializes a variable called "wave" and calls an alarm to increase the wave variable by one every 450 frames. I know this works as a have a GUI element that displas the wave number. I have another object that is supposed to spawn enemies once the wave reaches a certain variable, however when the wave has reached that variable nothing spawns. If I hard code the specific wave number that the enemy is to spawn it works.