GMS 2 An easy way to save many collectables?

Discussion in 'Programming' started by 0TastyPie0, Aug 28, 2018.

  1. 0TastyPie0

    0TastyPie0 Member

    Joined:
    Sep 20, 2017
    Posts:
    7
    So I have a platformer game where you can collect a specific collectable that is then saved in an ini file (if collected or not). One variable for each collectable. It's geting really hard to keep track of so many variables, is there an easier way (without having to have one variable for each)?
     
  2. O.Stogden

    O.Stogden Member

    Joined:
    Jul 25, 2018
    Posts:
    200
    Using an array, or ds_map might be an idea here, and saving that instead.
     
  3. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,631
    If you can work it out in bits, you can reduce the number of variables you need drastically. Depending on how many collectibles you have,have you would set up an array whereby each index in the array can hold up to 32 collectibles. so then you would just need to store in a variable in each collectible the bit that you were going to set aside in each index of the array for that item. Optionally, you would also store in a variable in each collectible the index of the array that it uses. I say this is optional because you could, for example, have each index of the array be every four levels, for example. So you wouldn't need to store the index in the item in that case.
     

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