Jump to content
  • Advertisement
Sign in to follow this  
Sean Frazier

Trouble With Level System [Gammaker Studio]

This topic is 817 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


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.

Edited by Sean12111

Share this post


Link to post
Share on other sites
Advertisement

Which wave is failing? 0, 1, 2+?

 

Knowing nothing of GameMaker Studio... I assume assigning a number to those Alarm objects schedules that alarm's script to run that many frames later? If not, what are those lines intended to do?

 

In alarm[1], what does the last line do, and are you certain that the variable spawn_rate1 is in scope at that point?

Share this post


Link to post
Share on other sites

I see the problem. Change

if(global.wave>=2){
instance_create(room_width+40,randY, obj_shooter);
alarm[1] = spawn_rate1;
} 

to

if(global.wave>=2){
instance_create(room_width+40,randY, obj_shooter);
} 
alarm[1] = spawn_rate1;

Right now, "alarm[1] = spawn_rate1"  only gets performed if global.wave>=2. Since that alarm goes off before the wave alarm does (so global.wave is still 1), the alarm never gets reset, and so the timer stops right there.

Edited by Anthony Serrano

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!