Hi!
I’m making a platform game for an event and the idea is that at the end of the game you can save your score, time and type your name. Something similar as the image below;
I did find here some tutorials for the higher score, but not for saving it with your name.
You should probably use structure variables for that, eg:
Highscore.1st.score
Highscore.1st.name
Highscore.1st.time
Then when a game ends, if the current score is better than the stored highscore, ask for a name then replace the values.
Give it a shot and let us know where you get stuck.
This is old post but I have the same problem and I cannot figure it out with this structure variables… I’m really stuck.
In my game I have working score/highscore but text input name is the problem. So I just want to show highscore + name that was typed at game over scene…
Can anyone just write simple example for this? Thanks
I have a hard time wrapping my head around the structures too… I’m sure if I bang my head against the wall enough it will stick, but I can’t seem to visualize how those structures fit together. Maybe if you can get it working you can write an example
If you already have the high score working for the number, I think you could also just make another text variable to hold the name and store it/retrieve it in the same way you do the high score. Pay close attention to make sure you use the proper conditions/actions for numbers or text when writing/reading the storage.
There’s probably a better, more efficient way to do it, but I’ll leave that for a better mind to explain
If you have trouble it’s always useful to show the progress of your work so the people troubleshooting can see what you’ve tried and help you find the best solution to fit your goals.
Yes I tried that way, but as you mentioned it’s different for score(number) and name(text), especially when is gonna text input promt appear, it doesnt work for example if I put as condition Score > Variable(score) do text input promt…and many more problems…
First of all, you need to read the variable before changing the text.
And also, if your variable is text, you need to use the action “Read a text” and not “Read a value”.
Now when I make a new highscore I can type (but cannot see letters?) and press enter. On main menu that name appears!
But when I don’t make a highscore , old highscore disappear from Game Over screen (now it is all 0000) and also when i go back to Main menu scene, it is also 0000 without old highscore…
You need to change the highscore only if it’s higher than the previous one.
And beware that score is not Score.
Also, the scene variables are for scenes. If you want to use a variable across scenes, you need global variables.
I recommend you to read the intro to GDevelop Basic game making concepts: What you need to know to start with GDevelop [GDevelop wiki]
I see that when “end” exists in storage “save”, you change the text of Highscore, then read the value and store it in variable(score). Maybe it would make a difference if you reversed the actions associated with those conditions?
Also, as a personal recommendation I would change Score and score to something different. It seems like it would be easy to get mixed up there. Maybe use something like current_score and saved_score to make it a little easier to trace whats going on.
If player get max score and write name at the end, everything is fine, it shows on main menu screen. When I exit game and reopen that name and highscore still remains. That is absolutely fine.
The point is - The only thing that is not working is when player doesn’t have max score in game, text promt isn’t showing (thats good) but when I click exit (to Main menu) previously stored name, at the side of highscore, disappear, but highscore remains…?!
+
Letters are not visible when player types name…
You could try as gruk suggested to change the scene variables to global variables so they will persist between the main menu and the game scene.
To make the letters visible when player types you could try a condition like “if key is released” with an action to change the text of namehighscore to the text of namehs. Or you could just use it as an action with no condition attached to it.
Uh I tried everything you guys mentioned but the problem remains. I am so tired.
I will post a code, and if anyone can look at it and see where is the problem, I would really really appreciate it! Thanks
EDIT:
I’ve done it! I just added at the begining of the Game scene - activate capure input NO. So only if Score > Highscore then activate capture input YES. Thats all, lol…
If anyone need this I can share screenshots…
Thanks everyone, you are all very kind! <3
Thanks for your special contribute. Can you condivide me yours screenshot of your project? I’ve need a help because I’m learning now to create a game on GDevelop. Thanks you.