How do I get stars to show on the level menu?

0 favourites
  • 6 posts
From the Asset Store
ready made menu you can download this one or just follow my tutorial to make it yourself
  • Oh my brain hurts. C3/Mobile game (I hope)

    The game: The player must navigate between the platforms to win the level.

    If the player dies, they start over.

    On some levels the player will have items to collect along the way, BUT the player does not need to collect all the items to win - the player only needs to survive to win the level. If the player does collect all the items I want stars to show on the level menu above the level indicator.

    Here's my problem. I have the level menu working for selecting levels, but I can't figure out how to get the game to understand that it should only use the level sprite with the stars when the player collects all the items for that level. Right now it shows the star level sprite for every open level.

    Animation 0 is a locked level. Animation 1 indicates open level. Animation 2 indicates the player collected all the items on that level as well as survived.

    I've tried global variable numbers & boolean, but I just can't seem to figure out how to get the game to only select Animation 2 (the stars) when that specific level was won and all the items were collected.

    Here's the C3.

    Thank you.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You need to save the "gotStuff" for each level. The easiest way to do that is with an Array.

    I changed it so that all the local storage data is saved in one array. That means you only have to check for that one item.

    since arrays start with row 0, and your levels are numbered 1 to 25, I stuff the other global variables in the first row (row 0). Then each row after that stores data for each level - which right now is just the gotStuff indicator. You could add more data in the future - fastest time, other stuff collected, how many stars (1, 2 or 3), etc...

    If you add more levels you will need to increase the size of the array. It needs to be one more than the number of levels since the first row is used for the global variables.

  • AllanR,

    Thank you so much. I think I'm finally starting to understand arrays.

    ..... and now I have more questions.

    I haven't used arrays before, because I can't figure out how to pull information out of them, but mostly because I need a visual. So I built one.

    I'm wondering:

    1. How do I know what is in which grid?

    2. I added another row of 5 level icons, I now have room for 30 levels, do I change Y 26 to Y 31?

    3. I have 7 more items that the player will collect (8 total including the gold stars), but never more than 3 in any level. The next level the player will need to collect apples and oranges. How do I edit the array for the other 7 items, especially when the player will be collecting more than 1 item?

    Hope I'm not asking to many questions.

    Thanks again.

  • for arrays, x is the row (or width) and y is the column (or height of each row).

    so the answer to the second question is yes, increase the array width from 26 to 31.

    then you need to decide exactly what data you want to store for each level. If it will never be more than 3 items, then you could just use three columns and then it is up to you to decide what item is in each column for each level. Or create 8 columns where each column is always the same item. It wont make a difference, so which ever way is easier for you will work fine. And you could add additional columns for any other data - best time, date, how many times the player has played that level, etc...

    row 0 in the array is reserved for the other global variables that you wanted stored in local storage

    To read data out of the array, it will always be Array.At(currentLevel,itemColumn)

    so if Gold Stars is always in column 0, apples in column 1, oranges in column 2, you would set or read data from the array like this:

    Gold Stars collected in level 2 = Array.At(2,0)

    oranges collected in level 3 = Array.At(3,2)

  • AllanR,

    Thank you for all this attention

    So would that be:


    system > goldStar = 5

    system > apple = 6

    add action Array > Set value at (currentLevel, 2) to 1

    add action Array > Set value at (currentLevel, 3) to 1

    localStorage > set item 'GameArray' to Array.AsJASON

    Or am I way off?

    I don't need to record the items collected, I only need the array to store that the items had been collected and to make the stars appear - like and on / off switch.

    Thanks again.

  • hey there if you have template for level stars load and save stars,scores for each level..please do send would be much helpful...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)