- Edited
Hello, I'm a very new user and on day 2 of learning Game Dev, please bear with me, could someone assist me with connecting some signals from a UI Scene to my Player?
This is my Level Up Screen code with a button_pressed signal.
extends Control
signal increase_speed
@onready var player = get_node("/root/Game/Player")
@onready var lus = get_node("/root/Game/UILayer/LevelUpScreen")
func _on_levelup_button_pressed():
player.emit_signal("increase_speed", 50)
lus.visible = false
Now I read the page on Godot 4 docs about connecting signals through code, but I genuinely don't understand it and I've been slowly killing my braincells for the past 2 hours on this and various other issues, how is y'all night going?
What I got in /Root/Game/Player
func _ready():
var level_up_screen = get_node("/root/Game/UILayer/LevelUpScreen")
level_up_screen.increase_speed.connect(_on_increase_speed)
func _on_increase_speed(value):
speed += value
I will come back to this tomorrow with a fresh mindset, but would genuinely appreciate any help that you can provide.