How to make door open Press a button in platform game

Godot Version

4.3

Question

Hello I’m trying to do a little platforming game where the player’s character jumps on a button and the door opens I would like to know

  1. How to get a button on the singlal door and how to make different buttons work to open different doors in the same scene

  2. How can you do that some of the buttons you prevent the door from opening

  3. how to get the door to open when two buttons are press

Make an open function on the door and connect it to the pressed signal on the button. You can also make a lock function or just a locked variable for buttons that prevent the door from opening.
A slightly more advanced way would be to create two scripts, SignalEmitter and SignalReciever. The emitter would be added as a child to the button, and the reciever as a child of the door. The Emitter would have an array variable of recievers which you can manually assign from the inspector, and would call a function on all recievers when it emits. The recievers can then pass that to the door or whatever other node you want to recieve the signal.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.