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.

  • Auto CompleteGrumpyWhy doesn't autocomplete work for ```gdscript .set_shader_parameter() ``` It works for the canvas_group.material part but stops after the '.' after material. 8 5 Mar. 23, 2024
  • L3.P1 partially solved alreadyTJJust a quick tip: In Exercise L3.P1, the first task of assigning the shader to the material was already done when I opened the file, if I'm not mistaken. I suppose in a future version you will remove this already completed part so we can practice more 1 3 Mar. 24, 2024
  • How to change the line color on mouse_enteredandrea-putortiHey there, I tried to change the line color of the material on the chest when the mouse enters by adding this: ```gdscript var shader_line_color_in = Color(227, 224, 77, 255) var shader_line_color_out = Color(0, 0, 0, 255) func _on_mouse_entered() -> void: canvas_group.material.set_shader_parameter("line_color", shader_line_color_in) func _on_mouse_exited() -> void: canvas_group.material.set_shader_parameter("line_color", shader_line_color_out) ``` It changes the color, but to white, instead of the yellow I picked (even if I change to any color). Why? Thanks for your time ^^ 2 2 May. 04, 2024
  • Confused about accessing other nodes propertiesHermundureAs we have seen in this lesson, to access the "line_thickness" property of the shader we need to write: canvas_group.material.set_shader_parameter("line_thickness", 6) If we want to change, the position of something while hovering over (for my example I just take the x position of the Bottom chest piece, we learned to write: bottom.position.x = 10 I am confused because we can access the position directly and do not need to write: bottom.**transform**.position.x = 10 Why is that and, more importantly, how do we know when to write the full "path" to a property and when not to. 1 2 Apr. 01, 2024
  • Regarding the "new_thickness" parameterDargorI still get a bit confused about arguments and parameters. In the on_mouse_entered function, when we write "tween.tween_method(set_outline_thickness, 3.0, 6.0, 0.08)" we never define new_thickness, or assign it the value 6.0. So, in the set_outline_thickness function, how does it know that new_thickness = 6.0? func set_outline_thickness(new_thickness: float) -> void: canvas_group.material.set_shader_parameter("line_thickness", new_thickness) 2 2 Mar. 26, 2024
  • Tween garbage collection?TJPreviously, to move the gems and health items up and down, we created a tween object inside the `_ready()` function. My understanding of this was that somehow the tween is cached as some local object to the game object and never gets garbage collected. Because clearly the items keep going up and down, the tween must be present behind the scenes. Perhaps it doesn't get garbage collected because it never finishes it's animation, it's a looping animation after all. What puzzles me in the current lesson is that we create tween objects in the methods `_on_mouse_enter()` and `_on_mouse_exit()`. We could imagine that multiple tween objects are created if we repeatedly move the mouse in and out of the chest. Each individual tween object has to stick around for at least a couple of frames in order for the outline thickness to be animated. But how do these tween objects eventually get garbage collected, if at all? Or does a tween always get garbage collected when it's animation ends? I'm just imagining that tweens could be a possible memory problem if many of them would overlap in time and they all keep playing. It can perhaps be useful to put some extra clarifying note about that in this lesson :-) 4 2 Mar. 25, 2024
  • Type variable does not show when dragging the node with CTRLGurkIs this an option in the editor? When I drop the node into the code I get almost the same line, but the ": CanvasGroup" type definition won't show. Instead of ```javascript @onready var canvas_group: CanvasGroup = $CanvasGroup ``` I get ```javascript @onready var canvas_group = $CanvasGroup ``` I don't mind that much, is more curiosity to know if is some option or behavior of the editor. 4 2 Mar. 23, 2024
  • Multiple "var tween"s seem to be bestslim-lemurSo I noticed that we declare a new tween in both the `_on_mouse_entered` and `_on_mouse_exited` functions via `var tween := ...` I was wondering if it would be better to declare one tween at the top of the script and re-use it like typical variables. If tweens followed the same behavior, the following should work: ```gdscript @onready var tween : Tween = create_tween() ``` or ```gdscript var tween : Tween = null func _ready() -> void: tween = create_tween() ``` And these work if you immediately follow them with a tween_* method in `_ready`, however, by the time `_on_mouse_entered` is triggered, both throw a run-time error where tween is null. The Godot documentation page on tweens mentions: > Tweens are not designed to be re-used and trying to do so results in an undefined behavior. Create a new Tween for each animation and every time you replay an animation from start. Keep in mind that Tweens start immediately, so only create a Tween when you want to start animating. That, plus a response I saw to tween garbage collection saying (in the Q and A section): > "A tween object that we don't keep around always gets freed automatically when all its animations complete." - Nathan My takeaways are: 1) Because tweens get garbage collected as soon as their animation ends, you want to use:`tween = create_tween()` at the start of any tween animation. Otherwise you'll likely get a null error. 2) To avoid a "not declared in scope" error, you want to include var so it's `var tween = create_tween()` 3) This is more of a general coding thing but, if the computer reads `var tween` but `tween` is already declared, then the `var` part is ignored and the rest works fine. tl;dr So, it seems like including `var tween = create_tween()` every time at the start of your tween animation definition is usually a good idea. 2 1 Jun. 16, 2024
  • Chest Line thickness not changingample-troutWhen I hover my mouse over the chest in the scene play, the line doesn't change size. I get the following error: W 0:00:00:0100 MaterialStorage: Project setting "rendering/limits/global_shader_variables/buffer_size" exceeds maximum uniform buffer size of: 16384 <C++ Source> drivers/gles3/storage/material_storage.cpp:1114 @ MaterialStorage() Below is my code: extends Area2D @onready var canvas_group: CanvasGroup = $CanvasGroup func _ready() -> void: mouse_entered.connect(_on_mouse_entered) mouse_exited.connect(_on_mouse_exited) func _on_mouse_entered() -> void: canvas_group.material.set_shader_parameter("line_thickness", 80.0) print("Mouse entered") func _on_mouse_exited() -> void: pass 2 1 May. 27, 2024
  • L3.P1each-toadI get this error, "The CanvasGroup node's material property has a shader assigned to it, but it's not the shader provided in the practice folder." But i swear to god i am using the group_outline.gdshader in /practices/L3.P1.hover_the_ballon I have tried reloading the test and reset it via the UI, but it wont work with me :( 6 1 Apr. 02, 2024
  • set_shader_parameter material functionbc likes youI understand that `set_shader_parameter` is a function of the material. My issue is that it didn't show up in the autocomplete so in the future, how would I know this function exists? I'm guessing bc I would have been the one to write it if I made a material? 1 1 Mar. 23, 2024
  • The tween doesn't work,if tween at the topnext-craneIf I declare the tween variable at the top **var tween : Tween** and set **`tween = create_tween()`** in **`_ready()`**, and then use **`tween.tween_method()`** in **`_on_mouse_entered()`** and **`_on_mouse_exited()`**, the tween doesn't work. Why is that? 1 0 Sep. 16, 2024
  • Hove_the_ballon is not working. I'm on mac osx.MaziHi! The shader and the set_outline_thickness don't work. Here is my code: ```gdscript extends Area2D @onready var canvas_group: CanvasGroup = $CanvasGroup @onready var canvas_group_has_material: bool = canvas_group.material != null func _ready() -> void: set_outline_thickness(5.0) mouse_entered.connect(_on_mouse_entered) mouse_exited.connect(_on_mouse_exited) func set_outline_thickness(new_thickness: float) -> void: if canvas_group_has_material: canvas_group.material.set_shader_parameter("line_thickness", new_thickness) func _on_mouse_entered() -> void: set_outline_thickness(10) func _on_mouse_exited() -> void: set_outline_thickness(5) ``` What am i missing? I'm using a mac. I use the shader from practices L3.P1 folder. 1 0 Sep. 11, 2024
  • Getting shader reference error in L3 P1enraged-manateeNot sure what I am doing wrong. I have applied, and reapplied the shader named group_outline.gshader from the practices\L3.P1.hover_the_balloon folder from the filesystem browser in Godot. every time I try, I still get the error: ```gdscript The balloon's CanvasGroup node has a material with the provided group_outline.gdsha der shader applied to it. ``` 3 0 Sep. 09, 2024
  • Balloon hover shader test still failingsuperior-aardvarkI looked through the questions to see if anyone else had this issue, and I saw several posts where guys suggested deleting and re instantiating the ballon_hover scene from the practices folder. However, it's still failing after I tried this. I downloaded the course only about a month ago, so I have a very recent version of it. Here's the link to my project: [https://drive.google.com/file/d/1lThlUv8u6JTsE56dS0hdqZ6Wu84GbmbU/view?usp=drive_link](https://drive.google.com/file/d/1lThlUv8u6JTsE56dS0hdqZ6Wu84GbmbU/view?usp=drive_link) 1 0 Sep. 08, 2024
  • Practice Balloon Shader Test not workingcloudy-wombatI saw a previous message going through a very simular problem, however doing the things suggested didn't work. My issue is that even though I 'm using the practice group shader it still gives me the error. I'm on mac v 14.4.1 and here are my project files: [https://drive.google.com/file/d/1QQbIXC85xQmh8Dq9Iv0V-pqgYCJdfarY/view?usp=sharing](https://drive.google.com/file/d/1QQbIXC85xQmh8Dq9Iv0V-pqgYCJdfarY/view?usp=sharing) 2 0 Sep. 06, 2024
  • HOVER IS NOT WORKINGy_muradovThis is my code and when I press F6 and hover over chest - nothing is hapenning. I tried print func for mouse_entered, but still nothing `extends Area2D` `@onready var canvas_group: CanvasGroup = $CanvasGroup` `func ready() -> void:` ` mouse_entered.connect(_on_mouse_entered)` ` mouse_exited.connect(_on_mouse_exited)` ` canvas_group.material.set_shader_parameter("line_thickness", 3.0)` `` `func _on_mouse_entered() -> void:` ` canvas_group.material.set_shader_parameter("line_thickness", 8.0)` `` `func _on_mouse_exited() -> void:` ` canvas_group.material.set_shader_parameter("line_thickness", 3.0)` 3 0 Sep. 03, 2024
  • How to interpret the documentation?SootyI was following along with the lesson, and when it is explained that canvas_group.material.set_shader_parameter("line_thickness", 3.0) that the .material is a property of the node, I went on a 30 minute side tangent trying to see if i could change modulate. so I attempted with canvas_group.visibility.self_modulate(1,1,1,1) which when hovering over the chest causes an error so after searching through the documentation on canvasItem, or canvas group the documentation says Color self_modulate [default: Color(1, 1, 1, 1)] I again attempted to use the similar syntax in the tutorial, canvas_group.color.self_modulate(1,1,1,1) after many attempts later, the syntax that got it working was (with modulate not self modulate) canvas_group.modulate = Color(1,1,1,1) why doesn't the documentation say that? I guess I don't understand how to read the documentation. 1 0 Sep. 01, 2024
  • Questions about the tween_method (answered)MatejAlready found a bit of what I wanted to know > @Nathan: > *I checked the engine source code and similarly, behind the scenes, the tween has a function that runs in the engine's process function and that updates every tween animation every frame.* I have 2 more question regarding the MethodTweener though: 1 - Is the tween created and freed on each tick? 2 - Is it possible to change the tick interval for MethodTweener? 5 0 Aug. 04, 2024
  • L3.P1 doesn't detect that the group_outline.gdshader from the practices folder is being used.GillooI am currently going through the provided balloon outline practice but it seems that when running the project I keep getting the notification that a shader is attached to the CanvasGroup but that it isn't the one provided in the practice folder. I am currently working on LinuxMint with the latest release of Godot. Is this a bug or am I doing something wrong? 4 0 Jul. 25, 2024
  • Why do I need to define the variable?ÍKARJust a quick question, but why do I need to define the variable "canvas_group" as a CanvasGroup? Is it just for fastest readability or it has more implications? It works fine writing this: ```gdscript @onready var canvas_group = $CanvasGroup ``` Thanks! 1 0 Jul. 18, 2024
  • L3.P2 unexpected Errorglossy-elephant```gdscript extends Area2D @onready var canvas_group: CanvasGroup = $CanvasGroup func _ready() -> void: mouse_entered.connect(_on_mouse_entered) func _on_mouse_entered() -> void: canvas_group.queue_free() ``` Hi, When I run the above code (from within the balloon_sting scene), everything works as expected. However when run from the sting_the_balloon scene, it errors out with this error: ```gdscript E 0:00:00:0389 balloon_sting.gd:3 @ _ready(): Node not found: "CanvasGroup" (relative to "/root/UITestPanel/@Node@3/@Area2D@4"). <C++ Error> Method/function failed. Returning: nullptr <C++ Source> scene/main/node.cpp:1651 @ get_node() <Stack Trace> balloon_sting.gd:3 @ _ready() test.gd:6 @ _setup_state() test.gd:122 @ setup_checks() ui_test_panel.gd:80 @ _ready() ui_test_panel.gd:1532784000 @ _setup_test() test.gd:1532785024 @ setup() ``` And so now, I'm just unsure if I messed up somewhere or not. 4 0 Jul. 01, 2024
  • How to read documentation ?ChanclinkHi ! I'm enjoying the course so far, it's really great and I do not have much difficulty for now, I just wonder how to search for information, I know that documentation is really important for dev, especially when you are on your own, while I know that for now I may not have the level to create something all alone, I just want to know if there will be later in course at least a little part where you explain how to search for an information and especially how to read documentation, I tried to read some (especially unity a long time ago) but for me it's like trying to use a dictionary without knowing the order of the alphabet, I can't find the word I want and often times there are multiples thing that have the same name and I don't know how to make the difference. Thank you in advance for your response 1 0 Jun. 06, 2024
  • In L3.P1 I'm using the exact code and it's not getting past the "hover" testhefty-alpacaHi, I've double checked and compared my code to the practice solution and it seems that I am using the literal same code as it is in the solution file, yet it's not working for me, the outline is not being drawn on my instance of the balloon, and so it is failing the "interacting with the mouse" test. The prior tests (for the canvas group) are all correct. What could I be doing wrong? This is my code: ```gdscript extends Area2D @onready var canvas_group: CanvasGroup = $CanvasGroup @onready var canvas_group_has_material: bool = canvas_group.material != null func _ready() -> void: mouse_entered.connect(_on_mouse_entered) mouse_exited.connect(_on_mouse_exited) set_outline_thickness(5.0) func set_outline_thickness(new_thickness: float) -> void: if canvas_group_has_material: canvas_group.material.set_shader_parameter("line_thickness", new_thickness) func _on_mouse_entered() -> void: set_outline_thickness(10.0) func _on_mouse_exited() -> void: set_outline_thickness(5.0) ``` And this is the code from the solution: ```gdscript extends Area2D @onready var canvas_group: CanvasGroup = $CanvasGroup @onready var canvas_group_has_material: bool = canvas_group.material != null func _ready() -> void: mouse_entered.connect(_on_mouse_entered) # mouse_exited.connect(_on_mouse_exited) # set_outline_thickness(5.0) func set_outline_thickness(new_thickness: float) -> void: if canvas_group_has_material: canvas_group.material.set_shader_parameter("line_thickness", new_thickness) func _on_mouse_entered() -> void: set_outline_thickness(10.0) # pass func _on_mouse_exited() -> void: set_outline_thickness(5.0) # pass ``` 7 0 Jun. 01, 2024
  • Question about "Local to Scene" propertyA_Room_With_A_MooseHello, I'm asking this question viewing the topic purely from a logical standpoint and for the purpose of learning, so please feel free to be as verbose as you need to in answering. :o) In the glossary under Resource (https://school.gdquest.com/glossary/resource), it's explained that "[...] a resource is shared by default and has a small memory footprint as a result." My question is this: does enabling the property *Local to Scene* eliminate a couple of primary benefits for using a resource, namely its "small memory footprint" and "shared" relationship behavior? It seems like having each instance of a scene call its own resource detracts from the purpose of using one in the first place, at least in the context above. Would there be a better way of achieving the same result - in this case, adding an outline to the chest - without using a resource (which seem similar to Singletons in C++, if I recall correctly)? Thank you in advance. 1 0 May. 19, 2024
  • L3.P1 Practice FailingleafI really don't know what's happening, and I've tried as much as I can do on my own. Here's the code I am using: (I can't get it into a code block without breaking the text field and having to refresh the page, so I'm just placing it here) extends Area2D @onready var canvas_group: CanvasGroup = $CanvasGroup @onready var canvas_group_has_material: bool = canvas_group.material != null func _ready() -> void: mouse_entered.connect(_on_mouse_entered) mouse_exited.connect(_on_mouse_exited) set_outline_thickness(5.0) func set_outline_thickness(new_thickness: float) -> void: if canvas_group_has_material: canvas_group.material.set_shader_parameter("line_thickness", new_thickness) func _on_mouse_entered() -> void: var tween := create_tween() tween.tween_method(set_outline_thickness, 5.0, 10.0, 0.0) func _on_mouse_exited() -> void: var tween := create_tween() tween.tween_method(set_outline_thickness, 10.0, 5.0, 0.0) 11 0 May. 05, 2024
  • Missing instruction?leafWhen we are instructed to add the first tween to `_on_mouse_entered` function Correct me if I'm wrong, but we're needing to replace the `canvas_group.material.set_shader_parameter("line_thickness", 6.0)` line for `var tween := create_tween()` `tween.tween_method(set_outline_thickness, 6.0, 3.0, 0.08)` I didn't see anything in the examples to remove any code, which I believe you would need to replace it due to the nature of the tween. I realize it's small, but could cause confusions down the road? Also, I am still struggling to figure out how to exit a code block with enter. You guys instructed me once before on how, but I'm still scratching my head at it! So I used "format as code" instead. 4 0 May. 03, 2024
  • L3.P2 : Signal "not" connectedNsbxHi :) By doing the training, I got into the habit of connecting my signals via menus rather than code. By doing that, I can see if a signal is connected just by looking the list with the green icon. But in this practice, the first test is not validated even if the signal work. 2 0 May. 02, 2024
  • Tween_methodBehnderI'm familiarized with the "tween.tween.property..." but I never used this. This would be the same, but just applied to methods, right? 2 0 May. 02, 2024
  • Glow effect tart-hippopotamusHello! How can I realize glow effect? I tried to add tween with bigger thickness and transparent color, so firstly full color grows, then transparent grows and it makes glowing effect. But this approach doesn't work and tween stop working at all. Any workaround? 3 0 Apr. 29, 2024
  • Thick line after _on_mouse_exited()MakeeHello, when I use tween_method only on _on_mouse_entered() the line gets thick and stays thick if you move the mouse fast enough: ```gdscript func _on_mouse_entered() -> void: var tween := create_tween() tween.tween_method(set_outline_thickness, 3.0, 6.0, 0.1) func _on_mouse_exited() -> void: #var tween := create_tween() #tween.tween_method(set_outline_thickness, 6.0, 3.0, 0.1) set_outline_thickness(3.0) func set_outline_thickness(new_thickness: float) -> void: canvas_group.material.set_shader_parameter("line_thickness", new_thickness) ``` To interrupt the tween would I make the var tween global and call tween.stop() before the code in line 9? 3 0 Apr. 26, 2024
  • Why use shaders?tesfalconWhy add that level of complexity to this lesson? Wouldn't a tween of chest size growing on_mouse_entered and shrinking when on_mouse_exited work just as well? Is there something more important about shaders that will come later or is that it? 7 0 Apr. 25, 2024
  • Why does tween_property not work here?g1lg1lHi Nathan, so i tried to make this myself first without reading the article, in previous lessons we used the **tween.tween_property** function and so i tried to do something like this `tween.tween_property(canvas_group.material, "line_thickness", 4.0, 1)` but it didnt work and i got an error message in the console > Chest.gd:10 @ on_mouse_enterd(): The tweened property "line_thickness" does not exist in object "<ShaderMaterial#-9223372012561365798>". why is that so ? the tween cant access shaders parameters directly? 1 0 Apr. 21, 2024
  • L3 P1 Practice, shader check failingEmberblinkSo I have been trying to get past L3 P1 and can't seem to get pass the shader check. I have made sure that i added the shader from the correct location ( \practices\L3.P1.hover_the_balloon ) to the CanvasGroup in balloon scene, i keep getting the following error on check: "The Canvasgroup node's material property has a shader applied to it, but it is not the shader provided in the practice folder" I have tried resetting the practice to start from scratch. same error. Am I missing something or doing something wrong?? 6 0 Apr. 17, 2024
  • Handling Auto-Completion Quirk in GDScript Connect Statements_nilCatHey Nathan, I've been encountering a small issue with GDScript in the Godot engine. Whenever I attempt to input `signal_name.connect(function_name)`, it automatically completes as `signal_name.connect(function_name())`. However, when I try to remove the extra brackets, it also removes the necessary one, resulting in `signal_name.connect(function_name` which is a bit cumbersome. Though it's not a major problem, I was wondering if there's an easier way to handle this? Thanks in advance! 2 0 Apr. 11, 2024
  • = instead of :=BoomsquallyAt the beginning before using the @, when assigning the node to the canvas variable in the ready function, why do you use the = sign instead of := ? and why does it not like := in this case? In my understanding = is basically a declaration, whereas := stores stuff in a variable that you can use in other places. Thanks! 2 0 Apr. 03, 2024
  • balloon_hover.tscn?edmunditoIn the practice section, I saw that it opens hover_the_balloon.tscn, but in the folder, there is a similar scene called ballon_hover.tscn. I edited hover_the_balloon.tscn to complete the practice, but I wonder if the extra scene is needed at all. 1 0 Mar. 31, 2024
  • L3.P1 & L3.P2: Couldn't see the results work.MartinBCould just be me and my mac again but it says I passed the lessons, I just couldn't test the results myself by waving my mouse over them unfortunately. 11 0 Mar. 28, 2024
  • L3.P2 BugJankiKhanThis exercise will pass even if I leave `pass` inside `_on_mouse_entered` 3 0 Mar. 28, 2024
  • What makes tween run?xistenceWhen coding to move a ship, we would throw the code in the process function. The code runs at each step. In tween, we used a method and with that the animation knows when to finish. What is exactly happening behind the scene? 1 0 Mar. 26, 2024
  • after adding shaderMonarchi see that outlines are not same as the once i see in the gifs from the wepage, thy are so thin like almost negligable to see unless i use something like 7 or 8 and also the round corner near the egdes are also not outlined well. like there is a smear like effect and its more thicker on corner. when i increase the thickness offcourse it becomes unnoticable, is it common to all or just me. want to kknow if some setting is affecting this or if this is bc the code is different than the gif. 1 0 Mar. 26, 2024
  • why not use set_outline_thickness() on _ready()?gsomi mean `set_outline_thickness(3.0)` instead of `canvas_group.material.set_shader_parameter("line_thickness", 3.0)` 2 0 Mar. 25, 2024
  • Don't need Camera2D to preview a scene?TJIn the lesson we added a temporary Camera2D to the Chest scene in order to test and view it in isolation. But by coincidence, in the context of Exercise L3.P1, I tried to run the file `balloon_hover.tscn` in isolation with F6 but without adding the camera explicitly. A game window was opened and I could also try out the mouse enter and exit functionality. I inspected the Remote scene tree at runtime, but I couldn't see a Camera2D added automatically, and yet it still worked. Why was it in the lesson that we needed to add the Camera2D explicitly? Thanks for your help! 2 0 Mar. 24, 2024
Site is in BETA!found a bug?