G
GhostGK
Guest
Hello, all...
I have a pause system that deactivates all objects, and uses surface functions to draw the app surface (game screen) + transparent square on top of that, giving it a transparent pause effect..
Here's how i do it in code..
In create event of pause obj...
In draw event...
In GUI Draw event...
Now that problem is that my menu system works with objects..
So, to make a pause menu, i have to create the menu objects, after all those stuff up there, i.e. over all those surfaces & things..
Problem is they don't show up..
I created the pause menu object that will create other objects (buttons), 1 step after the Create Event with a timer..
But, they don't show up.. Their functions don't work either (actions, menu sounds, etc..)
Any idea what I am overlooking?
I have a pause system that deactivates all objects, and uses surface functions to draw the app surface (game screen) + transparent square on top of that, giving it a transparent pause effect..
Here's how i do it in code..
In create event of pause obj...
Code:
global.pause = true; //variable to know when the pause is active
surf_pause = surface_create(view_wview[0], view_hview[0]);//Create surface
gui_width = view_wport[0];
gui_height = view_hport[0];
surface_set_target(surf_pause);
draw_clear_alpha(c_black,0); // Clears surface.
draw_enable_alphablend(false);
draw_surface(application_surface,0,0);
draw_enable_alphablend(true);
surface_reset_target();
instance_deactivate_all(true); //deactivate all other instances
audio_pause_all(); //pause all sounds
Code:
///Draw the surface
if(surface_exists(surf_pause))
{
draw_enable_alphablend(false);
draw_surface(surf_pause, view_xview[0], view_yview[0]);
draw_enable_alphablend(true);
}
else
{
surf_pause = surface_create(view_wview[0], view_hview[0]);
}
Code:
///Draw background
var c_last = draw_get_color();;
//Draw semitransparent square
draw_set_color(c_black);
draw_set_alpha(0.5);
draw_rectangle(0,0, gui_width, gui_height,0);
draw_set_alpha(1);
draw_set_color(c_last);
So, to make a pause menu, i have to create the menu objects, after all those stuff up there, i.e. over all those surfaces & things..
Problem is they don't show up..
I created the pause menu object that will create other objects (buttons), 1 step after the Create Event with a timer..
But, they don't show up.. Their functions don't work either (actions, menu sounds, etc..)
Any idea what I am overlooking?