need to delay a blank screen after boss death

Trying to use an alarm to do so, but it isn't working out.

I have a boss _1 object that handles the level one boss, and boss_control that handles all bosses extrances and exits (or will when I get that far). I also have a global variable and a set of enums that switch their states.

BOSS_CONTROL

create:
GML:
enum states

{ walk,
  idle,
  jump,
  attack,
  falling,
  blocking,
  summon,
  death
}

global.state = states.walk;
///////boss room end
global.boss_destroyed = false;
black_screen = false;
step:

GML:
/////boss destroyed
if global.boss_destroyed == true
{alarm[0] = room_speed * 3}
alarm[0]:
GML:
black_screen = true;
draw:
GML:
if black_screen == true
{draw_sprite_tiled(sp_blankscreen,0,0,0);}
and in my boss:

GML:
if bs_1_hp <=0 {
    global.state = states.death;
        global.bs_death_x = ob_boss_1.x
        global.bs_death_y = ob_boss_1.y
        global.boss_destroyed = true;
        instance_destroy()
            instance_create_layer(global.bs_death_x,global.bs_death_y,"lyr_inst",ob_poof)
      
            }
draw GUI:

GML:
randomize()
if global.state = states.death
{ repeat (6) {
             draw_sprite(sp_poof,0, global.boss_death_x + irandom(sprite_width),global.boss_death_y + irandom(sprite_height));
          
}            }
After the boss dies, there's an explosion. That works. I'm not sure what I'm doing wrong afterwards, though. I wanted to set the alarm at the same as time as the boss destroys itself and after 3 seconds tile a black sprite across the room and throw up a "Room Cleared" text and moved to the next room (not there yet, obvisiously).

What am I doing wrong?

Any help appreciated. Thanks.
 

rIKmAN

Member
Trying to use an alarm to do so, but it isn't working out.

I have a boss _1 object that handles the level one boss, and boss_control that handles all bosses extrances and exits (or will when I get that far). I also have a global variable and a set of enums that switch their states.

BOSS_CONTROL

create:
GML:
enum states

{ walk,
  idle,
  jump,
  attack,
  falling,
  blocking,
  summon,
  death
}

global.state = states.walk;
///////boss room end
global.boss_destroyed = false;
black_screen = false;
step:

GML:
/////boss destroyed
if global.boss_destroyed == true
{alarm[0] = room_speed * 3}
alarm[0]:
GML:
black_screen = true;
draw:
GML:
if black_screen == true
{draw_sprite_tiled(sp_blankscreen,0,0,0);}
and in my boss:

GML:
if bs_1_hp <=0 {
    global.state = states.death;
        global.bs_death_x = ob_boss_1.x
        global.bs_death_y = ob_boss_1.y
        global.boss_destroyed = true;
        instance_destroy()
            instance_create_layer(global.bs_death_x,global.bs_death_y,"lyr_inst",ob_poof)
   
            }
draw GUI:

GML:
randomize()
if global.state = states.death
{ repeat (6) {
             draw_sprite(sp_poof,0, global.boss_death_x + irandom(sprite_width),global.boss_death_y + irandom(sprite_height));
       
}            }
After the boss dies, there's an explosion. That works. I'm not sure what I'm doing wrong afterwards, though. I wanted to set the alarm at the same as time as the boss destroys itself and after 3 seconds tile a black sprite across the room and throw up a "Room Cleared" text and moved to the next room (not there yet, obvisiously).

What am I doing wrong?

Any help appreciated. Thanks.
If you are setting the alarm in boss_1 then destroying it straight after - the ceases to exist along with the object you destroyed.
Set an alarm in another object that still exists in the room after the boss is destroyed - possibly your boss_control object, but any controller type object will do.


Should have read your code as you said you are already using the control object, my bad.

Seems like in the Step Event you are constantly setting the alarm every step when global.boss_destroyed is true and you never set it to false afterwards.
GML:
/////boss destroyed
if global.boss_destroyed == true
{alarm[0] = room_speed * 3}
This means the alarm will never countdown as you are resetting it over and over to room_speed * 3 because the if statement runs.
Try setting global.boss_destroyed = false after you set the alarm so in subsequent steps that if statement fails and doesn't reset the alarm anymore.
 
Last edited:
Top