Calling a Signal within a signal

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ashish

How can I call a signal within a signal?

I want to implement:
-if a touchscreenbutton has been after pressed.
only after that
-if an Area2D area is entered (through a collisionshape2d), body entered signal is generated.

Thanks in advance.

:bust_in_silhouette: Reply From: njamster

Use a boolean to keep track of which conditions have been fulfilled:

var button_pressed = false

func _on_TouchScreenButton_pressed() -> void:
	var button_pressed = true

func _on_Area2D_body_entered(body) -> void:
	if button_pressed:
		# ...    enter code here

Thank you very much. This works.

ashish | 2020-09-25 19:03