• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

How to make a boss appear at some point after an object is displayed the fourth time?

A

Artwark

Guest
I have an object called obj_ready. Basically, its a sprite that appears whenever you clear all the asteroids that you destroy in just one room. when you destroy all the objects in that room, the asteroids respawn in that same room and the obj_ready appears and disappears again and this is looped over and over again.

Now here's the thing. When obj_ready is displayed the fourth time, I want the boss object to appear at that point and when the boss is defeated, it goes back to the usual asteroids appearing.

So to sum it up.

for the first three times the get ready appears, you have to shoot all asteroids.
The fourth time the obj_ready appears, the boss object should appear.

How can I do this?
 
Use a counter that's increased every time 'obj_ready' spawns. When it's equal to 4, spawn the boss instead, and reset the count back to zero.
 
B

Becon

Guest
I would add a counting variable to the room clear event. Something like, if room is clears yourVariableHere += 1
That makes it count up by 1 every time the room is cleared. Then...have a variable check happen before it fills the room again with asteroids. Something to the effect of:
If yourVariableHere > 3 Bring out the boss.

Then if Boss is killed yourVariableHere = 0 <-- this should start the loop all over again because yourVariableHere is NOT greater then 3.

I hope this helps.
 
A

Artwark

Guest
ok so I tried doing it like this....

in obj_ready

Create Event
Bosstime = 4;
alarm[0] = 5;

Alarm 0
Instance_destroy();
Bosstime -=1;

Step event
if(Bosstime = 0)
{
instance_create(512,384,obj_boss)
Bosstime = 4;
}

And yet, it doesn't work. Am I suppose to place the obj_boss in the room here?
 

Focksbot

Member
I think ....

Every time you're creating a new obj_ready it's resetting the bosstime counter to 4. Make 'bosstime' a global variable (global.bosstime) and have it set to 4 at an earlier point, not whenever an instance of obj_ready is created.
 
A

Artwark

Guest
I think ....

Every time you're creating a new obj_ready it's resetting the bosstime counter to 4. Make 'bosstime' a global variable (global.bosstime) and have it set to 4 at an earlier point, not whenever an instance of obj_ready is created.
Can you be a bit specific here? Cause I did what you said and it still isn't working.....
 
A

Artwark

Guest
Never mind! I kinda figured it out how to do it and it worked!

Thanks for the help!
 
Top