Legacy GM [RESOLVED] Keep a custom draw variable when we change room?

Discussion in 'Programming' started by Arlan64, Jul 13, 2019 at 2:56 PM.

  1. Arlan64

    Arlan64 Member

    Joined:
    May 18, 2019
    Posts:
    26
    Hello world,

    I created a new variable named "emeraldCount" but I want this variable not equals 0 when we change room...

    I want to keep the variable for all rooms, like the score variable for example if you want.

    I give you the codes:

    obj_drawScore >> Draw Event
    Code:
    {draw_text(view_xview[0]+10,view_yview[0]+114,"Émeraudes: " + string(emeraldCount))}
    Blooby (obj_player) >> Collision Event With obj_emerald
    Code:
    with other {instance_destroy();}
    with (obj_drawScore) {emeraldCount = emeraldCount + 1;}
    sound_play(Emerald);
    I have "Émeraudes: 0" and "Émeraudes: 1" when I'm in level 2 and I've one emerald... and idk how to seperate that.

    Your help will be welcome!
     
  2. Annoyed Grunt

    Annoyed Grunt Member

    Joined:
    Jun 20, 2016
    Posts:
    110
    Make the object containing the variable persistent or make the variable global.
     
    Arlan64 likes this.
  3. Arlan64

    Arlan64 Member

    Joined:
    May 18, 2019
    Posts:
    26
    It works, thanks a lot! ^^
     

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