Learn GDScript From Zero

Now you've learned about Godot's interface and how to create a project, you're ready to start learning GDScript, Godot's programming language.
If you're serious about making games, you have to learn to code. There's no way around it: It's the only way to have full control over your creations.
Learning to code can be intimidating, and it's easy to get discouraged. So, we created a companion app to help you learn GDScript.

What is GDScript?

GDScript is a programming language designed by the Godot developers, for Godot. It's tightly integrated with the engine, so it's pretty efficient to learn and code games with it. At the same time, it's part of the C family of languages (like C++ and C#). So, many programming techniques you'll learn with it transfer to other languages.
Doesn't GDScript look more like Python? Isn't it part of Python's family?
If you have programming experience and look at GDScript's syntax, you might think it looks closer to Python than to C++ or C#. However, the language's concepts are actually more like C++. GDScript code maps more closely to the imperative and object-oriented C++ code you'd find in the Godot engine.
GDScript is what we call an imperative and object-oriented language. Every file in GDScript is a class; there's no way around that. This differs from Python, where code is organized in modules.
It's in this sense that I consider GDScript to be part of the C family of languages. I'm looking at the language's paradigms and concepts, not just its syntax. If you added brackets to GDScript, it would immediately look and feel closer to C# or C++.
Now, many general-purpose languages support multiple coding styles and features, so they end up having similarities even if they initially had more differences.
The key takeaway here is that if you're new to coding, the concepts and techniques you learn with GDScript will help you learn other languages in the C family tree. Your knowledge will be transferable.
Because programming is about solving problems, your programming skills are not tied to a specific language. Once you learn to think like a programmer, you can apply your skills to any technology, and picking up new languages takes less and less time.
At the same time, most learning resources for Godot focus on GDScript, so it's the best place to start.

The Learn GDScript app

This app will teach you the GDScript language syntax. It'll also teach you fundamentals that tutorials rarely cover.
It's a course in the course (and it's made with Godot)! You'll learn about variables, functions, and other programming concepts. But you'll also learn about the mindset you need to become a programmer.
For example, errors are your friend in programming, not a sign of failure. Also, as programmers, we're never entirely on our own: we constantly build upon other programmers' work.
The app pushes you to practice because that's how you'll truly learn to code. It's not enough to read about code: You have to get your hands dirty.
And if you ever feel stuck, don't give up! You can ask us questions at the bottom of the page if you need.

Let's get started!

The app is below. It runs in your browser, so you don't have to install anything. Click the icon at the top right of the app to make it fullscreen.
Learn GDScript App
Go through every lesson in the app. Once you complete all lessons and their practices, you can move on to the next lesson, where you will create a ship you can control with the keyboard.
The app runs slowly on my computer
In the browser, if you have a relatively old or a not so powerful computer, the app can be a bit heavy to run.
If that is your case, we also provide desktop releases of Learn GDScript From Zero. The desktop versions run faster than the browser one.
You can download it for Windows, Mac, and Linux here: Learn GDScript From Zero - Desktop versions

