How bool and button work together

I was testing how bool works with buttons but when I did, there was a problem with print(). My original result was:

false
false
false
false

and when entering true the result is:

false
true
false
true

how to make all the results true?

extends Node2D

var Button_active : bool

func _process(delta):
	print(Button_active)

func _on_logo_hape_pressed():
	Button_active =  true
	print("ini hape: ",Button_active)
	hide()

func _on_logo_laptop_pressed():
	Button_active = false
	print("ini laptop: ",Button_active)
	hide()

I don’t get what you’re trying to do here. You’re printing a boolean on each rendered frame (that is, in _process) and since you didn’t initialize it, it will be false by default. None of that has anything to do with how “bool and button work together”.

ohh so there’s nothing to do with it thanks for the info, I just want to know why when I press the active button the initial result isn’t true

1 Like