High score screen plus write your name


#1

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;

free-enh

I did find here some tutorials for the higher score, but not for saving it with your name.

Thanks!!


#2

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.


#3

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


#4

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

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

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.


#5

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…

I just don’t know how to do it…


#6

If you don’t mind sharing what you’ve tried so far, perhaps the community can help find where the bug is :slight_smile:


#7

Ok here we go…
This is GAME Scene and events for score…


and for highscore…
And it works, its always on the game screen…

Okey, that is working, and I don’t want name to be shown on GAME scene.
When game is over and if Score > Highscore then type name and save to memory…

Then on MAIN MENU SCENE I want to show that name at the side of high score (see XXX)…
mainmenu
but its not working…

This is the events for MAIN MENU SCENE

I’m stuck. I know that it needs more than this, but I can’t figure it out…


#8

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”.


#9

I think I made some progress.
Thanks a lot! But…some problems still exists

This is GAME events:


and

This is MAIN MENU events

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…

Any ideas?


#10

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 http://wiki.compilgames.net/doku.php/gdevelop5/tutorials/basic-game-making-concepts


#11

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.


#12

Thanks for quick reply!

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…


#13

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.


#14

Hi
i do it that way.


This is gd4, but i think it same in gd5. Use text name with number, i remember dont work otherwise.
If any help.


#15

RapaGameZ have example and i but player name same way.


#16

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