I added another redraw_screen at the end, but that didn't change anything...
SO I lied: there's more going on in my code than what I posted. After I take the snapshot, I switch rooms, set an alarm that moves the player and the view, then draw the old room, making it scroll out while the new one scrolls in. That all works and looks great, except for the player flickering. Hang on, I'll try and post whatever code I can..
//User event: When player moves outside room
oldroomX = 0
oldroomY = 0
newX = ob_player.x
newY = ob_player.y
if ob_player.x <= 32 { //left edge
global.roomX -=1
oldroomX = 640
newX = ob_player.x +640
}else
if ob_player.y <= 32 {//top edge
oldroomY = 480
global.roomY -=1
newY = ob_player.y +480
}else
if ob_player.x >= room_width -32 { //right edge
global.roomX +=1
oldroomX = -640
newX = ob_player.x -640
}else
if ob_player.y >= room_height -32 { //bottom edge
global.roomY +=1
oldroomY = -480
newY = ob_player.y -480
}
x=ob_player.x
y=ob_player.y
set_automatic_draw(false)
instance_deactivate_object(ob_player)
screen_redraw()
bg_transition = background_create_from_screen(0,0,room_width,room_height,false,false,true)
instance_activate_object(ob_player)
scrolling = true
next_level = "room_goto(" + "rm_" + string(global.roomX) + "_" + string(global.roomY) + ")";
execute_string(next_level);
//screen_redraw()
alarm[0]=1
//Alarm 0 event:
view_xview[0]=oldroomX
view_yview[0]=oldroomY
ob_player.x = newX
ob_player.y = newY
screen_redraw()
set_automatic_draw(true)
//Draw event:
if scrolling = true{
draw_background(bg_transition,oldroomX,oldroomY)
if view_xview[0] < 0 view_xview[0] += 32
if view_yview[0] < 0 view_yview[0] += 32
if view_xview[0] > 0 view_xview[0] -= 32
if view_yview[0] > 0 view_yview[0] -= 32
}
EDIT: Solved it! Now I draw the screenshot to a surface instead of to the screen. Took me a while to figure out what order to do everything in, though..
set_automatic_draw(false)
surf_transition = surface_create(640,480)
instance_deactivate_object(ob_player)
surface_set_target(surf_transition)
screen_redraw()
bg_transition = background_create_from_surface(surf_transition,0,0,640,480,false,false,true)
instance_activate_object(ob_player)
surface_reset_target()
surface_free(surf_transition)
screen_refresh()