Godot Version
4.6
Question
Helloooooooo! I’ve got some code for this, but basically, i just wanted to make a fake computer that you can add tabs to/close tabs. Im slowly realizing drawing each state it could possibly be in would be pretty hard work, so is there a better way to do that?
RIght now, I have it set up so that a button is over a drawn background with the new tab symbol, and the sprite texture (which is the computer screen) would be hidden. when i tried to toggle visibility this way, though:
extends Node2D
@onready var sprite1 = $Sprite2D
func _on_button_pressed():
sprite1.is_visible_in_tree = false
It kicks me out of the test game with the error “E 0:00:06:916 _on_button_pressed: Invalid assignment of property or key ‘is_visible_in_tree’ with value of type ‘bool’ on a base object of type ‘Sprite2D’.
1_st_day.gd:6 @ _on_button_pressed()
1_st_day.gd:6 @ _on_button_pressed()”
How do i fix this error? Better yet, is there a better way to make a working fake computer that would only have a few tab options in the first place (error screen, pre-made search quiries, and some other game elements)?