(P.S, dont let the length of this reply scare you, its not as hard as it looks, its just that you said you were a beginner, so i dont wanna tell you to do a bunch of things you dont even know how to do in the first place)
Timer actions are located here.
However, I highly recommend the extension “Repeat every X seconds”.
To add extensions, open the Project Manager via the hamburger icon in the top left (its 3 horizontal lines)
Then hover over the plus next to “Extensions” and press it.
If you use the search bar at the top, you can find it quicker. Click on the extension in the list, then click “Install in project” on the top right.
select “Add condition” in a new event. When the modal appears, click “Other conditions”. It will be right there under “Repeat every X seconds”. Then, use the condition “Repeat with a scene timer”.
It doesnt really matter what you name the timer so long its unique, but i recommend typing something that is related to its function. Like, “scoretimer” for example.
Then, put the number 1 inside of duration in seconds.
Press Ok in the bottom right corner.
Now, lets make the variable for the score. I’m unsure if you want this to be a scene variable, or a global variable. Global variables can be accessed in every scene and maintain their information, while scene variables are set per scene, and get reset to their default values when the scene is exited and entered again. I know that in terms of programming, its frowned upon to use global variables everywhere. I however, break this rule for GDevelop, as its much quicker to access global variables via the Project Manager as shown in this image:
If you wish to use scene variables instead, click on the 3 dots next to your scene in the Project Manager instead, and press “Edit scene variables”. The menus and followings steps will be the same whether you used global or scene variables.
Lets define a new variable named “gamescore”.
Press either of these buttons to add a new variable.
In the first field, set the variable name to gamescore. In the second field, “Number”, it is already correct at its current setting. I am unware of your programming experience though, and so i will briefly explain types of variables.
Text: Stores strings, which are for example, paragraphs, or words like im typing right now.
Number: Stores only numbers
Boolean: Stores either true or false
Array: Stores multiple unordered variables within itself with their own types
Structure: Similar to arrays, however, you can change the names of the child variables.
Now that thats out of the way, just leave it as number.
Press apply in the bottom right.
Our events as of right now should look like this.
Press “Add action”, and press “Other actions”.
Select “Variables”
At the bottom of the list you just expanded, press “Change variable value”.
In the “Variable” field, select the variable we made named gamescore.
The “Modification’s sign” determines whether or not were setting the variable, adding to the variable, subtracting from it, multiplying it, or dividing it. Were adding to it, so change that to the plus sign.
In the last field, simply set that to 1 as well, as you want to add 1 the score every 1 second. Now, press Ok.
When you run the game, everything should be working. However, it probably wont appear to. This is because you likely dont have a text object to visualize the score with.
Press the tab at the top of your screen that isnt labeled “(Events)”. This is the scene editor, it lets you see, navigate, and edit the scene’s objects without using code or previewing the game. Its also where we create new objects. Right click on the viewport of the scene editor and select “Insert new…”
This is the “New object” modal.
Select “Text”. At the top of the screen there will be the field named “Object name”. You should set this to something like “ScoreText”. The default settings will be fine for now. You should now see it in the middle of the scene. Select it with your mouse and drag it to a place within the scene you would like it to be.
Look to the bottom of the screen for the “Layers” panel, and select “Add a layer”.
Name the layer something like “hud”, and now select your object in the viewport again (it will be highlighted in a blueish purple color. Note that ensure the layer at the bottom of the screen isnt also in blue, because that means the layer is selected, not the object, even if the object remains blue. Just select the object with your mouse again to select it).
On the left side of the screen you will see the “Properties” panel.
Do you see where it says “Base layer”? Click that, and select the hud layer we made from the drop down.
Now, the score text will always stay on the screen, no matter what it done on the base layer, which is where your game will be.
Now, go back to your events. Under the event we made before, add a new action after the variable change.
This time, select the ScoreText object. On the panel on the side, at the very top of the list, select “Text”. This is similar to the Variable action we set up earlier. This time, leave it to the equals sign. Set the value in the “Text” field to "Score: " + gamescore
This sets the contents of the text object to say Score:, a space, and then it appends the gamescore variable we made earlier.
Now run the game.
Its working! But you may notice an issue. It says “Text” before it changes to its actual value. This is because text objects have a default value, and the Repeat every action only does it every second, so it waits 1 second before doing anything when the scene starts.
There are two ways to fix this, either changing the default value of the text, or setting it at the beginning of the scene alongside the Repeat action.
Approach 1: Changing default text value
Go back to the scene editor, and double click on the text object. You can double click on either the text object that is in the scene, or on the side in the “Objects” panel.
In the “Initial text” field, set this to “Score: 0”, which emulates what our code would do if it ran at exactly the beginning of the scene. Then, press Apply like earlier.
Approach 2: Do it in code
Create a new event, and click “Add condition”, and go to “Other conditions” like earlier.
This time, press “Scene”.
And under scene, select “At the beginning of the scene”.
Now, just click on the action that sets the text value in the other event. Then, press Control+C to copy it.
And then, when you hover over add action in the other event we made, you will see next to it “(or paste actions)”. Press that, now the other action is pasted inside that event too.
Do you see the little rectangle on the left side of all of the events? this lets you change the order of the events, which can be very important in coding. Since this is at the beginning of the scene, it should be at the top of the event sheet, so hover your mouse over that rectangle, and drag it to the top. Now if you run your game, everything should look right.
Let me know if you have any more questions or you get stuck on something!..or if i over-explained and youre actually a world class game developer.