Windows draw_text dosnt work?

L

leonardopixelpro

Guest
Hello. I have tried multiple times to get a string of text (in the color white) at a location on the screen, with no result. what I am trying to achieve is a number to serve as a health counter using a number instead of a more modern health bar or hearts for health. I am trying to make a game likewise to Undertale, but with a IDLE clicker style of game-play.
things i have tried:

HP = 20;
draw_text(304, 80, string(HP));

i have also tried

HP = 20;
draw_text_colour(304, 80, string(HP), c_white, c_white, c_white, c_white, c_black);

even just displaying something like

draw_text(304, 80, "Hello world");

will NOT work.

I have also tried with blocks:

---Script---
HP = 20;
---Draw Text---
text: HP
X:304
Y:80

upload_2016-6-24_21-8-13.png

The Co-ordinates X:304 Y:80 Are Directly Underneath The Word Health

If anyone knows of My error, even though it is most likely obvious.

I have done things exactly as the Gamemaker:Studio Documentation instructs to do.

===================================================================


Please, I Have Tried Everything, unless there is a glitch in the windows 8.1 version that is not on MAC or OSX, Or LINUX, Or STEAM?

Please Help... I am very frustrated...:bash:
 
R

rui.rosario

Guest
What is the instance that is drawing the text? Is it bellow or above the black rectangle with Health on it, in terms of depth? Have you set the color to white before attempting to draw the text? Also, on the draw_text_colour variation the last argument should be the alpha (i.e. transparency) where a value of 1.0 is full opaque and 0.0 is fully transparent (c_black is $000000 which is 0, hence fully transparent)

Just the things that came to the top of my head
 
S

Snail Man

Guest
Is it possible that that box is covering up the text? I can't tell if it's transparent or opaque
 
H

HyphenM

Guest
The two things I can think of are, is it being done in a draw event? Is the depth of the object lower than that of the box?
 

Yal

šŸ§ *penguin noises*
GMC Elder
Make sure you're actually putting the draw code in a draw event, otherwise the things you draw will be overwritten by the background color/image as soon as the draw event starts.
If your font is very narrow and you have antialiasing set to the default, 3, it might get so antialiased it gets completely transparent, so be wary of that.

Why can't you put the HP drawing code right under the code that draws the word "health"?
 
L

leonardopixelpro

Guest
What is the instance that is drawing the text? Is it bellow or above the black rectangle with Health on it, in terms of depth? Have you set the color to white before attempting to draw the text? Also, on the draw_text_colour variation the last argument should be the alpha (i.e. transparency) where a value of 1.0 is full opaque and 0.0 is fully transparent (c_black is $000000 which is 0, hence fully transparent)

Just the things that came to the top of my head
A it is direcly below the word health, to somewhat mimic undertales style format, and the instance drawing the text is an invisible Undertale soul image that looks like this:

and i have it placed off-screen
 
L

leonardopixelpro

Guest
Make sure you're actually putting the draw code in a draw event, otherwise the things you draw will be overwritten by the background color/image as soon as the draw event starts.
If your font is very narrow and you have antialiasing set to the default, 3, it might get so antialiased it gets completely transparent, so be wary of that.

Why can't you put the HP drawing code right under the code that draws the word "health"?
the word that draws health, is not drawn, i should have said, it is an object with no code that just sits there.
 
L

leonardopixelpro

Guest
Is it possible that that box is covering up the text? I can't tell if it's transparent or opaque
actually, you might be on to somthing, because the object for the word health is large, so it might be that gamemaker thinks the text is covered by a transparent background?
 
L

leonardopixelpro

Guest
alright, so heres my set up:
upload_2016-6-25_9-20-2.png
upload_2016-6-25_9-19-40.png

so, im not sure... i have tried changing the create to when room starts, and step>step.
 
L

leonardopixelpro

Guest
Try putting it in the Draw even instead.
just did that with no result... maybe the heart needs to be in the veiw areaa?

Update:
also tried to change the coordinates... no result
also tried to move the heart to a place on-screen...
 
A it is direcly below the word health, to somewhat mimic undertales style format, and the instance drawing the text is an invisible Undertale soul image that looks like this:
-snip-
and i have it placed off-screen
Ok, but you still haven't addressed most of @Yal's questions:

  • What is the depth of the heart instance?
  • If the depth are the same, are you sure you've set the room's instance order correcty?
  • Have you changed the c_black to 1.0 in your draw_text_ext?
 
L

leonardopixelpro

Guest
Ok, but you still haven't addressed most of @Yal's questions:

  • What is the depth of the heart instance?
  • If the depth are the same, are you sure you've set the room's instance order correcty?
  • Have you changed the c_black to 1.0 in your draw_text_ext?
the hearts depth is 0,
and so is the word healths
and no, i havent... i was just doing a draw_text(304, 80, string(hp));
 
Well, if the depths are the same, and there is a chance the two instances could overlap, you either set the heart's depth to be smaller than the box or you change the instance order from the room.
 
L

leonardopixelpro

Guest
allright, i will change the depth of the health word to 1, so maybe it will work
 
What do you mean by "the font editor" says so? Are you setting the color before drawing the text? By default it should be black.
 
L

leonardopixelpro

Guest
What do you mean by "the font editor" says so? Are you setting the color before drawing the text? By default it should be black.
YESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYES IT WORKS!!!!!!!!!:banana: thank you bro!
 
Happy to have helped. For the future, though, remember to not make doubleposts (or worse, tripleposts). Use the edit function to edit your posts and add information.
 
  • Like
Reactions: Yal
Top