How do i make a swinging door like Hotline Miami?

How do i make a swinging door like Hotline Miami?

We need more info. At least I do. Is this a top-down view? Does the door open by itself or through collision? Does it open fully or does the character have to push it to open it all the way? Does it stay open?

1 Like

Top down. Thorough collision, have to push. In short, i am making a clone of Hotline Miami

This was tough but fun. I’m not great with Physics Joints. I decided to use a revolute Joint.

Try online (the player uses the arrow keys to move)

Source
doug13579/Gdevelop-swinging-door (github.com)

This is the code but it doesn’t tell the full story.

This is the add revolute joint:

The door and hinge objects have the physics behavior. The only settings I changed were:
Hinge: Type: Static
Door: Gravity scale =0

I added a point called “hinge” on the door for the hinge. I set the minimum and maximum rotation values as door object variable to each door. There might be an easier way to create a formula but IDK if all doors are equal. It depends on the angles of the nearby walls.

I also put the door and walls into a group named room.

1 Like