Download

How to enable buttons in menu when a level is completed

Hello, I am making a 2D platform game for Android but I’ve got some problems. My game has a select level menu like this. You can only play level 1 because the 2 and 3 buttons are disabled.


When you play and finish level 1 you automatically pass to level 2 and so on. My main problem is how to change the menu’s buttons to get enabled and change opacity when you complete a level so when you exit the game and open again, in this select level menu you can select the last level you were playing.
Lets say you open the game for the first time and get to level 3, then you exit the game and the next time you play you go to this select level menu and you can select the last level you were playing and the previous ones as well. I have a save game blueprint which is working but I dont know how to make it work to change the appearance of this select level menu. Any ideas?
Thanks!

Use a SaveGame object to save the last completed level. When new level or new game, it reads the saved game, and enables the corresponding buttons.

Yeah but I can’t cast to my blueprint widget menu from the SaveGameObject. Any help?

Just read the saved level in the widget.

For example, I have 4 buttons. one is always enabled, the other 3 are disabled. So, in the Construct Event, I read the saved level and enable all buttons that correspond to levels that are <= level:

My level selection menu:

Enable buttons depending on the saved level:

Sorry for the delay but I’m still unable to make this work it out, could you show me your blueprints where you save the game and read the different levels? Thanks in advance :slight_smile:

The save game object have one variable - level, that’s going to store the current level number. When game over, just save the value of the current level in a game object:

](filedata/fetch?id=1796394&d=1596468194)

To read the level, it’s just like in my previous post, where the level was read in the menu widget BP.

What exactly are you having problems with?

First get the save/load system working. Then the widget.

Are you familiar with how to load/save game objects? If not, then I suggest to go through this very good 10 min video: https://www.youtube.com/watch?v=_4usRrTiqak.