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.
Blur & Tint ShaderGHi,
I was wondering, there is anyway to fix the shader so it will work on a browser?
How do I know if a shader performs post-processing?10Feb. 11, 2025
Assiging a reference to the menu node in the teleporter?SpellingSwordAre there any drawbacks to using something like:
`@export var menu: WinMenu = null`
inside the teleport script and dragging the menu there inside the main game scene?
This way you don't have to attach a script to the root node - or put the teleport logic there if you already have one.10Feb. 10, 2025
My code + a questionmilk_manSorry for the barrage of questions lately. Firstly, here is my code:
teleporter.gd:
```gdscript
extends Area2D
@onready var menu: Menu = %Menu
func _ready() -> void:
# deactivates player controller
body_entered.connect(func(body_that_entered: Node2D) -> void:
if body_that_entered is Player:
if menu == null:
return
menu.toggle_menu()
)
```
menu.gd:
```gdscript
class_name Menu extends Control
var start_time: int = Time.get_ticks_msec()
@onready var _time_label: Label = %TimeLabel
@onready var _play_button: Button = %PlayButton
@onready var _quit_button: Button = %QuitButton
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
visible = false
_play_button.pressed.connect(func() -> void:
get_tree().paused = false
get_tree().reload_current_scene()
)
_quit_button.pressed.connect(func() -> void:
get_tree().quit()
)
func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel"):
toggle_menu()
func toggle_menu() -> void:
var end_time: int = Time.get_ticks_msec()
var time: float = (end_time - start_time) / 1000.0 # divide by 1000 to get time in sec
visible = not visible
if visible:
# snappedf rounds in this case to nearest 0.01 sec
_time_label.text = "Time: " + str(snappedf(time, 0.01))
get_tree().paused = not get_tree().paused
```
I must say I kind of enjoy the style of using smaller, node specific scripts rather than large and broad scripts. Anyways, I saw that under the hints, when talking about how the teleporter script could toggle the menu, making the menu unique wasn't mentioned as a possible solution. That made me kind of unsure. Isn't it a simpler solution then what is proposed under the hints
30Feb. 05, 2025
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.