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.

  • Is there a more hands on approach for shaping the hop animation? MarcJI know that there's a more complete animation system but for simple programmatic animation like the hop, is there a way to shape the animation curve directly instead of relying on simple configurations like `set_trans()/set_ease()?` 3 7 Mar. 28, 2024
  • how to queue_free() the chestantonzumpeThis course is amazing, thank you for all your hard work. I have a question about deleting the chest after opening it and spawning the items at the chest location. I started with the idea that once the chest is opened I could fade out the opacity of the chest and queue_fee() it in the AnimationPlayer Node. However, when I did this the items also disappeared when the chest was freed because they were added as children of the chest with the add_child() method. I found the add_sibling() method in the documentation and tried it. But now when the chest is opened the items would spawn in the wrong location. ```gdscript - add_child(loot_item) + add_sibling(loot_item) ``` I had to add another variable to the code, ```gdscript + var chest_position := position ``` then I had to add that into the last line of code that determines the random position of the items when spawned. ```gdscript - loot_item.position = random_direction * random_distance + loot_item.position = chest_position + random_direction * random_distance ``` without this code, the newly spawned items would inherit their position from their new parent node and appear at position (0, 0) It took some experimentation but eventually, I landed on the code below to have the items spawn as siblings of the main scene so that when I queue_free() the chest in the animation player the items don't disappear with it and make sure they spawn at the location where the chest was. ```gdscript func _spawn_random_item() -> void: var loot_item: Area2D = possible_items.pick_random().instantiate() add_sibling(loot_item) var chest_position := position var random_angle := randf_range(0.0, PI) var random_direction := Vector2(1.0, 0.0).rotated(random_angle) var random_distance := randf_range(0.0, 50.0) loot_item.position = chest_position + random_direction * random_distance ``` however when attempting to add the animate collectible code into the mix I'm back in the same position as I was when I first changed from the add_child() method to the add_sibling() method. The item spawn position is inherited from the main scene and set to (0, 0). I don't know where or how to store the chest position and apply it to the new animate item code. Any help would be much appreciated. 2 2 Mar. 31, 2024
  • Question about Easingmilk_manWhen only setting the Transition Type of a tween, which EaseType is used automatically? EASE_IN? If so, then both code snippets are identical? ```gdscript tween.set_trans(Tween.TRANS_QUAD) ``` ```gdscript tween.set_trans(Tween.TRANS_QUAD) tween.set_ease(Tween.EASE_IN) ``` 1 1 Oct. 02, 2024
  • Adding offset to the start of the animations?michaelgame_devSuppose I had a mode or powerup where I could open all three chests at once. With the animations done by the tween, would there be anyway to offset the start of the animation based on the x position of the chest? Say I wanted the chest on the left to start opening, then the chest in the middle, then the chest on the right. Open to using animation player (though I like that tweens end up having so many easing options built in). I believe that I would need to add a timer and set it to the absolute latest time I wanted an animation to start then offset that time lower depending on x position. 2 1 Jul. 13, 2024
  • Still don't quite understand the difference between trans and easeJayV3DI get that we apply a trans to the entire tween and eases to individual properties, but I don't really understand the reason for trans or how it is different to ease. If we were animating a single property, what difference would setting ease to EASE_IN_OUT be to setting tans to TRANS_QUAD, and do they stack on top of eachother, so the property would have an easing effect that was twice as strong? From the way it is named, I would expect trans to determine how two properties transition between eachother (As in, they mix using a quadratic fade rather than a linear fade), whereas an ease only effects the property it is attached to. However, if this were the case, setting trans would not work if you only had a single property - and as used previously in the course, it does. Edit: Okay, I think I get now that trans tells the eases which function they should use for, well, easing. But that still doesn't answer the final question - why does trans work on its own without setting any easing? 4 1 Apr. 19, 2024
  • Why use set_parallel() vs creating a new tween?BobbyDev> This code replaces the previously stored tween object in the `tween` variable with a new one. So, we're starting with a fresh object with no settings changed. This way, we can animate the item's vertical movement without affecting the scale and horizontal movement animations. I'm trying to understand this part of the lesson, but I'm getting a bit confused. It doesn't look like the tweens interact with each other at all, but rather the chest object itself; is that how it works? For example, instead of calling set_parallel(), I could just create another create_tween() and set the scale property to animate it in parallel right? I want to understand why doesn't set_parallel() just work across all property changes instead of having to create a new tween, especially since we're modifying different fields. 10 1 Apr. 17, 2024
  • What does TRANS_QUAD mean? And something else...EddyOnce again, thank you for the time you all spent to create this course. I learn a lot and discover game development with a great pleasure. You have my support for the future modules and I just dare to imagine how tough it is to create such a quality course. As the title says, and I looked into documentation to understand but unfortunatly I did not understand what TRANS_QUAD means and why do we use this one rather than another? And I take this opportunity to ask for something. One of the difficulties I have in this course is finding the problems that the task raises. I understand the concept to create smaller problems but how to learn that? Maybe it would be interesting to have some exercices on that subject. I don't know if it is planned even if it is part of the mindset to have. Thanks again for the time given. 4 1 Mar. 26, 2024
  • Code reference section correctionFlatwaterTo make the final code reference better match what was built in the previous sections, you could add a line around line 6: `@onready var animation_player: AnimationPlayer = $AnimationPlayer` and change line 44 to: `animation_player.play("open", 0.1)` Also, I don't think we covered lines 9 and 10: ```javascript get_viewport().physics_object_picking_sort = true get_viewport().physics_object_picking_first_only = true ``` 1 0 Oct. 31, 2024
  • Set_parallel confirmation?HazlarHi I was wondering, in the code we define the behavior of all tweens as running in parallel. But why the two tweens related to moving position:y don't run in parallel? It only works if they don't share the same action property? 5 0 Oct. 17, 2024
  • jump heightdatiswous ```javascript var jump_height := randf_range(30.0, 80.0) tween.tween_property(loot_item, "position:y", land_position.y - jump_height, HALF_FLIGHT_TIME) ``` Why do land_position.y - jump_height instead of just using jump_height directly? 3 0 Oct. 08, 2024
  • .y and :ydatiswousWhen do you use .x and .y and when do you use :x and :y ? 1 0 Oct. 03, 2024
  • Feedback: Scale animation too fastdatiswousI find it hard to see the scale animation from 0.25 to 1.0. Therefore I would recommend setting: `const FLIGHT_TIME := 0.6` Instead of 0.4. This way you can clearly see it move from 0.25 to 1.0. Otherwise setting scaling in the lesson makes no sense. 5 0 Oct. 02, 2024
  • confusion on tween.set_parallelnervous-woodpeckerI'm at the phase of learning where even formulating certain questions can be hard so bear with me. I understand that `set_parallel` runs all the tweens below it simultaneously. When we create our new tween object with `tween = create_tween()` for managing the y axis portion of the animation, we have a new object and therefore `set_parallel` isn't continuing to run? We run `tween.tween_property(loot_item, "position:y", land_position.y - jump_height, HALF_FLIGHT_TIME)` then `tween.tween_property(loot_item, "position:y", land_position.y, HALF_FLIGHT_TIME)` ?? Thanks for clarifying! 2 0 Sep. 13, 2024
  • Why create a new tween?Abdul Hannan AhmedIn the `_spawn_random_item()` function, we handle the tweens this way: ```gdscript var tween := create_tween() var jump_height := randf_range(30.0, 80.0) loot_item.scale = Vector2(0.25, 0.25) tween.set_parallel() tween.tween_property(loot_item, "scale", Vector2.ONE, HALF_FLIGHT_TIME) tween.tween_property(loot_item, "position:x", land_position.x, FLIGHT_TIME) tween = create_tween() tween.tween_property(loot_item, "position:y", land_position.y - jump_height, HALF_FLIGHT_TIME) tween.tween_property(loot_item, "position:y", land_position.y, HALF_FLIGHT_TIME) add_child(loot_item) ``` I still don't get why we created a second `tween = create_tween` when we already had one tween. I tried doing it this way: ```gdscript var tween := create_tween() var jump_height := randf_range(30.0, 80.0) loot_item.scale = Vector2(0.25, 0.25) tween.set_parallel() tween.tween_property(loot_item, "scale", Vector2.ONE, HALF_FLIGHT_TIME) tween.tween_property(loot_item, "position:x", land_position.x, FLIGHT_TIME) tween.set_parallel(false) tween.tween_property(loot_item, "position:y", land_position.y - jump_height, HALF_FLIGHT_TIME) tween.tween_property(loot_item, "position:y", land_position.y, HALF_FLIGHT_TIME) add_child(loot_item) ``` But what it did was first run the scale and the horizontal position tween parallel and then the vertical position tweens after that without the parallel applied. But the way we did in the course seemed different. It felt like the upper vertical jump was in parallel with the horizontal tween and the scale tween, so I tried this one: ```gdscript var tween := create_tween() var jump_height := randf_range(30.0, 80.0) loot_item.scale = Vector2(0.25, 0.25) tween.set_parallel() tween.tween_property(loot_item, "scale", Vector2.ONE, HALF_FLIGHT_TIME) tween.tween_property(loot_item, "position:x", land_position.x, FLIGHT_TIME) tween.tween_property(loot_item, "position:y", land_position.y - jump_height, HALF_FLIGHT_TIME) tween.set_parallel(false) tween.tween_property(loot_item, "position:y", land_position.y, HALF_FLIGHT_TIME) add_child(loot_item) ``` But it still was very different. I tried all of this because you said that creating a new tween object with `create_tween()` would remove the parallel from the tweens, so I did that, but it did not work. Thank you for the reply in advance! 2 0 Sep. 04, 2024
  • Items spawning behind previous chestrocinanteI noticed that sometimes, if I spawn items on a given chest, they will land behind the previous chest opened. Is there a way to set the items visibility layer so that all items always spawn above the chests? 2 0 Aug. 19, 2024
  • my animation moved a little after the jumpsneaky-butterflyit all looked fine, but moved a little at the end I couldn't find out what's the reason I need some help! ```gdscript extends Area2D @export var possible_items: Array[PackedScene] = [] @onready var canvas_group: CanvasGroup = $CanvasGroup @onready var animation_player: AnimationPlayer = $AnimationPlayer func open() ->void: animation_player.play("open") if possible_items.is_empty(): return for current_index in range(randi_range(1,3)): _spawn_random_item() func _ready() -> void: mouse_entered.connect(_on_mouse_entered) mouse_exited.connect(_on_mouse_exited) func set_outline_thickness(new_thickness: float)->void: 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 ,3.0,6.0,0.08) func _on_mouse_exited()->void: var tween := create_tween() tween.tween_method(set_outline_thickness, 6.0, 3.0 ,0.08) func _input_event(viewport: Viewport, event: InputEvent, shape_idx: int) -> void: var event_is_mouse_click: bool = ( event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.is_pressed() ) if event_is_mouse_click: open() input_pickable = false func _spawn_random_item() ->void: var loot_item: Area2D = possible_items.pick_random().instantiate() add_child(loot_item) var random_angle := randf_range(0.0, 2.0 *PI) var random_direction := Vector2(1.0,0.0).rotated(random_angle) var random_distance := randf_range(60.0, 120.0) var land_position := random_direction * random_distance const FLIGHT_TIME := 0.4 const HALF_FLIGHT_TIME := FLIGHT_TIME/2.0 var tween := create_tween() loot_item.scale = Vector2(0.25,0.25) tween.parallel() tween.tween_property(loot_item,"scale",Vector2(1.0,1.0),HALF_FLIGHT_TIME) tween.tween_property(loot_item,"position:x",land_position.x,FLIGHT_TIME) tween = create_tween() tween.set_trans(tween.TRANS_QUAD) tween.set_ease(Tween.EASE_OUT) var jump_height := randf_range(30.0,80.0) tween.tween_property(loot_item,"position:y",land_position.y - jump_height,HALF_FLIGHT_TIME) tween.set_ease(Tween.EASE_IN) tween.tween_property(loot_item,"position:y",land_position.y,HALF_FLIGHT_TIME) ``` 5 0 Aug. 04, 2024
  • The translation program is a little jerky. I have a little problem.apt-mooseDoes this tutorial cover all **Node Essentials Godot 4 Edition's** tutorials? 1 0 Jul. 21, 2024
  • Confused about tween_method and tween_propertyminiature-gazelleWhats the difference between those two, and when do i use the one or the other? 1 0 Jul. 15, 2024
  • L6 vs L7 - I must have missed a couple things... snowm8nAfter completing L6 and L7 with significant help from the Code Reference and Q&A (thanks to everyone), I have progressed to L9. While working through L9 (no assistance needed yet), I revisited L6 and L7 to understand discrepancies between the Code Reference (**CR**) and my code (**MC**): Line 28: **CR:** func _input_event(viewport: Node, event: InputEvent, shape_index: int): **MC:** func _input_event(viewport: Viewport, event: InputEvent, shape_idx: int): - I couldn’t find where the lesson moved from viewport: Viewport (L6) to viewport: Node (L7)  - I was using idx: int (vs) index: int (I picked this up somewhere - maybe borrowing code from a  fellow student or Google… but I couldn’t find any reference in the class lessons or Code Reference)  - I noticed that `items_with_picking.gd` uses `shape_idx`, adding to my confusion. I've since standardized my code to use “index.” Line 52: **CR:** var loot_item: Node2D = possible_items.pick_random().instantiate() **MC:** var loot_item: Area2D = possible_items.pick_random().instantiate() - In L6, we used `Area2D`, but in L7, it switched to `Node2D` – not sure how I missed this. Line 58 **CR:** var random_distance := randf_range(60.0, 120.0) **MC:** var random_distance := Vector2(60.0, 120.0) - Not sure where I messed up here... Final Status: I eventually compared my code with the solutions folder and updated the discrepancies. Initially, the crates wouldn't open, and no items spawned, but after deleting and replacing all the chests in the scene, everything worked correctly. Overall, no rush but I wanted to start sharing my missteps and see if there's some easy answers. 1 0 Jul. 02, 2024
  • Why using ":=" for constants ?ChanclinkIf we cannot change it's value, doesn't that mean it will never change of type too ? so why do we add a type hint (I think it's the name) ? 2 0 Jun. 07, 2024
  • Why do we subtract the jump height?filthy-rook```gdscript tween.tween_property(loot_item, "position:y", land_position.y - jump_height, HALF_FLIGHT_TIME) ``` On this line why is the jump height subtracted from the final landing position? I tried messing with the value to try to get a grasp on what's happening but this particular bit has me stumped. 4 0 Apr. 09, 2024
Site is in BETA!found a bug?