Achievements & Skins!
One of the pillars of Moon Cheeser is the achievement system. During to the nature of the game being action based and an infinity runner, which doesn't have objectives other than keep avoiding obstacles and scoring, I thought about adding an acheesement system. Since the very beginning of the Moon Cheeser's design I saw the need of giving objectives to the player and this week after the core gameplay mechanics being implemented, I started to work on the achievements. That's how they work:
- A .json file keeps all the info about the achievements
- A singleton reads the .json file and keep the info inside a dictionary
- The game objects emit signals to that singleton so it can update the data
- After each game over the dictionary is written again in the same .json file, overwriting it
- Every time the Achievements scene is open this file is read again by the singleton so it read the updated content
To match the overall concept of the Achievement scene (which also include the available skins) I divided it into 3 sections
- The top one which will only serve as a back to the title screen option
- The bottom one which is where the achievements and skins are displayed
- A hidden dialog which will popup to indicate the info gathered by the achievements singleton
With Godot's Control nodes it was an easy task to structure everything.
The flow of the Achievement screen goes as follows:
- Every achievement button passes a signal to the achievement handler (the ScreenMargin node)
- This signal tells which achievement should be read in the achievement singleton
- The achievement handler gather the data and sets the dialog node's (an AcceptDialog node) text and title
- The text follows a simple structure:
- It takes the description of the achievement (used in the .json file)
- Concatenates it with a string "and you already accomplished"
- Then take two placeholders one for the current accomplished amount and one for the total
As I said, all the data regarding to the achievements is stored in a simple human readable .json file. To add or remove or modify an achievement I just have to mess with this file and in the case of new achievements I just have to connect a signal to the achievement handler passing the name of the achievement to be retrieved. This is how this data is structured:
In addition to the acheesements there will be many unlockable skins, which will require some accomplished achievements to be unlocked. It is as simple as the achievements.
There are hidden nodes in the Achievmeents Scene which will only be shown if the needed achievements are completed. For every skin unlocked the respective button will be shown. When clicked this button will change the default skin of the object it modifies, which it stored on a skins singleton which also reads a .json file to know which skins will be shown and which resource should be loaded by them.
The data is structured like this:
Ok, I'm not a data manager or anything like that, so they might be structured in some weird way :c
You can check how does it work in game by watching a demo at my vid.me:
That's all for now guys, sorry for being late this week I was participating in LD#39, you can check my entry at UNTRUSTY page. That's it, keep developing and until the next time <3
Get Moon Cheeser
Leave a comment
Log in with your itch.io account to leave a comment.