Lesson Q&A

Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.

  • Not a question, just an encouragement for othersBartek PatoletaI did "Learn GDScript From Zero" about 1 month ago before buying this course. It took me about 10 days to master it (if I remember correctly) and I was learning like minimum 4 hours daily! Now it feels good opening the app again and using for loops in module 5 to draw squares even if you wasn't supposed to. Everyone will get it If you spend enough time with it. 11 13 Mar. 18, 2024
  • Going trhough GDScript twice.Mauri090Not sure this is the best approach, but I have a hard time learning code, so I'm going through this module a second time, this time doing it at a slower pace, really trying to understand each lesson. I think I understood around half of the module the first time around, if I get to 70% during the second run, that's already a success for me :D. Do you think it makes sense to move on, even if I didn't understand everything from this module? I feel like it could be demotivating if I'm not advancing to the next lesson eventually. Thanks. 4 5 Mar. 05, 2024
  • Lesson 21 Functions that return a value IS SO CONFUSING :(PepeGazzoI'm a complete begginer, and bought the GDQuest bundle yesterday, and am really hyped with learning Godot. The online app works wonders, but until reaching Lesson 20 onwards, everything got confused. Please help me. The tutorial says the following: > In previus lessons, we had characters walking on grids. And for those practices, you were working directly with cell coordinates. Well, cell coordinates don't correspond to positions on the screen. To find the center of any cell on the screen, we need to convert the cell's coordinates to a position on the screen, in pixels. > > To do so, we use a function. The function does tho things: > > First, it multiplies the cell coordinates by the cell size, which gives us the position of the cell's top-left corner on the screen, in pixels. > > Then, we add half of the cell size to get the center of the cell. > > And the code example is the following: ```gdscript var cell_size = Vector2(120, 120) func convert_to_world_coordinates(cell): return cell * cell_size + cell_size / 2 ``` I don't understand the logic behind points 1 and 2, and it's really frustrating. It feels like when approaching Lesson 20 onwards, the app isn't as beginner-friendly anymore. A lot of questions come to my mind. Why and / or how is the cell_size, that is a Vector2 suddenly in pixels. I thought vectors have coordinates. Why does it show us the top-left corner of the grid? Why does adding half its size show us the center? I would really appreciaty any insight here, for I'm really struggling in the last lessons of the app. 6 3 May. 17, 2024
  • Request to add Korean to Lesson app.tahookiHello, I am a developer living in Korea. Recently, I made a payment to GDQuest to study Godot. I can easily study other pages because they are translated into Korean. In the case of the game on this page, it seems a bit disappointing that there is no language selection. Of course, I can study somehow, but I would like to request that Korean be added to the language selection! 3 2 Feb. 14, 2024
  • Dictionaries with Vector2 and Loopinghefty-alpacaHi all! I'm having a bit of a mental block on how to understand syntax for looping dictionaries using Vector2. In Lesson 26, we have this dictionary: ```gdscript var unit_cells = { Vector2(1,1) : "X" Vector2(2,1) : "Y" } ``` And then this for loop: ```gdscript for cell in unit_cells: var unit = unit_cells[cell] add_unit(unit, cell) ``` In regular for loops, the numbers go from 0, 1, 2, 3 etc. But in this case, the cell becomes Vector2(1,1) instead of 0, and Vector2(2,1) instead of 1. Why does that then mean that unit_cells[cell] == "X", instead of unit_cells[cell] == Vector2(1,1)? To me this is kind needlessly complex, so I'm wondering if there's a "simple" way to imagine this. 4 2 Feb. 07, 2024
  • Order to code a function?hermesSo I was doing the second practice exercise on lesson 14 and was struggling a bit to get the solution. Turns out I had put the damage reduction code in the wrong section of the take_damage function (I put it at the bottom, solution had it at the top). My question is: why can't I put the damage reduction code on the bottom? Is there a hierarchy of where to put certain code or am I missing something? Thank you to whoever answers this in advance! 3 2 Feb. 05, 2024
  • Lesson 22OuterMarsLast time i did this i was stuck on Lesson 22 for a few days i'm glad i didn't just skip over this module even tho i already did it. The difficulty spike was still insane but i feel like i actually understand these things way more the second time around. Not really a question i know but if your questioning redoing this section you probably should to be on the safe side and see how you've improved. 1 1 Oct. 20, 2024
  • Learn to code from zero with godot 无法使用谷歌翻译全文lokiand我的英语不太好,看全英文还是很吃力。my english is not good, it is very difficult to read at english. 1 1 Sep. 21, 2024
  • You don't have to use the embedded versiondannycanham[https://gdquest.github.io/learn-gdscript/](https://gdquest.github.io/learn-gdscript/) 1 1 Aug. 15, 2024
  • Suggestion: Option to make quiz answer positions randomizedRhyzetticJust as a suggestion: Since many users like going through this app more than once, it would be nice if the order at which the answers are listed in the quizzes could be randomized each time. For me personally, it has been a very helpful memory refresher to sometimes come back and do the quizzes and practices of certain parts. A small issue is that I started to remember the answers by position after a few times and randomizing the positions would increase the long term effectiveness of the quizzes. I understand however that these answers are sometimes ordered in a deliberate way to be easier to digest for first time users. Therefore I think it would be best to make this a "Randomize Quizzes" settings option and simply make users aware that the option exists when the quizzes are introduced. The same could be done for quizzes on the website, by adding a "Randomize Quizzes" checkmark somewhere. Ps, it would also be incredibly helpful to create an (repeatable) "exam" type test for every module, which purely gives you quizzes and practices to solve. This could provide for the randomized quizzes instead, making a toggleable setting less needed. Keep up the great work! 1 1 May. 18, 2024
  • Great way to learn the basics but it can even be betterNekrysGiving us a TLDR of what was used and its functionalities would be amazing. I started compiling the info I found the most important while doing the lessons, but I feel like having a cheat cheat available at the end would be perfect. 1 1 Apr. 20, 2024
  • What "while crates:" does?FernandoIn the second practice of lesson 22 it says we can use "while crates:" to verify if the array "crates" still has value in them. But I got a little confuse and would like to know how exactly such a simple code is doing that. Like, is something exclusive of arrays? Is Godot doing something behind? Is has something to do with ".size"? And so on... 2 1 Apr. 09, 2024
  • Loops Lessons EXTREMELY confusing DonEccI would appreciate a little more details in writing code for both the "while" and "for" loops. It says the "for" loops are easier. The way this lesson was written (it just throws you in without much explanation- even the actual explanations feel bare-bones), it doesn't feel like it. 9 1 Mar. 18, 2024
  • Lesson 17 Practice 2StonemonkeyWhy doesn't range(2) create 3 squares? Shouldn't it make a list/array of [0,1,2], causing 3 iterations of the for loop? 1 1 Feb. 21, 2024
  • Advantage of naming temporary variables?CornflakesHey there, in the exercises about for loops, the example solutions always give the temporary variables a proper name. Here's an example: ```gdscript func run(): combo = ["jab", "jab", "uppercut"] for animation_name in combo: play_animation(animation_name) ``` These for loops work just as well if the temporary variable is always something like "each" (meaning "each value in the array"): ```gdscript func run(): combo = ["jab", "jab", "uppercut"] for each in combo: play_animation(each) ``` So my question is this: What is the advantage of giving a unique name to these temporary variables? Currently, I only see downsides: - It seems to me that thinking of a name is a cognitive hurdle (albeit a tiny one) that doesn't really provide any benefits. - I even find the code harder to process when I have to read for loops that do not just differ from each other in places where they absolutely have to. Even without a unique name for the temporary variable, the rest of the for loop seems to tell me what it does just fine. What am I missing here? 4 1 Feb. 14, 2024
  • Lesson 25 Practice 2rifqilubis ```gdscript func run(): for cell in unit_cells: var unit = unit_cells[cell] add_unit(unit,cell) for cell in units: var unit_type = units[cell] place_unit(cell, unit_type) ``` The question are, which one is the right one? the above put value first the below one, put key first. the practice gave me an error if i put value first. im talking about `add_unit()` and `place_unit()` function. 3 0 Nov. 28, 2024
  • Practise with Functionsglorious-snailHi there, I've had quite alot of trouble with functions, parameters and getting my head wrapped round them. I've eventually written this after looking at a few comments here but I'm wondering if this would actually be valid: ```gdscript var base_attack = 10 #Defining a new variable as base_attack. The variables value is 10. ``` ```gdscript func upgrade(levelup :int): #Creating a new function called upgrade. The parameter is levelup and it is a integer ``` ```gdscript var new_attack := levelup * 1.2 #Defining a new variable called new_attack. new_attack is equal to levelup multipled by 1.2 ``` ```gdscript base_attack += new_attack #Add the original base attack variable to the new_attack variable ``` ```gdscript func run(): #On game start ``` ```gdscript upgrade(10) #Basically defines levelup as 10 ``` ```gdscript print (base_attack) #Prints the new value of base_attack now that levelup = 10 ``` Thank you for your time :) 2 0 Nov. 25, 2024
  • Lesson 5, drawing multiple squarerifqilubis ```gdscript func draw_square(): move_forward(200) turn_right(90) move_forward(200) turn_right(90) move_forward(200) turn_right(90) move_forward(200) turn_right(90) func draw_three_squares(): draw_square() jump(300,300) draw_square() jump(300,300) draw_square() ``` 2 0 Nov. 25, 2024
  • Check or mark as finishrifqilubis When this button will be available or is it in your roadmap currently? Thanks. 3 0 Nov. 25, 2024
  • Lesson 21NormalI have done this module 2 times but still I get stuck on lesson 21 and further, can I skip it for now and move to next module? once i have a better understanding of the concepts or are these things required in next module ? 1 0 Nov. 11, 2024
  • Time deltaNormalI am just not able to grab the concept of time delta, like what's the use of it, can you please explain me that with an application-based example 3 0 Nov. 04, 2024
  • Dictionariesdetermined-shrewI believe that some updating to the lesson around dictionaries might be beneficial. Dictionaries are not ordered like arrays, and this section does give that impression. It might be outside the scope of this section since it does feel geared towards beginners. 4 0 Oct. 13, 2024
  • Lesson 19, Practice 2deadly-goatHi all, In the exercise for drawing rectangles using the for loop, I'm wondering why we need to access the x and y coordinates of the array element, and can't just use the Vector2 directly. More simply, why do we need to set the parameters to (iteration.x, iteration.y) instead of just (iteration), since it is already a Vector2? ```gdscript var rectangle_sizes = [Vector2(200, 120), Vector2(140, 80), Vector2(80, 140), Vector2(200, 140)] func run(): for rectangle in rectangle_sizes: #This works draw_rectangle(rectangle.x,rectangle.y) #This doesn't work draw_rectangle(rectangle) jump(rectangle.x + 100,0) ``` Is it because the Vector2 returns in parenthesis and is therefore only interpreted as one argument in the draw_rectangle function? 2 0 Oct. 11, 2024
  • What's the difference/benefit between cell.x += 1 vs cell += Vector2(1,0)hefty-bisonJust curious about why we might want to use `cell += Vector2(1,0)` as opposed to `cell.x += 1` is this due to using a Vector2 being more clear in terms of type? `cell.x += 1` is more clear to me personally, but am keen to learn why. 1 0 Oct. 06, 2024
  • Question about lesson 5 Practice 2ill-informed-jellyfishSo in Lesson 5 Practice 1 we define the function draw_square and running the code makes one square. In Lesson 5 Practice 2 we define the new function draw_three_squares under that previous function and running the code makes three squares. Why is it not drawing four squares, so one for the "draw_square" function and three for the "draw_three_squares" function. Is there a particularity about this program where it only runs the function related to the lesson and it doesn't run the entire thing? Do I need to imagine that when I run the code here, I am really only running "draw_three_squares"? 2 0 Oct. 01, 2024
  • Accessing values in arraysunited-armadilloIn that exercise I thought I could use ```gdscript use_item(inventory[0, 6]) ``` for example, to add two diferent items, but it turns out that I had to call the function for each item I want to use an item, like so ```gdscript use_item(inventory[0]) use_item(inventory[6]) is there a way to access several indexes of the array in one go in the function, or should it. be done with a for loop? ``` 1 0 Sep. 30, 2024
  • For loop questionunited-armadilloIn lesson 17 of the app, first practice I tried solving the exercise with this code: ```gdscript func move_to_bottom(): for i in range(boadr_size.y - 1): cell.y += i ``` but the solusion was : ```gdscript func move_to_bottom(): for number in range(board_size.y - 1): cell += Vector2(0, 1) ``` My code made the character move outside the board, maybe I'm not understanding something about it, also the solusion doesn't use the temporal var "number". Is it wrong to use the "i" or "number" variable to add to the "cell" variable? Thanks. 1 0 Sep. 25, 2024
  • Can't save progress on two computers?scientific-tarsierI'm trying to do this course on my laptop and desktop, (whichever I have access to) and it's not saving my progress from one to the other. I now have two different versions going and I'm just skipping manually. Is this just a me thing or are other people having this problem? 1 0 Sep. 22, 2024
  • Lesson 21 suggestion: explain Vector2 * Vector2CasimirMorelI think that having the documentation on Vector2*Vector2 operation handy in the lesson would be useful. That operation on vectors is not a dot product nor a cross product, it can be confusing to the more math oriented audience [Vector2 — Godot Engine (stable) documentation in English](https://docs.godotengine.org/en/stable/classes/class_vector2.html#class-vector2-operator-mul-vector2) 1 0 Sep. 20, 2024
  • In Lession 4, does the turtle comes from LOGO?CasimirMorelIt surprised me and made me smile, to see the famous turtle, and wondered if it was a nod to LOGO or if it had other life that led to its appearance in GDQuest 1 0 Sep. 13, 2024
  • Lesson 21 - PracticespxcyJust some thoughts here on lesson 21. I understood the previous lessons pretty well but got completely thrown off when I got to "*Functions that return a value*" and the practice. This was a big leap compared to the previous lessons. It feels like a complex math problem and can't seem to grasp the formula. I feel like I understand functions and how they return a value but coordinates and finding out their size by adding, multiplying, or dividing gets me confused. I did some research and got to understand the steps needed to take to get the correct results but I think I'm going to need a lot more practice to really understand. 1 0 Sep. 12, 2024
  • Is GDScript Open Source ?UtkrishtSince it is made with Godot, I was wondering if its source code is available, I think we can learn more by analyzing the code within it. If it's not available then also no problem, I love your courses btw :) 1 0 Aug. 18, 2024
  • should i do this if i am an experinced programmer?mrelectronHi all, i am profiecent with Java and Go, is this targeted at teaching only programming fundamentals? or does it go over godot and gdscript specifics? as a programmer, should spend my time doing it? 2 0 Aug. 16, 2024
  • How to create a Function.RevHello, first of all, thank you for your courses, which are for me a real springboard in the world of video game creation and learning a programming language. I'm at the beginning of Lesson 9 (Adding and Subtracting) where we create a Function named take_damage followed by a subtraction of health -= amount. Overall, I think I understood the concept well, but I have a problem with your examples. Your examples are quite simple to understand given that they are on an external console with different Functions, Variable, coded beforehand. On the other hand, I find them much less practical for someone who, like me, likes to try to reproduce what he learns to practice. ( I have not found a passage in your courses explaining how to Define a new Function and how to fill in its Instructions ). So I tried to code this example by myself but without being sure of the good result and I would like a correction from you please. ```gdscript var health = 50 var amount = 25 func take_damage(amount): pass func_ready(): health -= amount print(health) ``` In this example, I set the health and amount Variable, followed by the take_damage Function that contains the amount Variable. I then entered the subtraction of health -= amount, followed by print(health) inside the Instructions of _ready() Function to do my Subtractions and Display the result in the Console. It seems to work but I tried to compile my Code differently and I noticed some errors. If I remove the Instructions pass in the Function take_damage I get an error on the line of the Function _ready() telling me "Expected indented block after function declaration." Why does the error appear on the line of the Function _ready() and not on the line of the Function take_damage? And is an Instruction mandatory after the Definition of a Function? Was it right to define the Variable amount beforehand? Correct me if I made a mistake please or if you see a way a simpler syntax for this problem I'm curious to know it. Thank you so much. 2 0 Aug. 09, 2024
  • Will These Parentheses Come Back to Haunt Me Later?RashuThere were a few cases in the practice exercises where I had parentheses in my answer and the solution returned correct, however I noticed that the parentheses were absent from the suggested answer. ```gdscript # My Answer var cell_size = Vector2(80, 80) func convert_to_world_coordinates(cell): return (cell * cell_size + cell_size / 2) # Suggested Solution var cell_size = Vector2(80, 80) func convert_to_world_coordinates(cell): return cell * cell_size + cell_size / 2 ``` Is this fine, or will it go all "Revenge of the Sith" on me later? 1 0 Jul. 30, 2024
  • Do Some Functions Only Accept Specified Number of Arguments?RashuFor example, the use_items function in the code below returned an error that there were too many arguments for the use_items function. ```gdscript # Code I tried. func pick_items(): use_items(inventory[1], inventory[2]) # The suggested answer. func pick_items(): use_items(inventory[1]) use_items(inventory[2]) ``` Additionally, if possible, is there a reason we wouldn't opt into the use_items function that allows multiple arguments? At a first glance it seems like the end result would be the same? Thanks alot. 1 0 Jul. 30, 2024
  • Please make it possible to copy and paste the text in the app.twittoshiIf I can copy and paste the text I will be able to use a translation app to understand the lesson. Thank you for your consideration. 1 0 Jul. 28, 2024
  • Questions about lessons 19 to 24single-dinosaurJust finished this module (hooray!), and I wrote a few questions along the way. Globally modules 1 to 19 feel pretty smooth, and then it gets more complicated. I feel the learning gets a bit stuck at some point. **Lesson 19** The parenthesis [] are not explained for this code : ```gdscript var units = [] var selected_units = [] ``` Is it for the append function to work? **Lesson 21** I found the example a bit complicated to explain how it works returning a value. Maybe an easier example would help. **Lesson 22** Why is this code not working ? ```gdscript func run(): while crate != 0: crates.pop_back() ``` **Lesson 24** Why is "gems" plural and "healing heart" singular ? **Lesson 24 Practice 2** Why wouldn't this code work? ```gdscript func add_item(item_name, amount): inventory["healing heart"] += amount inventory["gems"] += amount inventory["sword"] += amount ``` Thanks for looking at my questions! 1 0 Jul. 26, 2024
  • More Dictionary looping help?OldManBradHello! Really enjoying your course. I am an older C# middleware programmer with some JSON projects I struggled through. *JSON seems similar to dictionaries in your course - so I may be confusing myself.* Having a lot of trouble understanding the Dictionary loop. Here's where I am stuck. I appreciate any help!! In lesson 25, first Practice, there is a line in the solution calling: ```gdscript var amount = inventory(item) ``` What I would expect the amount variable to return is **"'Healing heart' : 3"** instead of only the number **3**. Using the next line in the solution: ```gdscript display_item (item, amount) ``` That would be a syntax error in C# since I assume amount is an int and **"'Healing heart' : 3"** is a string. I do not understand how gdscript knows to use the **value** of the items count vs. the whole label and value together. Any thoughts that might clarify it for me? 3 0 Jul. 25, 2024
  • For loops and 'range()'Sandra MoenIs it convention to use `range()`? I like to write my for loops without it: ```gdscript for i in 3: print(i) ``` 1 0 Jul. 17, 2024
  • Feedback: Require the Use of ParametersHeartLevHi! I was doing the lesson on variables, Adding and Subtracting, lesson 9 exercise 2, and I accidentally used a static number in the function that was being created. Instead of increasing the health variable by amount, I increased it by 50, which is what the lesson was going to do anyway, but a small improvement may be to make it require the use of the amount parameter so it can be healed different amounts. I believe that this could help prevent frustration in the future and would make the lesson just a little bit more helpful to some people. I am studying to be a teacher (not for gamedev, but maybe someday), and I appreciate what you are doing with this program! I hope this feedback helps you! 1 0 Jul. 15, 2024
  • Question about Lesson 22 Exercise 2elementary-hippopotamusHello, I would like some guidance as to why my code below didn't work in the editor. ```gdscript var crates = ["healing heart", "shield", "gem", "sword"] func run(): while not crates.is_empty(): crates.pop_back() ``` This while condition didn't empty out any of the values in the array, but I looked through the Godot docs and I thought my syntax was correct (please let me know if otherwise!). I understood the given solution, which uses **while crates:** If I understand correctly, **while crates:** returns a bool true when crates isn't empty? Shouldn't both solutions **while not crates.is_empty()** and **while crates:** have the same output? Thank you in advance for your time! I'm really enjoying this app, it makes learning to code a total blast and it works seamlessly. 1 0 Jul. 05, 2024
  • Lesson 6 Practice 2graceful-clamThe Length and Angle parameters are set behind the scenes. But they are not truly random since each run produces the same result. Are those variables set up as arrays or perhaps a dictionary under the hood? Then when it is called in the function it cycles through the set options? Or is it another path of code to get to that final output? Thank you! 2 0 Jun. 27, 2024
  • Lesson 6 Practice 1graceful-clamI've finished this series once and have circled back to the beginning to see how my knowledge has grown - and boy it has! Thank you for the course that lead me to purchase this series. My question is this: why does the turtle draw a corner, jump, then draw another corner with the below code after we are asked to input "length". I also cant actually define "length" in the code, if I try it accepts it and runs but doesn't actually set the length. func draw_corner(length): move_forward(length) turn_right(90) move_forward(length) The above is what we interact with and see, but under the hood I would imagine it looks like this - which feels like a departure from what is actually shown and what is trying to be taught. (mind you, just this thought exercise of making this post is helping solidify my knowledge) func draw_corner(length): move_forward(length) turn_right(90) move_forward(length) jump (-length,-length/2) move_forward(length/2) turn_right(90) move_forward(length/2) Looking forward to hearing from you, 1 0 Jun. 27, 2024
  • Are parameters always random?decent-foxHello, I completed the first exercises on parameters just fine, but I'm struggling to understand how parameters know to just randomize the value in the way the solutions are presented? Specifically, I want to know if a parameter can be given a set value instead of always being random? My initial instinct was that the parameter could be defined outside of the function as a variable so it can be called repeatedly: ```gdscript var length = 200 var angle = 45 ``` However, that didn't work and the boxes were drawn in the same 'random' sizes. So, then I tried this: ```gdscript func draw_square(length=90, height=120): move_forward(length) turn_right(90) move_forward(height) turn_right(90) move_forward(length) turn_right(90) move_forward(height) ``` Same result, the boxes were still random. So, are parameters always designed to be random, or will I learn later in the course how to given a parameter a specific value? 2 0 Jun. 27, 2024
  • Lesson 12: Script Wide Variable and Function Parameter mealy-armadilloShould I and can I make the script wide variable as required parameter in function definition? Here is the example provided in lesson 12: ```gdscript var angular_speed = 4 func _process(delta): rotate(angular_speed * delta) func set_angular_speed(new_angular_speed): angular_speed = new_angular_speed ``` In this case, should I and can I change both the function definition to include `angular_speed` as one of the parameter? 1 0 Jun. 26, 2024
  • Lesson 3: Is it mandatory to write all code within custom functions in Godot?mealy-armadilloLesson 3: "In gdscript, we must write your code inside of custom functions" It this statement wrong? I often see examples where a significant amount of code is outside of custom functions. For example, in the style guide from Godot documentation ([https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_styleguide.html](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_styleguide.html)), from line 1 to 17, all codes without wrapping in functions. ```gdscript class_name StateMachine extends Node ## Hierarchical State machine for the player. ## ## Initializes states and delegates engine callbacks ([method Node._physics_process], ## [method Node._unhandled_input]) to the state. signal state_changed(previous, new) @export var initial_state: Node var is_active = true: set = set_is_active @onready var _state = initial_state: set = set_state @onready var _state_name = _state.name func _init(): add_to_group("state_machine") ``` Another example from Godot documentation: [https://docs.godotengine.org/en/stable/getting_started/step_by_step/scripting_first_script.html](https://docs.godotengine.org/en/stable/getting_started/step_by_step/scripting_first_script.html) ```javascript extends Sprite2D var speed = 400 var angular_speed = PI func _process(delta): rotation += angular_speed * delta var velocity = Vector2.UP.rotated(rotation) * speed position += velocity * delta ``` This seems to contradict a statement I've come across in Lesson 3: "In GDScript, you must write your code inside of custom functions." Based on the official documentation, it appears that GDScript allows quite a bit of flexibility outside of function definitions. Could someone clarify if my understanding is correct? 2 0 Jun. 26, 2024
  • Lession 19 Practice 2defensive-tarsierHey, I find the lesson quite confusing. I can't figure out the solution myself and when I display it, I can't understand it. I also don't understand.... why the turtle can only hop between the rectangles on the X axis? and why... the rectangles overlap on the side lines in the solution, even though they shouldn't? 2 0 Jun. 25, 2024
  • Lesson 13 Practice 2an original JokeI was curious why for the condition, we had to use indent twice. Also what's the difference between putting health = 80 and health == 80. Great course by the way, been learning alot! 1 0 Jun. 19, 2024
  • Lesson 7 practice 2, it won't recognize variable position.xfaithful-lionI am currently on lesson 7 practice 2 and the variables are just not working right. For some reason the computer is not recognizing the "position.x" or "position.y" variables. Can anyone tell me why this code is wrong? No matter what I do, it always underlines line two and says "ERROR expected end of statement ("var") got '.' instead" ```gdscript func run(): var position.x =100 ``` 2 0 Jun. 12, 2024
  • I had a question about dictionaries and tables.HazlarHello, I had a question about dictionaries and tables. To traverse a table we traverse it from index 0 to Size-1 or backwards (but always a numeric value to count the displacement in the table) and this regardless of the content of the table which can be plural in the types of values. However in dictionaries, we can write and consider as "displacement value" in the dictionary of Vectors, character strings and it seems strange to me? Except if in submarine everything is finally referred to a numeric displacement value? 1 0 Jun. 07, 2024
  • Suggestion For GDS From ZerochoodleIt would be cool to have the ability to edit the code blocks in the article sections. 2 0 May. 25, 2024
  • Question about Lesson 20, practice 2JectSo, this is the practice in which we make the robot do a combo. The code that is marked as correct is: ```gdscript func run(): combo = ["jab", "jab", "uppercut"] for action in combo: play_animation(action) ``` But if I write ```gdscript func run(): var combo = ["jab", "jab", "uppercut"] for action in combo: play_animation(action) ``` I get the error message "The combo isn't correct", even though the animation performed by the robot is two jabs and an uppercut. In the checks I get a fail in "Robot Combo is Correct" but a pass on the "For Loop". Why does adding the *var* make the answer wrong? Moreover, why is *not* adding the *var* marked as correct? What am I missing here? Thanks! 2 0 May. 15, 2024
  • Do we touch the Astar classes in these courses?good-natured-sharklike AStarGrid2D for example 1 0 May. 09, 2024
  • Confused about using a string as the value instead of keyBonkHello, on lesson 25 about keys, the lesson talks about how you can use any value as a key and then shows something like 'unit_cells = {Vector2(0, 1): "robots"}'. How would you go about modifying the cell placement of units in this scenario? Or should dictionaries only be used for a fixed starting point for the unit? 1 0 May. 02, 2024
  • Lesson 16 clarificationright-pelicanHi, I am confused by this code in the example: ```gdscript func move_to_end() while cell.x < board_size.x - 1: cell.x += 1 ``` What I don't understand is how the robot moves to the final cell in the grid. As far as I can tell we're telling it to stop running the while loop when the cell.x position == the board size - 1. Wouldn't it get to the penultimate cell.x location and stop? 1 0 Apr. 28, 2024
  • Lesson 11, Time Delta (Possible issue?)LovelyDumplingGoing through this without hiccups so far, I noticed a slight discrepancy between the text of the lesson and one of the questions asked. "Delta represents a time difference. **It's the time passed *since* the previous frame, in seconds.**" The question then expects you to answer that **"delta is the time it took Godot to *complete* the previous frame in seconds."** I did not select this, so I got the question wrong. I did not select this, because the text "time passed since the previous frame" implies the time Godot is taking to complete the *current* frame, not the time taken to complete the *previous* frame. I'm sure this distinction won't actually matter for the use-case of delta, but I wanted to point out the conflicting language. 1 0 Apr. 22, 2024
  • Lesson 6 Practice 1 ParametersSpiffyGhostHi, I'm enjoying this course a lot. But I am sort of confused at the parameters and why they work compared to the previous lesson. Is the parameter "length" a pre-determined distance for the lesson? or does the parameter always give a certain amount of distance even outside of the lesson? 1 0 Apr. 19, 2024
  • Web app in macOS accepts Ctrl+<key> hotkeys, instead of usual Cmd+<key> key combinationsMelabelaWhen doing the programming examples in Web Applet, I need to use **Ctrl**+<key> in the text editor boxes... e.g. - `Ctrl + X/C/V` = for `Cut` / `Copy` / `Paste` - `Ctrl + Enter` = for `Run` However, on macOS (which I'm using), the usual modifier for these should be **Command (aka Cmd)**, instead of **Ctrl**... 2 0 Apr. 17, 2024
  • Lesson 21: Practice 1SquawksHey, so in working the practice I'm following that the variable "cell" is defined off screen with the shape size of 80, 80. and the Cell_size var is positioned with Vector2(80, 80) which places it on the intersection of cells (0,1),(1,0),(1,1) and (0,0). I understand that Cell_size / 2 places the "cell" in the center of (0,0). The issue I'm having is when I do the entire code `cell * cell_size + cell_size /2` its generates three "cell" images on the grid. Is that intended that it creates three more "cell" images? 1 0 Apr. 13, 2024
  • can't understand func move_to_bottom():shameful-gnatfunc move_to_bottom(): while cell.y < board_size.y - 1: cell += Vector2(0, 1) I can't understand this code because I feel like there is a lack of some explanation. The 'read' section doesn't explain what the function move_to_end is, although it is mentioned in the "read" section, and I don't understand how the code above works. Can anyone explain? 7 0 Apr. 12, 2024
  • What are sub-variables?FernandoHi, before lesson "15. 2D Vectors" I always thought of sub-variables as an way to access directly a parameter of a function, like: ```gdscript func Presentation(Rank : String, Name : String) -> void: func print(): Presentation.Rank("General") Presentation.Name("Kenobi") ``` But then came lesson "15. 2D Vectors" which wrote something like this: ```gdscript position -= Vector2(50, 0) #Subtracts 50 to the sub-variable x, and 0 to y position.x -+ Vector2(50 ,0) #Tries to subtract s 2D vector to the sub-variable x, which is a decimal number #The value types are incompatiple, and if you try you will get an error ``` So, was I wrong about the concept of sub-variables? How can "position" be multiplied by "Vector2", but not "position.x" even thought they are technically the same? I know it is a decimal number, but are not also the parameters of the "position" function? 5 0 Apr. 04, 2024
  • What is angular speed?FernandoHi, in lesson "11. Time Delta" it says that angular speed is an radian multiplied by delta", it also says it is ok to be confused, so ok. But in lesson "12. Using Variables to Make Code Easier to Read" this code is written: ```gdscript var angular_speed : 4 func _process(delta): rotate(angular_speed * delta) ``` Which made me double confused because if an angular speed is an angle times delta, what makes of an angular speed times delta? And is an angular speed the speed the object moves in an angle, or the amount of angle an object rotates in a certain time, or the speed a object rotates in a certain amount of angle, or... (it goes on)? 3 0 Apr. 03, 2024
  • What are parameters?FernandoHi, in Lesson 3 "We Stand on the Shoulder of Giants" it is presented two concepts: Arguments and Parameters. Arguments are used to modify a called function,but I not so sure if I *really* got it; and what exactly are parameters? It is quite hard to understand it and I tried using the glossary, but it made it even more confusing. Why "heal_amount" has ": int" after them? Why it is an parameter and why it is also in line 4? Why the code read "heal_amount" as 10 if the "heal_amount" never appears in the code before? And so on. ```gdscript var health := 100 func heal(heal_amount: int) -> void: health += heal_amount ``` If it is in the helm of possibility, an in depth explanation with example about these concepts would be welcomed. 6 0 Apr. 01, 2024
  • lesson 19 practice 2MillMillI'm confused on how to access the sizes in rectangle_sizes? ```gdscript var rectangle_sizes = [Vector2(200, 120), Vector2(140, 80), Vector2(80, 140), Vector2(200, 140)] func run(): for number in rectangle_sizes: draw_rectangle(rectangle_sizes.x, rectangle_sizes.y) jump(300,0) ``` 3 0 Mar. 29, 2024
  • Question about resetting player's health code snippetmotherly-codHi! I just wanted to confirm something, out of curiosity, about this code snippet: [mkyHL5t.png (1040×545) (imgur.com)](https://i.imgur.com/mkyHL5t.png). I guess that some of the examples are written the way they are for the simplicity sake that is required for learning new concepts but if one would like to write similar logic in an actual game, would it be an acceptable behavior for "health" variable to store illegal value at any given moment? (or to put it another way - is it acceptable in production code?) I mean, when coding such logic in a game, this could either be reworked a bit to check some conditions before actually applying any new value or we could try using something that sounds like designed for variables like health, e.g. built-in clamp function, right? 1 0 Mar. 24, 2024
  • Lesson 22 Practice 2JamesFI have found that on this practice a method is used within the solution that has not been previously explained in other lessons. So far as I could see it is only available through the hints. If am incorrect or if this was intended then I apologize, but it does seem a little unfair to throw that curve ball in there without some explanation as to what that method does in the first place. It did however provide a valuable lesson in how to use the documentation provided by Godot for arrays to search something that could be used in the while loop. 3 0 Mar. 15, 2024
  • Learning on more than one machineSlothyHI, Loving the program, but just wondered if there was any way of saving learning progress between machines, as I regularly flip between my desktop and laptop, but it seems that the progress on my desktop doesnt sync over to my laptop. Is there anyway of forcing this? Andy 1 0 Mar. 02, 2024
  • Lesson 7 Practice 2Drew_CoderI'm doing the course on a M2 Max Mac Studio. When I use the jump command to move the turtle it draws a line in-between each square. Is this correct behavior? 1 0 Feb. 29, 2024
  • Additional Looping Dictionaries Practise Resources? RiskyPixelsHi folks! I just wrapped up the Learning GDScript lessons today and I feel that I did really well in all areas except the looping dictionaries exercises. I read over the lessons ~10 times or so, and each time that I thought I understood how to proceed and place the units in the cells, I was wrong :( While I'm sure this is a me problem, and not an issue with the lessons, even looking at the hints and the solution wasn't enough to help me understand where I was going wrong. Are there additional resources or opensource game projects that GDQuest might recommend I review to help paint a clearer picture for myself? I'm eager to mend this gap in my understanding. Thanks again, I've had a great time! 1 0 Feb. 18, 2024
  • App running in browser sometimes lost the progressgorohaHello all, I run app in Safari Version 17.3.1 (macOS Sonoma 14.3.1, MacBook Air M1) and sometime the progress is reset. I don't know why. Does anyone meet the same issue with me? 2 0 Feb. 14, 2024
Site is in BETA!found a bug?