The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

Hi everyone !

I'm working on a game in which you can collect three collectibles in each level, it's a system similar to the Star Coins you can find in New Super Mario Games.

I made a script for the Star Coins which emits a signal to a LevelScript every time a Star coin is collected and updates the GUI depending on which one is collected.

At the beginning of each level I set the value of each Star Coin is_collected to false and it works fine.

My problem is : I would like my game to store the collected Star Coins for each level, so that the player can later restart the level and get the ones they missed. And currently it is not the case, as the amount of collected Star Coins are passed on to every level.

I am not sure how I should proceed : I've read online that making a list, store each Star Coin ID then check which one is collected might be the solution. I'm currently trying to implement this but I feel there is another, more dynamic way to solve this issue. That's why I'm posting this question.

I haven't provided the code because I don't find it relevant for this issue, but I'll gladly share it if required.

Thanks in advance for your help!

Godot version 3.4.4
in Engine by (17 points)

1 Answer

+1 vote
Best answer

I also believe, that stable dictionary is the way to go. I can't see how dynamic is it supposed to get, since the problem is just about storing stale data.
This single dictionary should reside in highest scope of your project, eventually in autoloaded script, because it should be possible to access from every level and menu.

by (8,188 points)
selected by

Thank you for answering, I'll try to see how to implement that into my code and see how it works.

Thanks a lot!

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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.