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.
How do I show particle effectshumble-pelicanHi, I want to ask why this particle can't be previewed when I make it? I see that the ConfettisParticles scene in the solution folder cannot be previewed, so how to adjust the parameters? thank you~21Jan. 11, 2025
Confettis don't spawn on the right positionGoatzHey !
Here's my code for the end menu :
```gdscript
extends Control
@onready var time_label: Label = $PanelContainer/VBoxContainer/Time_Label
var start_time := 0.0
@onready var play_again_button: Button = $PanelContainer/VBoxContainer/PlayAgain_Button
@onready var quit_button: Button = $PanelContainer/VBoxContainer/Quit_Button
var confettis_amount := 5
func _ready() -> void:
visible = false
play_again_button.pressed.connect(func () -> void:
get_tree().reload_current_scene()
)
quit_button.pressed.connect(func () -> void:
get_tree().quit())
func open() -> void:
visible = true
get_tree().paused = true
var stop_time := Time.get_ticks_msec()
var time_elapsed = (stop_time - start_time) /1000
time_label.text = "Time: " + str(snappedf(time_elapsed, 0.01))+ " seconds"
spawn_confettis()
func spawn_confettis() -> void:
var viewport_size := get_viewport_rect().size
for i in confettis_amount:
await get_tree().create_timer(0.25).timeout
var confettis : GPUParticles2D = preload("res://common/particles/confettis/confettis.tscn").instantiate()
var confettis_spawn_position := Vector2(randf_range(300.0, viewport_size.x -300.0), viewport_size.y)
confettis.global_position = confettis_spawn_position
get_tree().root.add_child(confettis)
confettis.emitting = true
confettis.finished.connect(func () -> void:
confettis.queue_free())
```
I have two questions :
1) The `get_viewport_rect().size` seems to ignore the camera and spawns the confetti emitters at a position based on the root node of the scene instead (meaning inside the default violet outlined viewport). I don't understand what's happening. Did I miss something ?
2) Adding the confetti emitters as children of the end_menu (with a simple `add_child()`) didn't seem to work in my case, so I had to add them as children of the root node (with `get_tree().root.add_child()`). I made sure the process mode of both the end_menu and the confetti emitters are on "Always" but that didn't seem to do it. I'm not sure why I had to do this ?
__________
Sorry, I've been spamming with a lot of questions lately but I want to be sure to fully understand everything I do (right or wrong =) ).
Thank you so much !30Mar. 20, 2025
get_tree().paused = true prevents the buttons to workPJI noticed that setting `get_tree().paused = true` in the menu script causes the buttons to not work. As a workaround, I toggled the player's process to false instead of pausing the entire tree. However, I'm not satisfied with this solution because the mobs continue to process. My intuition suggests the issue might be related to the scene tree, but I can’t quite pinpoint it. Below are my code and tree structure for reference.50Jan. 11, 2025
Where does Shader go?white-eagleHi! really enjoying the whole course, just got stuck with adding the shader!
I wanted to give it a try, but couldn't figure out where to assign the shader. I tried it in Material, but if I add the shader to material, preview does not work. could you walk me through where I can apply the 3D confetti effect shader?30Dec. 08, 2024
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.