Godot Version 4.2.1
My sprite is supposed to be not visible when the game starts and visible when the player presses the spacebar please check my settings and code and tell me what you think i did wrong
Godot Version 4.2.1
My sprite is supposed to be not visible when the game starts and visible when the player presses the spacebar please check my settings and code and tell me what you think i did wrong
You assigning current Node visibility boolean state instead of changing it.
To change visibility:
boop.visible = false
boop.visible = true
To toggle visibility:
boop.visible = !boop.visible
that still didn’t fix the problem but thanks for pointing that out
It’s hard to figure out, what is problem, without seeing screenshot of your scenes node tree.
For example, this code will toggle visibility of itself and all it’s child nodes by pressing “space”:
extends Node2D
var boop = self
func _ready():
boop.visible = false
func _process(delta):
if Input.is_action_just_pressed("ui_accept"):
boop.visible = !boop.visible
It doesn’t use signals, but you can create function instead of process and input handling, and just call it using emitted signal.
thanks that will work for now you see I was trying to create a signal so the player could drop the poop sprite on something at the bottom of the screen and do it as many times as they hit the space bar this a useful solution, I may not keep it when i write more code for my game thought