Legacy GM Problem making a pause screen...

LazyTomato

Member
So there's this one game I'm making. For my pause screens, I wanted to make the game take a screenshot and use it as a sprite (fading it into a darker tone), as the pause buttons show up. I assumed sprite_create_from_surface would work, so I used that.
Thing is, I seem to be having problems with this unless my view is exactly at position 0,0 in the room.
Here's what I do...

In player's step event:
if (control==true) and (hp>0)
{
if (key_pause)
{
instance_create(0,0,obj_pause)
}
}

obj_pause's Create event:
pause=sprite_create_from_surface(application_surface,view_xview[0],view_yview[0],view_wview[0],view_hview[0],false,false,0,0);
instance_deactivate_all(true);
//Stuff below used for the fading effect
r=255
g=255
b=255
color=make_color_rgb(r,g,b)
fade=true
//Then it runs some extra code to make the pause menu buttons but that's irrelevant

obj_pause's Step event:
if fade==true
{
if r>100
{
r-=2
}
//Same for g and b
}
else
{
if r<255
{
r+=2
}
//Same for g and b
}
color=make_color_rgb(r,g,b)
if fade==false and r>=255
{
with (obj_menu_button)
{
instance_destroy();
}
instance_activate_all();
instance_destroy();
sprite_delete(pause)
}

obj_pause's Draw event:
draw_sprite_ext(pause,0,view_xview[0],view_yview[0],1,1,0,color,1)

Now, apparently, this draws the sprite just alright at position 0,0, and it looks okay if I pause there, but not anywhere else... And as I keep pausing more times at different spots it keeps leaving copies of the taken screenshots lying around.
Screenshots if necessary:
Trying to pause with the view at 0,0: http://imgur.com/DGKhYYX
Pausing below that point: http://imgur.com/a/A6iFO
Pausing more to the right: http://imgur.com/a/LrS8F
Just for reference, this is how the stage normally looks: http://imgur.com/a/V56HU

What am I doing wrong here, exactly?
 

Mick

Member
When creating the sprite from the surface, I think you should use 0 for x and y, not view_xview and yview.
 

LazyTomato

Member
When creating the sprite from the surface, I think you should use 0 for x and y, not view_xview and yview.
...Oh. I can't believe I made such a stupid mistake. I assumed doing that would make the game take a screenshot from the top left of the room.
Thanks!
 
Top