Legacy GM draw_rectangle() doesnt draw over backround

Status
Not open for further replies.
S

SonicTheHedgehog+123

Guest
I made a pausing function based on this video of shaun spaulding

All instances get deactivated as they should when I am pressing space button but it doesnt draw a black rectangle over my screen. All I can see now is my modified backround. The depth of my pause object is the highest of all my object and its visibility is turned on. Open for any help:)

Here is the code of my pause object:
Code:
Create Event:
pause = 0;

Press Space Event:
if (!pause) 
{
pause = 1;
instance_deactivate_all(true)
}
else
{
pause = 0
instance_activate_all();
}

Draw Event:
 
if (pause)
{
draw_set_color(c_black)
draw_rectangle(0,0,room_width,room_height,0)
draw_set_font(fnt_options);
draw_set_color(c_white);
draw_text(220,room_height/2,"Game Paused");
}
 
S

SonicTheHedgehog+123

Guest
I changed the depth to -900 and it doesnt change anything.
 
R

robproctor83

Guest
Ok, well the code looks right so something else is going on, your gonna have to debug.

1) Are you sure that pause is actually set? show_debug_message() the value to make sure it is what you are expecting. Maybe you are only setting pause to 1 for a single step when the key is pressed.
2) Is the drawing object visible? Make sure it is visible.

And you said it doesn't draw the black rectangle, but I am guessing you don't see the text either correct?
 
S

SonicTheHedgehog+123

Guest
I dont know how debugging works. But as you said the text isnt drawn either. But I looked a bit in the manuals.
Code:
Step Event:

if !instance_exists(pause)
{
show_debug_message("false");
game_end();
    }
 
S

SonicTheHedgehog+123

Guest
I did research a bit now I know how to run the debugger.
I had my Windows size full screen so I didnt saw anything when running the debugger. :)
Now I started the debugger it shows me multiple times 1 when I am pausing.
 
Last edited by a moderator:
R

robproctor83

Guest
ok good, just to clarify make sure the show_debug_message is in either the step or draw event so that it's running every step. When you press the pause button does the pause variable stay set to 1 until you press it again?
 
R

robproctor83

Guest
also, try removing the if(pause) part and see if it draws like you expect.. if you remove the if part and its still not drawing then something else is wrong. Either your object is not visible (visible option unchecked in object) or you are still to low in depth or you are accidentally doing something else without realizing.
 
S

SonicTheHedgehog+123

Guest
This is what happens if I remove the if pause in the draw event(with depth 0)
Screenshot (13).png
 
R

robproctor83

Guest
Hmm ok so with depth 0 you can see it? Are you custom sorting depths or something? Usually -999 would be on top of 0 and not the other way around, so that's a little strange. Try using depth 999 instead and see if it draws it on top..
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Please get a legitimate copy of GMS and then we can help you. If your copy is legitimate, then update to the latest version (1.4.9999) and contact the YoYo Games helpdesk with your licence details to be permitted back on the forums.
 
Status
Not open for further replies.
Top