1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

GMS 2 the kill score doesn`t appear when i kill an enemy

Discussion in 'Programming' started by kassmass, Jun 4, 2019.

  1. kassmass

    kassmass Member

    Joined:
    Jun 4, 2019
    Posts:
    7
    so i wanted to make a counter for the pointless murders i have commited in my game, and the text doesn`t show up, here`s the code in the create event:



    #macro resw 1024
    #macro resh 768
    display_set_gui_size(resw,resh);

    global.kills = 0;
    global.killsthisroom = 0;
    killtextscale = 1;




    and here`s thecode in teh draw GUI event:


    if (room != menu) and (instance_exists(o_player)) and (global.kills > 0)
    {
    killtextscale = max(killtextscale * 0.95, 1);
    drawtext(c_black, font1, fa_right, fa_top);
    draw_text_transformed(resw - 8 , 12, string(global.kills) + " Bad Guys Killed", killtextscale, killtextscale, 0);
    draw_set_color(c_white);
    draw_text_transformed(resw - 10 , 10, string(global.kills) + " Bad Guys Killed", killtextscale, killtextscale, 0);
    }



    can someone help?
     
  2. roozilla

    roozilla Member

    Joined:
    Feb 4, 2017
    Posts:
    111
    Is that the exact code? If so do you have a script called drawtext?
     
  3. kassmass

    kassmass Member

    Joined:
    Jun 4, 2019
    Posts:
    7
    yes, it is the exact code, and yes i have made a script called "drawtext"
     
  4. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,654
    Add a show_debug_message() inside that if check.
    If it prints the message to the console the issue is with the draw code, if it doesn't then the issue is the if check itself.
     
  5. kassmass

    kassmass Member

    Joined:
    Jun 4, 2019
    Posts:
    7
    i fixed it XD, al i had to do was drag the 'game" object to the playable rooms. the tutorial i was watching only dragged it to the menu.
    thanks anwyays guys!
     

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