Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
0 Welcome to the quick introduction to programming. 1
If you're a beginner, then definitely don't skip this. Since we will be using code to implement various 2
systems, 3
it's always a good idea to get up to speed. 4
All of the code will be in GDScript, 5
Godot's native scripting language. 6
Let's look at the core building blocks and how to use them to create more complex functionality. 7
First, I want to mention that all of these examples are available in the downloadable project in the 8
course. If we look at the variables scene: 9
We have the script, by the way. 10
We will discuss first about variables. 11
Variables are used as data containers. 12
They can store numbers, strings and even more complex things as objects, materials and whatever 13
the developer needs. 14
They do come in more shapes and sizes. 15
Usually when creating a new variable, it can store only one thing at a time. 16
This is good for values like hit points, damage, speed, etc.. 17
When we are discussing about variables, a core concept is called a "variable declaration" and that one 18
means to let the engine know that we are creating a new variable. 19
The declaration goes like this. 20
Var which is an operator and then the name of the variable that can be whatever you like. 21
I'll just keep it: "a" 22
So by doing this 23
"var a" I'm actually specifying that hey, I want a variable called a from now on so I cannot use it 24
before this. We can also initialize the variable when we declare it by putting an equal and then putting 25
a number, a string or an object. To display the variable in the console 26
we can use a handy function called print() and then in its parenthesis as a parameter we can specify 27
a 28
in this case. We can try it by pressing f6 and of course we will get five because that's the value contained 29
in the variable E. 30
Now let's look at the string and the string is very similar. 31
You can see we can just call it string. 32
By the way, we can specify the type of a variable by adding colons to it. 33
So if I say: string. 34
Then this variable will be a string. 35
Why is this important? 36
Because if we want to assign later another type, then we will get an error because only string is available 37
for this one. 38
Keep in mind that if we don't put this, then we can assign whatever we want. 39
But this will create confusion 40
later in the code. A float variable means a number that has decimal points. 41
For example, PI, which is 3.1415 and so on and so forth. 42
When we need a list of elements, let's say a list of words we can use lists. 43
Lists or arrays are also variables. 44
The main difference between them is the fact that they can store multiple values chained one after another. 45
They are good to store groups of items like inventories, enemies, projectiles. To create an array 46
we can declare it as a regular variable and then just use these brackets. 47
And we have an array. 48
We can also initialize the array as it's here with different values separated through commas. 49
Keep in mind that to reference a particular value in this way we can just say array and then in the 50
same brackets we can just specify the index starting from zero, which would be one in this case, one 51
and two, which would be three. 52
So this is 0, 1, 2. 53
We can also get the size of an array by calling array dot size and this will return three. 54
The array also can be passed, but that is for later on. 55
Another type is also vector2, which is a Godot type and vector2 stores, a pair of values x 56
and y. 57
We can define it like this. And to call it we just say "vec" because that is the name of the variable. 58
And vec.x or vec.y 59
Of course there is vector3 and more. 60
You can find all of the types supported by the GDScript in the link down below.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.