Windows draw_text dosnt work?

Discussion in 'Programming' started by leonardopixelpro, Jun 25, 2016.

Tags:
  1. 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:
     
  2. rui.rosario

    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
     
  3. Snail Man

    Snail Man Member

    Joined:
    Jun 20, 2016
    Posts:
    282
    Is it possible that that box is covering up the text? I can't tell if it's transparent or opaque
     
  4. HyphenM

    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?
     
    Lonewolff likes this.
  5. Aura

    Aura Guest

  6. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    3,556
    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"?
     
    Marvelo likes this.
  7. 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:
    [​IMG]
    and i have it placed off-screen
     
  8. the word that draws health, is not drawn, i should have said, it is an object with no code that just sits there.
     
  9. 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?
     
  10. 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.
     
  11. Siolfor the Jackal

    Siolfor the Jackal Member

    Joined:
    Jun 21, 2016
    Posts:
    755
    Try putting it in the Draw even instead.
     
    feminist52 likes this.
  12. 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...
     
  13. Annoyed Grunt

    Annoyed Grunt Member

    Joined:
    Jun 20, 2016
    Posts:
    136
    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?
     
  14. 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));
     
  15. Annoyed Grunt

    Annoyed Grunt Member

    Joined:
    Jun 20, 2016
    Posts:
    136
    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.
     
  16. allright, i will change the depth of the health word to 1, so maybe it will work
     
  17. no luck
     
  18. jackhigh24

    jackhigh24 Member

    Joined:
    Jun 21, 2016
    Posts:
    604
    it -1 you want as 1 is behind 0
     
  19. Annoyed Grunt

    Annoyed Grunt Member

    Joined:
    Jun 20, 2016
    Posts:
    136
    I said smaller than zero, not bigger. Anything from -1 downwards shoud do the trick.
     
  20. i will try that too.
     
  21. no luck ether
     
  22. Annoyed Grunt

    Annoyed Grunt Member

    Joined:
    Jun 20, 2016
    Posts:
    136
    Well this is weird.
    Are you using draw_text? Are you sure the color of the text is set to white?
     
  23. yeah... the font editor says so... i think
     
  24. Annoyed Grunt

    Annoyed Grunt Member

    Joined:
    Jun 20, 2016
    Posts:
    136
    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.
     
  25. oh. im a idiot :| :bash:
     
  26. YESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYESYES IT WORKS!!!!!!!!!:banana: thank you bro!
     
    Snail Man likes this.
  27. Annoyed Grunt

    Annoyed Grunt Member

    Joined:
    Jun 20, 2016
    Posts:
    136
    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.
     
    Yal likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice