Looks like you're not logged in

Login or Register to continue

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.

  • Another solution for making buttons appear sequentiallyFlorcAt first I wanted to have the loop await for the button it is currently managing to appear before proceeding to the next. So I ended up with this solution : ```gdscript tween.finished.connect(func() -> void : for button: Button in action_buttons_v_box_container.get_children(): button.modulate.a = 0.0 button.visible = true var opacity_tween := create_tween() opacity_tween.set_ease(Tween.EASE_OUT) opacity_tween.tween_property(button, "modulate:a", 1.0, 0.5) await opacity_tween.finished ) ``` But as I don't know how threading is managed in Godot I was afraid to stop an important thread and encounter unexpected behaviours later in the module. So in the end I settled with the same solution as the one in the solution of the lesson. I'm curious though, how much was I risking to break things by using an await there ? 1 4 Aug. 25, 2024
  • Lesson complexity increasing adviceLiliTake this with a grain of salt as I am also learning programming. However after seeing some comments in this module, and last, I feel that I might have some reasonable advice. As the lines of code in a function increase, or as things in general get more complex there was a realization I had that helped a lot with reducing the cognitive load. The human brain can only juggle so many active components at a given time. With how logical programming is, you feel very incentivized to compose a concept of your code in your head and track each moving part. The problem is that tracking every single change eventually hits that limit of how many components you can juggle. This is totally normal, and not something to be hard on yourself about. Knowing that this happens is important, because you can prepare for it. It's all about breaking down concepts into smaller bite sized amounts. I'll give an example of how I might apply this concept to a function. First I would write out what the function intends to do with very simple, short directions. You could use code comments, or a separate notepad. This might be "clear current buttons", "update this number", "play animation" etc. Whenever you complete one of the tasks, you checkmark your note and move on to the next one. Which is exactly what we have been doing during the course practices, and why we are still making it through practices even if some of the concepts are still unfamiliar. Once the function is complete, this is where it's important to apply this concept the most. Continuing to track every single detail of what is going on inside the function will lead to you hitting your limit very quickly. You don't want to be simulating how a button was connected, or how a tween is working within this function inside your head at all times. As long as you understand them on their own, that is what is important. Again, you want to create smaller bite sized amounts. Instead of tracking every single piece, you want to turn the concept of that function in to something very simple. A good way of doing that is viewing the function only by it's inputs, and outputs. What gets plugged in to the function? What comes out of it when it runs? If we look at the "show_text" function from this lesson, it can look very overwhelming. But, the code comments above a function are written to be understanding of this exact advice. Instead of juggling the contents of the function you can simply read the comment "Displays the currently selected index from the dialogue array" Which answers our questions. That way you can clear away all of the concepts inside the function, and turn it in to one simple new concept. Up to this point it has been fairly possible to juggle everything going on in your head at once. Which means we've never had first-hand experience that shows you the importance of code comments. Therefore, we haven't yet cultivated our ability to translate code comments in to something we can make full use of. So when we refactored a large quantity of code, we also didn't have the natural senses to first refactor the bite sized steps. The lesson structure tracked those steps for us, so we were able to make it through. But, not having the skillset to do that ourselves made the shortcomings of not utilizing these concepts stick out. Essentially it's a good time to start cultivating that skill. To translate comments you read into something that actually feels tangible. To write comments/notes of your own to ease the process if you start feeling that your limit may get hit. I know for myself, the amount of code in this lesson is just about that point or close to it for me. I think that's all! I realized all this while I was talking to my programmer friend just a week ago. I don't have a very good memory, so I was probing them about how they compartmentalize. At one point they mentioned that they basically just don't track what's in functions, which made me much more confident about moving forward. But, yeah I know I would have struggled much more with this lesson if I had taken it on before that point. Thought it might be a potentially useful tip. 1 3 Feb. 20, 2025
  • Why doesn't this work?glossy-elephant```gdscript var buttontween := create_tween() #Tween Invalid. Either finished or created outside scene tree. tween.finished.connect(func () -> void: #var buttontween := create_tween() #Tweens correctly for button:Button in action_buttons_v_box_container.get_children(): buttontween.tween_property(button,"modulate:a", 1, 0.3) ) ``` I'm confused as to why this doesn't work when buttontween is defined outside of the lambda but works when defined inside. I thought that lambdas could access the variables in the outer scope? It also doesn't give scope errors. When running the above code I get errors in debugger: E 0:00:02:0286 dialogue.gd:135 @ <anonymous lambda>(): Tween invalid. Either finished or created outside scene tree. One of these for each button, with 135 being line 5 above. I don't really understand the error code. 6 2 Jul. 11, 2024
  • Methodology of teaching in this lessonKpfaffHi, since you dedicated the intro to this I would like to give feedback; I found this lessons methodology on teaching very confusing. Following your mental leaps, deletion and insertion of code and tracing the variables throughout the code to be mentally very taxing. Something that feels more at home in challenges. Also coming back to it reading it a second time to make sense of what I just did is more difficult then when it’s structured like the lessons before. The content is great, the additional layer of “this is how I think when I do it” makes it tough. Mind you, this comes from a programming newbie so there is an additional load on my mind doing it. Thank you for the hard work! 😊   3 1 Jan. 05, 2025
  • Typo in L4.P1 ChecklistBob CornbobThe first line in the checklist says: **`There should be as buttons children`** 1 1 Nov. 01, 2024
  • L4.P1 I Need Help!Nikita MyshkinI've tried everything already and don't understand what needs to be done. ```gdscript func _ready() -> void: for item_name in items_list: var button := InventorySlotButton.new() grid_container.add_child(button) button.text = item_name button.amount = item_name # Assign the item's name and amount to the button properties. # Don't forget to add the button to the grid container. ``` What needs to be fixed here that the numbers finally show up? 7 1 Jul. 29, 2024
  • Favorite lessonAlcedoMan, I do love this lesson for all the present topics, in particular the challenge. This make me think about an additional feature: it would be nice to have a favorite system to keep track these kind of lessons. 1 1 Jul. 16, 2024
  • Why not a dictionary of dictionaries for our dialogue?HoleyI feel like it would be much more human readable to have the value of a choice be quest29_accept rather than index [17], especially if these were to grow much larger. That being said I imagine with a dialogue system like this you would create a tool to manipulate it rather than working directly in code so perhaps this is a non-issue? That being said, I am loving this course! I've followed several tutorials in the past which has given me an okay base in using the various functions and types but this has blown all of them out of the water with the learning style, fundamentals and pragmatic approaches to game development. Thank you to everyone involved! I am very excited to learn all of it, especially as we seem to be continously moving into more interesting topics as we go. 2 0 Feb. 21, 2025
  • The proposed button solution enables bad input, and a better solution is available with what we already knowWiseRatThe proposed solution: ```gdscript for button: Button in action_buttons_v_box_container.get_children(): button.disabled = true # Make the buttons transparent. button.modulate.a = 0 tween.finished.connect(func() -> void: # We create a tween before the loop to queue the animations. var button_tween := create_tween() for button: Button in action_buttons_v_box_container.get_children(): button.disabled = false # We tween the modulate property to fade in the button. button_tween.tween_property(button,"modulate:a", 1.0, 0.3) ) ``` Because the buttons fade in sequentially, and are enabled from the jump, a hypothetical player could click one option before viewing all of them. But since we already just using one tween and we already know about connecting signals to a tween being finished and lambdas (indeed using one at the start). You could maybe add ```gdscript button_tween.finished.connect(func() -> void: button.disabled = false) ``` This way a user would defs have seen all the choices. I think this could perhaps be added to the challenge without complicating it. 2 0 Feb. 16, 2025
  • Confusion with L4.P1 HappyWhen it comes to getting the button.amount I thought the solution would be something like this : ```gdscript for item_number in items_list: var item_amount: int = items_list[item_number] button.amount = item_amount ``` When I run the test each of the buttons have just the number 2 next to them (the amount of buttons are just 2 for each) But instead the solution is putting the value item_name from the first for loop into the square brackets, like so: ```gdscript for item_number in items_list: var item_amount: int = items_list[item_name] button.amount = item_amount ``` I'm having a hard time understanding why we are referencing the value of the first for loop to get the correct values for the amount? And why does referencing the second for loop only give a value of 2? 4 0 Jan. 20, 2025
  • spam button (challenge)sqwirexI noticed that if you spam a button, which a user can easily do when going through the game for the second time, the animations start to fail and the buttons either disappear or remain, so I added a separate loop to turn on all the buttons, but with the approach as in the lesson, loop with animations plays in a split second, puts them in the queue for execution and moves on to the next loop, activating all the buttons in the same split second, so I decided to use await so that the loop doesn’t end prematurely, of course, gray disabled buttons while the animation is playing spoil the image a little, but let’s pretend that in their place there could be a beautifully designed button! ```gdscript for button: Button in action_buttons_v_box_container.get_children(): button.modulate.a = 0.0 button.disabled = true tween.finished.connect(func() -> void: audio_stream_player.stop() for button: Button in action_buttons_v_box_container.get_children(): tween = create_tween() tween.tween_property(button,"modulate:a",1.0,0.15) await tween.finished for button: Button in action_buttons_v_box_container.get_children(): button.disabled = false ) ``` 2 0 Jan. 15, 2025
  • About the button challengeMr-EdWhile I understand how the code from the solution works, I don't understand why the tweens wait for the previous one to finish instead of all the buttons appearing at the same time. I wrote a similar solution though instead of using a lambda function I called a separate function, but all three buttons would appear at the same time. 2 0 Dec. 23, 2024
  • Extra customization for buttonssnowkittyseleneIs there any way to use BBCode in button labels? Also, any way to make the programmatically-created buttons not be cut off with long reponses? 1 0 Nov. 30, 2024
  • Understanding check: BindMrBright01In the example given, we need to use .bind() because `target_line_idx` is being reused as part of the for loop, so we need to save the value of it until the button is actually pressed? And the button is essentially saving the `target_line_idx` for later use for the show_text call? 3 0 Nov. 04, 2024
  • bug in 'binding call' link?andriesThere is a code fragment in the 'binding call' link section. The code is: ```gdscript func _ready() -> void: health_pack.body_entered.connect(_on_body_entered).bind("health") coin.connect.body_entered.connect(_on_body_entered).bind("coin") func _on_body_entered(body: Node, name: String) -> void: print("Body entered: ", name) ``` ... but shouldn't this be: ```gdscript func _ready() -> void: health_pack.body_entered.connect(_on_body_entered.bind("health")) coin.connect.body_entered.connect(_on_body_entered.bind("coin")) func _on_body_entered(body: Node, name: String) -> void: print("Body entered: ", name) ``` '.bind' should be called on *on*body_entered instead of connect? 1 0 Oct. 08, 2024
  • I reused old codeeuphoric-sheepI reused my code and dialogue to expand on the original design. I had to do a diff between our code to figure out the functional differences. Then I added the starts of the dialogue I created on a Miro board and numbered so I knew which order they went in for the index. Great lesson, really felt like I learnt a lot of applicable skills! 1 0 Oct. 06, 2024
  • Error after completing task L4.P2Thrillhouse[https://imgur.com/a/4THXNtk](https://imgur.com/KHLgfPB) - I completed the task and got the tick. I then tried removing display_item("purse") in ready to see what it would do. Then put it back again and now every time I run it crashes out to this: [https://imgur.com/XjREbUY](https://imgur.com/XjREbUY) I've tried resetting the task in the bottom right list but it give's me the option but then does nothing when clicked. 2 0 Sep. 27, 2024
  • I want to change disabled = false for each button one by one when modulate.a = 1.0next-craneI want to set the button to `disabled = false` only when `modulate.a = 1.0`. This is my previous code (including the comment section): ```gdscript for button : Button in action_buttons_v_box_container.get_children(): button.modulate.a = 0.0 button.disabled = true tween.finished.connect(func() -> void: var button_tween = create_tween() for button : Button in action_buttons_v_box_container.get_children(): button_tween.tween_property(button,"modulate:a",1.0,0.5) #button_tween.finished.connect(func()-> void: #button.disabled = false #) ) ``` But I found that it waits for all my buttons to have `modulate.a = 1.0` before setting all buttons to `disabled = false`. I want to set them one by one, so I changed it to be set inside `_process`: ```gdscript func _process(delta: float) -> void: for button:Button in action_buttons_v_box_container.get_children(): if button.modulate.a == 1: button.disabled = false ``` But I would like to know if `tween` has its own method to achieve this without having to set it in `_process`. Thank you! 1 0 Sep. 19, 2024
  • Bug when launching scene after editing the create buttons functionHazlarHi, When I hover the mouse over yes or no the background of the button becomes orange when I validate the choice, during the proposal the previous choice is no longer orange when I hover over it with the mouse. Example: Sentence 1: Yes or Not -> [yes] Sentence 2: Yes or not -> Yes no longer becomes orange when hovered over. And vice versa [https://school.gdquest.com/courses/learn_2d_gamedev_godot_4/start_a_dialogue/interesting_choices#quitting-the-game-when-done](https://school.gdquest.com/courses/learn_2d_gamedev_godot_4/start_a_dialogue/interesting_choices#quitting-the-game-when-done) 2 0 Aug. 27, 2024
  • Button visibility challengesmart-locustI understand the solution but, I seem to have arrived at this one first before I read the solution and it seemed to work just the same / similarly. ```gdscript for button: Button in action_buttons_v_box_container.get_children(): button.disabled = true button.modulate.a = 0 tween.tween_property(button, "modulate:a", 1.0, 0.5) tween.finished.connect(func() -> void: for button: Button in action_buttons_v_box_container.get_children(): button.disabled = false ) ``` 1 0 Aug. 06, 2024
  • var target_line_idx: int = choices_data[choice_text] I AM CONFUSE!miniature-gazellehello, why does the above line give us the value and not the key ? isn't choices_text the key of the dictionary? 2 0 Aug. 05, 2024
  • I get it, i'll be mindfull of queue_free and tween.finish interactionunderstated-cobraI thought i'll be smart and merge the two `for button: Button in action_buttons_v_box_container.get_children():` into one (the one creating the button and the one inside the finish signal) but this way the tween finish signal callback to a dereferenced button. Just added a null check inside the tween.finished lambda function to make it work but it shows that getting an update button list at finish signal timing is important. Almost forgot, these dialogue lessons are super interesting ! edit : typo 1 0 Jul. 22, 2024
  • Code Snippet Missing Double Quotes13eckIn the `Adding choices to the dialogue` section, the first code snippet is missing a double-quote at the very beginning of line 3 1 0 Jul. 18, 2024
Site is in BETA!found a bug?