0 votes

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 :P

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.

asked Dec 7, 2016 in Engine by w32.deadcode (15 points)

1 Answer

0 votes

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:

Overworld:

root
|-UI
|-MAP

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:

root
|-UI
|-LEVEL
    |-LEVELUI
    |-TILEMAP
    |-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.

answered Dec 7, 2016 by eons (7,764 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.