background_create_from_surface not working.

P

PHL

Guest
Please, I am not stupid, but I have trouble making a background from a surface.

I wanted to make a Pause system where in a room, you press Pause and you go to a pause room whose background is an image of the room you left behind. This gives the illusion that you are still in the same room, and it saves work because I simply freeze the room's action by making it persistent before going to the pause room.

But I cannot make a background from the current stage. I have created a surface in the Draw event, used surface_set_target on it, tried to draw the view on it with the view_surface_id function, then used the background_create_from_surface function and finally deleted the made surface and gone to pause room.
Then in pause room I say background_index[0]=global.pause_background.

But in the pause room the background does not appear.
I'm sure it was created because I said go to pause room if background_exists(global.pause_background).

But I do not see it.

Can anyone help?

The older Game Makers were much easier to use with their now-obsolete background_create_from_screen() function.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Why do it this way? Just make a copy of the application surface and use that.

Code:
global.pause_surf = surface_copy(global.Pause_Surface, 0, 0, application_surface);
Just don't forget to free up the global surface when you don't need it any more.
 
P

PHL

Guest
Why do it this way? Just make a copy of the application surface and use that.

Code:
global.pause_surf = surface_copy(global.Pause_Surface, 0, 0, application_surface);
Just don't forget to free up the global surface when you don't need it any more.
Thank you Nocturne.

But...
I disabled the application surface so that my game could run fast, so I don't know how I can use your code.

Also, I'm confused because the help manual says that the surface_copy function returns nothing (N/A), so why are you storing it in a variable called global.pause_surf ?

Thank you Nocturne. I will try to experiment with your idea and adapt it to my situation.

If I get a solution I may write it here to help others.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Also, I'm confused because the help manual says that the surface_copy function returns nothing (N/A), so why are you storing it in a variable called global pause_surf ?
Lol! Just writing code too fast and not thinking about it too much.. :p Sorry!
 
Top