Object that draws mutiple overlapping sprites not working on a surface

JEMcG

Member
I have a pause screen for a game I'm making that copies the application surface to a new surface and then disables objects.
Doing it this way means that when the objects draw event is cancelled they are still drawn the screen.

My problem is that objects get a strange outline when this happens, especially my door which draws the door, the frame and the walls behind separately.

1639942239630.png1639942256465.png

I understand that the application surface deals with blending differently than dev made surfaces and I assume it’s to do with this? I’ve messed around the blendmodes and while I can get that outline to soften, it remains messed up.

I’m not sure if it’s an outline being blended in (either through it blending the sprites together or with the black background? I’ll be honest, I only really understand the basic blendmodes and once surfaces come in, it really starts to go over my head!) or if it’s drawing them in the wrong order.

I wondered if someone could point me in the direction to fix this?
I’ll post the code for the pause function and the door’s draw event.

Pause step event
GML:
if(global.pause_button){
    //Pause the game
    if(!paused){
        //copy a screenshot of the game to our created surface
        if(surface_exists(pause_surface)){
            surface_copy(pause_surface, 0, 0, application_surface);
        } else{
            pause_surface = surface_create(camera_get_view_width(view_camera[0]), camera_get_view_height(view_camera[0]));
            surface_copy(pause_surface, 0, 0, application_surface);
        }   
        //set the alarm to set the sprite version of the screen to be made
        //the sprite version does not go away on minimize but will lag the pause if made right away - hence the alarm
        alarm[0] = 1;
        
        //pauses the game
        paused = true;
        instance_deactivate_all(true);
    }
Pause Draw Event
Code:
/// @description Draw the screenshoot surface when paused

if(paused){
    var xx            = camera_get_view_x(view_camera[0]);
    var yy            = camera_get_view_y(view_camera[0]);
    //if the sprite version exists - draw the sprite version to prevent the minimization bug
    if(sprite_exists(pause_screen_sprite)){
        draw_sprite_stretched(pause_screen_sprite, 0, xx, yy, 3840 * global.gui_scaling, 2160 * global.gui_scaling);
    //if it does not yet draw the surface version - doing it this way prevents lag on pause screen   
    } else if(surface_exists(pause_surface)){
        draw_surface_stretched(pause_surface, xx, yy, 3840 * global.gui_scaling, 2160 * global.gui_scaling);
    }
}
Not sure this is relevant, as I turned this off and the issues above still occured but just to be sure, this is alarm 0:

Code:
/// @description make a sprite from the surface
// doing this later prevents pause lag

//make a sprite out of the surface to avoid it disappearing
if(surface_exists(pause_surface)){
    pause_screen_sprite = sprite_create_from_surface(pause_surface,0,0,surface_get_width(pause_surface),surface_get_height(pause_surface),false,false,0,0);
}
//Delete Surface
surface_free(pause_surface);
Door draw event
Code:
//Draw the doors and walls

//draw the walls around the frame
draw_sprite(spr_corridor_door_frame_wall, 0, x, y);
draw_sprite_ext(spr_corridor_door_frame_wall, 0, x, y, -1, 1, 0, c_white, 1);

//draw the door - if it's closed (this is for the sake of depth)
if(door_anim_frame == 0){
    draw_sprite(spr_door, door_anim_frame, x, y);
}

//draw the door frame to how it should be set
draw_sprite(sprite_index, drawing_frame, x, y);

//draw the door - if it's open (this is for the sake of depth)
if(door_anim_frame == 1){
    draw_sprite(spr_door, door_anim_frame, x, y);
}
 
Top