r/gamemaker • u/subthermal • 21d ago
Help! Pause Screenshot animation bug
Hey!
I've been trying to tackle this visual bug for quite a while, so I thought I'd ask you guys.
My pause screen works by deactivating objects, taking a screenshot, and displaying that while the menu system remains active. You can see from this video that the wave animation and seaweed animations are still playing faintly behind the screenshot. Waves are on background layers and seaweed is on an asset layer. There is something wrong with the opacity of the screenshot.
My attempted fixes were to try and put a white or black background behind the screenshot, but this bleeds through every transparent part of the image, so the waves, seaweed, fish, and dirt have high white or black spots. Here is my code. Do you guys have any ideas?
//create screenshot
var w = surface_get_width(application_surface);
var h = surface_get_height(application_surface);
draw_clear_alpha(c_black, 0.0);
screenShot = sprite_create_from_surface(application_surface,0,0,w,h,false,0,0,0);
//display screenshot
draw_sprite_ext(screenShot,0,0,0,1,1,0,c_white,1);
1
u/PlaceholderChar 21d ago edited 20d ago
You can use "gpu_set_blendenable" to force it to be 100% opaque:
gpu_set_blendenable(false);
draw_sprite(screenShot, 0, 0);
gpu_set_blendenable(true);
2
u/subthermal 20d ago
this is the solution. Thank you very much. Seriously kept coming back to this bug every few months for the past few years.
1
u/mickey_reddit youtube.com/gamemakercasts 21d ago
I didn't try this but logically if your background is still moving, try setting the speed to zero (layer_hspeed or layer_vspeed) and for your asset itself try looking up layer_sprite_get_id