How to activate an action if two buttons collide?

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

I have a joystick system. The system have four buttons surrounding the outline axis, each button has an action assigned.

I need to activate the buttons if they are tuched by the joystick handle, wich is also a button.

:bust_in_silhouette: Reply From: Help me please

I am not clear but I think that by default you want other four buttons be deactivated. And they would be active by pressing handle button. Then you need to perform that action after the handle’s button is pressed.

if event.is_action_pressed("handle's_button"):
  print("now all buttons are active") 
  #perform all actions in this if block
  if event.is_action_pressed("button_1"):
    print("button_1 along with handles button was pressed")

Hi, thanks for the answer.

Amm, the joystick is intended for a walking system in a third person shooter and the buttons are intended for other actions such as dash. Due to the fast nature of the gameplay the buttons needs to be activate with the handle button.

I have seen in some tutorials that is possible using collision detections with an area2D and rigidbody2D. In this case the handle joystick button will have a rigidbody2D, if the rigidbody2D tocuh the area2D of the buttons then is possible to use the collision to trigger the buttons or the actions they have assigned.

One good example is the dodge creep game used in the Online Godot documentation. In that game if the player enter in contact with the creeps the game over sreen appears.

In my case the joystick handle button will be the creep and the buttons will be the players, XD.
I try to emulate this but with no results.

Zero323 | 2021-06-19 14:10