Revision Difference
CreatingDoor#547229
<cat>Dev.Map</cat>
<title>Creating a Door</title>
This guide is a step-by-step tutorial to create a simple door. We are going to use [tools](https://wiki.facepunch.com/sbox/Creating_your_first_gm_flatgrass#knowingyourtools) from Hammer.
In S&box the doors are called **`ent_door`**. They are simple to use.🚪
# Making a door step-by-step
## Step 1:
With the **Entity Tool** ( <key>SHIFT</key> + <key>E</key> ), create a new ent_door. You can search or choose the Entity Class: `ent_door` in the *Tool Proprieties* window. You can also create an entity *(like a `prop_static`)* and change class.
<upload src="a768a/8da58637803d922.png" size="932871" name="step-1.png" />
<upload src="a768a/8da71e14bcb2184.png" size="774190" name="step-1.png" />
## Step 2:
You can now edit Object Proprieties. Select the **Objects** ( <key>5</key> ) mod and select the door. You can see the window objects proprieties lower right corner. You can have a bigger window by double-clicking on the entity.
You can verify the class of the object in "*Class*". Choose a name for a door and set a "*World Model*". You can put the name of the model or use the *magnifying glass* <key>🔍</key> in the right corner. When you see the door on the preview, you can see that the door is now on your map.
Change the position of the door if you need to fit it with the **Move Tool ( <key>T</key> )**.
<upload src="a768a/8da58643ea38dc4.png" size="908525" name="step-2.png" />
<upload src="a768a/8da71e16485635c.png" size="811419" name="step-2.png" />
## Step 3:
Now we are going to make the opening animation. You can choose a `Rotating` door or a `Moving` door. Change to the type you need.
- A **"`Rotating`" door** is a door that rotate on an axis. The animation is like when you use the rotating tool around the origin.
- A **"`Moving`" door** is a door that move in a direction. The animation is like when you move the door using the move tool on an axis.
Now we are going to set the "Distance". It's the amount that the door can make in the opening animation.
- **For the Moving door:** The amount, in inches, of the door to leave sticking out of the wall it recedes into when pressed. Negative values make the door recede even further into the wall.
- **For the Rotating door:** The amount, in degrees, that the door should rotate when it's pressed.
In our example, we want to make a rotating door that open to an angle of 90 degrees. Put The movement type to "Rotating" and the distance to "90".
The door is now functional, you can see a blue block next to the door that shows what the door can do.
*`Note: Step after this one are optional`*
<upload src="a768a/8da5864d0b2982c.png" size="837084" name="step-3.png" />
<upload src="a768a/8da71e17d3d9997.png" size="728656" name="step-3.png" />
## Step 4:
We are going to add details.
I want a door that opens slowly. In **"Speed"**, put *150*. By default, the speed is *100*, you can speed up or slow down the animation by changing the number.
I want a door that closes itself after 10 seconds. In the **"Auto Close Delay"**, I put *10*. You can change this delay if you want the door to close quickly or slowly. The amount of time is the seconds after the door has opened before it closes automatically. If the value is set to *-1*, the door never closes itself.
## Step 5:
If you test it, you are going to see that the door is silent. We are going to add sounds. Go to the **"Sounds"** category and expend it with the <key>+</key>. Choose a sound by clicking on the *magnifying glass* <key>🔍</key> to the right. You can hear the sound by clicking on the play button <key>▶️</key>.
| Name | Description |
|------|-------------|
|**Start Opening Sound**|*Sound to play when the door starts to open.*|
|**Fully Open Sound**|*Sound to play when the door reaches its fully open position.*|
|**Start Closing Sound**|*Sound to play when the door starts to close.*|
|**Fully Closed Sound**|*Sound to play when the door reaches its fully closed position.*|
|**Locked Sound**|*Sound to play when the door is attempted to be opened but is locked.*|
|**Moving Sound**|*Sound to play while the door is moving. Typically this should be looping or very long.*|
For the example, I choose sounds from the UI.
<upload src="a768a/8da58657e50b72d.png" size="89098" name="step-5.png" />⤶
## Step 6:⤶
⤶
## Step 6:⤶
If you want a double door or connected door, there are two ways to make them. Create another door and put it where you need it.
1. If two doors have the **same name**, Source think it's the same door. Rename your second door with the name of the first. They are now connected.
2. In the **"Other Doors To Open"** section, put the name of the other door. Do this for the two doors, and they are now connected.
*`Note: For the second door, if you want to open it in the same direction as the first, you probably need to rotate it and put a negative value for the distance`*
<upload src="a768a/8da5866708b0e8e.png" size="665658" name="step-6.png" />
<upload src="a768a/8da71e20628227d.png" size="607268" name="step-6.png" />
# Result
When you use <key>E</key>, you can see your door working.
<upload src="a768a/8da58676ee80577.mp4" size="4166296" name="result_single.mp4" />
<upload src="a768a/8da586785b06a35.mp4" size="4629444" name="result_double.mp4" />
Learn more about door here: <page>Hammer.DoorHelperAttribute</page>
Learn more about ent_door in s&box: [Reimagining Base Entities](https://sbox.facepunch.com/news/aug2021#ReimaginingBaseEntities)