Hello, everyone! Who is ready to build an awesome game, with amazing graphics, stellar audio, and...
Actually, it's not like that. This is actually going to be a math game.
Oh, you hate math?
Don't worry, the code is going to do all the math for you, except for when you are playing the game. Besides, we are going to cover a lot today!
And, if you really don't want to do any math, even to play the game, you can show it off to someone else and have them do all the math. :p
Additionally, once you learn this, I will show you how to move a player character. =)
Now, we could go in and create a new project, but the thing is, we already have a project that has everything we need in it.
Open Godot, and open the last project you made, the one with the three nodes under the user interface. Now, most of the game is already done for you. You already know most of what you need for this game already- how cool is that?
The object of the game is to answer the math questions that are in the label's text. If you get the correct answer, something good will happen.
Simple!
Now open up the script, and below extends and above _ready(), add these two variables:
var number_1
var number_2
Next, we have to put these numbers onto the screen. Do you remember how to do that?
In the ready() function, underneath the rest of the code, add this line:
get_node(number_1 + " + " + number_2).
Now, if you remember, we had an error last time we did this. If you went on that field trip I sent you on, you would know the way to do that is to add str( before each number, and ) after each number, so your code would look like this:

Now press play. Since you have already saved and set this scene as the current scene, it will simply open.
And, the answer we get is this:

Wait, null? Why is it null?
Simple- we didn't give number_1 and number_2 values yet. If you reference a variable that doesn't have a value, the code will automatically return null.
So, let's give number_1 and number_2 any values you want them to have. We can do this in the ready() function.
Okay, so add number_1 = whatever and number_2 = whatever at the bottom, and press play...

Wait, why is it still null?
Order of operation matters here. You did not tell the program to change the values of number_1 or number_2 until after you printed them on the screen.
To fix this, move the values of number_1 and number_2 above the line of code that prints text to the screen, sort of like this:

Now it should work!
Okay, but now what? If I type something in and press the button, it simply changes the text to whatever I typed in the line_edit... Let's change that.
So what do we want the code to do? We need it to check if the sum of number_1 and number_2 equals the amount displayed in the line_edit.
We need the code to do something, like a function.
How do we make a custom function?
Luckily, this is very simple.
underneath the ready() function, and make sure, this time, that it is not indented, typefunc give_amount():
. We will need two parameters in this function, and we can call them no_1 and no_2, like this:

Don't worry about the error message, it will go away once we add our lines of code.
So, what do we need this function to do?
Check if the sum of number_1 and number_2 equal the sum displayed in line_edit.
How do we do this.
Note the statement, "Check if the sum of number_1 and number_2 equal the sum displayed in line_edit." It's a question.
A code can answer a question using an if statement.
How do we do that?
Type in if str(no_1 + no_2) == line_edit.get_text():. Why put str() around both variables, can you do that? The variables both have to be turned from numbers to strings, so this does work. It should look like this:

Wait, the error is still there.
Actually, it isn't there anymore, it was replaced with a new error: Expected an indented block after"if".
That means we have to indent before adding code underneath it in order for the code to work.
To keep things simple for now, we will have the label's text changed to "You Win!" if you get the answer right.
Now, we need to have the signal for the button use the function. How do we do that?
In order to have a code call a function, we simply have to write out its name, and give it the amount of parameters it asks for. no_1 and no_2 will take on the values of number_1 and number_2, like this:

Yay! It works!
However, this is the most boring game I have ever played. Each time I open it, it gives me the same math problem!
How do I randomly change the numbers for the game?
That's my challenge for you: go figure out how to randomly generate numbers.
I'm kidding. B)
We need to use rand_range.
How do we do that?
Let's make a new function called generate_numbers(). In that code, we need it to return a random number, so we use the return function. After that, we need to change number_1 and number_2 into random numbers, as shown below:

And now, when we run this...

What the bubbles?
Here's what's going on. These are the docs for rand_range:

So, what does this mean?
A floating number is a number that has a decimal point.
Okay, so how do we change a floating number to an integer value?
That is my challenge for you.
And this time, I'm being serious. :)
However, there is still one other itty, bitty, problem... The randomly generated numbers don't change.

Now go out and fix the last issue, and the game will be done!
I know this was a lot to go through in one tutorial. It is less about getting the tutorials done, and more about taking the time to understand them. Don't feel as though you have to rush through them.
Additionally, if you have questions, don't be afraid to ask in the forums. The people here, including myself, will be happy to answer your questions.