• 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!

Having problem with the boss

A

Artwark

Guest
So when the boss appears, I want it done so that the player has to defeat both the boss & the asteroids as well.

Here's how its done so far in the obj_control

Step event
if(!instance_exists(obj_asteroids))
{
instance_create(random(room_width),random(room_height),obj_asteroids);
instance_create(random(room_width),random(room_height),obj_asteroids);
instance_create(random(room_width),random(room_height),obj_asteroids);
instance_create(random(room_width),random(room_height),obj_asteroids);
instance_create(random(room_width),random(room_height),obj_asteroids);
tough.speed+=1;
global.Boss+= 1;
global.level++;
if global.Boss == 3
{
instance_create(480,160,obj_boss);
global.Boss = 0;
}
}

If I defeat the asteroids before the boss, the asteroids reappear again. I want it so that you have to defeat both the boss and the asteroids inorder to go to the next level.

How can I fix this?
 
A

Artwark

Guest
oh....*facepalm* silly me. I nearly forgotten the && operator. Thanks mate!
 
A

Aura

Guest
Pro tip: Use the repeat statement if you want the same action to be executed in a step.

Code:
repeat (5) {
   instance_create(random(room_width), random(room_height), obj_asteroids);
}
Also, since the question has been answered, you'd want to set the status of the topic as solved. To do that, go to Edit Title/Thread Tools >> Edit Title >> Set the topic prefix to Solved.
 
Top