GML Object won't show up in room when placed/created

Koops

Member
The issue I'm having is that, no matter if I place the object inside a room or let it be created with a different object placed inside an instance layer, it doesn't show up in the room when testing the game.

This problem arises when I play an object that has a sprite or no sprite at all.
I want text to be shown in a text adventure style of game, but it suddenly doesn't want to appear.

When I first created the object with no sprite and placed it inside the room, it showed the text, but suddenly it doesn't. I don't know what happened.

When I placed another object with a sprite once, it showed up in the room editor, but not in the play test. Then weirdly enough, I had to add draw_sprite() in order for it to show up.

Debug messages even showed me that the sprites exist, but are invisible. The Visible checkbox is even checked and I never unchecked it.

What's exactly happening and is there a way to fix this problem?

If you need more information, feel free to ask and I'll tell you. Because I understand if my english is a bit confusing, since I'm not a native english speaker. I apologize for that.
 

TsukaYuriko

🌠
Forum Staff
Moderator
When I placed another object with a sprite once, it showed up in the room editor, but not in the play test. Then weirdly enough, I had to add draw_sprite() in order for it to show up.
Did that object have a Draw event? Adding a Draw event translates to "don't draw this object's sprite, I will handle all drawing myself", so unless you explicitly draw the sprite, it won't be drawn.

That aside, are you changing the draw alpha via draw_set_alpha anywhere? The effect of this is global and needs to be reset to the default value after performing a non-standard alpha draw to avoid one portion of code affecting others.

If the problem persists, please post all relevant code.
 

Koops

Member
Yes, the object has draw events, but it has no sprite. It's just for displaying text. I'm not sure if there's a better way to do text in visual novel styled text adventures, besides just having it display the text and nothing else.

Here's the code inside the draw event to display text. It has no sprites, it's empty.

draw_set_halign(fa_left);
draw_set_valign(fa_top);
draw_set_font(fnt_text);
draw_text_ext(310, 5, intro01, th, textboxWidth);
draw_text_ext(310, pH02, intro02, th, textboxWidth);
draw_text_ext(310, pH03, intro03, th, textboxWidth);
 

Koops

Member
Like I mentioned before, this displaying text object worked previously just fine, I don't know why it suddenly stopped working. My guess is that it must have something to do with the room? But the only thing I changed in the room was the grid size and that's not the problem. I'm really confused.
 

Toque

Member
Is it being drawn but another object is in front of it?


If you place in a new room with that only object is it drawn?

Is it drawn but off the visible window?
 

Koops

Member
I know about the draw_self(); command. I had to create it to that one other object, which has a sprite image. Let's call it Object A.
When I have the controller object creating Object A, it won't show up when it doesn't have any code inside it. I had to add draw_self(); for it to appear.

Now, the other problem I keep mentioning is about the object, that has no sprite image attached to it. This is Object B. Let's just focus on Object B please.
Object B is just an object that is for making the text show up, nothing more, nothing less. The code I posted above is just for drawing and placing the text that I set up in the Create event. Nothing else.

Is it being drawn but another object is in front of it?
If you place in a new room with that only object is it drawn?
Is it drawn but off the visible window?
No, even if the object is alone in the room, it still doesn't want to be drawn. Not Object A or Object B.
 

Toque

Member
“Create event” ??

Shouldn’t it be in the draw event?

I usually put draw stuff in draw event.
This was already mentioned by moderator so maybe you tried that already.
 

Koops

Member
“Create event” ??
Shouldn’t it be in the draw event?
I usually put draw stuff in draw event.
This was already mentioned by moderator so maybe you tried that already.
I apologize that it didn't seem clear enough.
I said that I set up the text in the create event, which in the code I posted above is intro01, intro02 and intro03. The strings are in the create event. Everything I draw is in the draw event, that's something I knew before I posted this question.
I hope that's a bit more clear. ^^
 
T

Timothy

Guest
This may seem obvious, but make sure visible is set to true (through debugger). Also check position.
 
Last edited by a moderator:

Toque

Member
You will have to post all the code and maybe someone can help.

I would start new project. Copy paste code and see if it works.

If it still doesn’t show it’s the code.
 
Last edited:

jackquake

Member
One more thing you might try as this one bit me a long time ago...

Put a Draw_Set_color c_white (or draw_set_colour as you prefer) before you draw the text. Perhaps you have accidentally changed the color to the background color of the room and the text is there, you just can't see it.
 

Koops

Member
One more thing you might try as this one bit me a long time ago...
Put a Draw_Set_color c_white (or draw_set_colour as you prefer) before you draw the text. Perhaps you have accidentally changed the color to the background color of the room and the text is there, you just can't see it.
draw_set_color(c_white); helped. The text is visible. :D
Maybe the standard color setting of text is black? I never thought about that.
Thanks a lot for the help jackquake. And thanks for everyone who took the time and tried to help me. I appreciate it. :D
 
Top