remember what happened on map screen after finishing a stage/battle (ala SMB3) [noob]

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By w32.deadcode
:warning: Old Version Published before Godot 3 was released.

Hi, it ocurred to me that i don’t exactly know how to make an active map screen, like, say, the one in Super Mario Bros. 3. Of course having your character move across paths and selecting stages is not so difficult, however, say you have these ‘moving events’ like battles against hammer bros. or warships.

The game has to remember where they were on the map after you finish/lose a stage or otherwise their position would get reset constantly.

I came up with some solution, but find it very wonky:

Have some sort of array/list thingy in a global script that contains all events and their positions - it gets uptated when entering a stage and then when you leave back to the map it respawns all enemies according to that array.

However, something just keeps telling me that it is an overly complicated solution to a simple problem that’s just a side effect of me being a beginner programmer :stuck_out_tongue:

So, ummm, does anyone know a simpler/more efficient/pRo0O way to implement this?

I imagine being able to keep the state of the mapscreen scene without throwing it from memory each time the you switch a scene but i dunno how to do that.

:bust_in_silhouette: Reply From: eons

To know how to manage things write in paper what things the map needs to know, what the levels need to know, and try organize, could be on files, using a general manager, using the maps as managers…

But paper and pen will be always your best friends.

Now more on topic.
In the case of SMB3, it has a persistent UI at the bottom, then the map and the levels on the same space…

I can think of:



When enter a level, remove MAP of the tree and store in a variable, global or in UI or a utility node, then load the level.

Inside level:

    |-PLAYER (or inside tilemap?)

When exit level save something in a file/variable like if has special unique items, also if finished, and delete the level, then reenter MAP to the tree, updating changes (unlocking paths, change level icon status).

Don’t forget to abuse the capacity of Godot to make super quick prototypes and try all the crazy ideas you have without overthinking, in some proptotypes you may get some cool partial solutions that can be turned into scenes to use/merge later.