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

GML Hit freeze frames seem to last longer

zampa

Member
So I added a system that pause the game for X amount of frames when I call the script, and generally I freeze the game for one frame so I call the script like this scr_pause(1); but to me the pause frame stays up for longer than a frame, I haven't tested (and I would know how to) this is just my feeling so I wanted to post the code so you could tell me if i'm just crazy or if it's actually working properly.

scr_pasue() code:
Code:
/// @function pause(length)
/// @description pauses the game
/// @arg length how many frames does it pause


with(obj_pause){
    pause_sprite = sprite_create_from_surface(application_surface,0,0,obj_camera.iw*2,obj_camera.ih*2,false,false,0,0);
    pause_sprite_UI = sprite_create_from_surface(obj_player.UI,0,0,obj_camera.iw*2,obj_camera.ih*2,false,false,0,0);
    timer = argument[0];
    instance_deactivate_all(true);
}
obj_pause DRAW GUI
Code:
if(timer > 0){
    draw_sprite_stretched(pause_sprite,-1,0,0,display_get_gui_width(),display_get_gui_height());
    draw_sprite_stretched(pause_sprite_UI,-1,0,0,2048,1152);
    timer--;
}
obj_pause BEGIN STEP
Code:
if(timer == 0){
    instance_activate_all();
    sprite_delete(pause_sprite);
    sprite_delete(pause_sprite_UI);
    timer = -1;   
}
 
Top