5. Doors

To create a Door, you have first to build another room. Remember that your level must be sealed, so you cannot create a door that opens on nowhere or put any entity outside the world.
You will see how to create two types of door. A sliding door and a swinging door.

First, let's create a corridor. Switch to Template Mode,

in the Template Panel, click on the Create Box button,

set the Top and Bottom sizes, X & Z, to 320, the Y Size at 360, select Hollow (no Cut Brush) and click OK.

Before moving the blue brush in the Top View, verify that you are in Move/Rotate Brush mode.

Then move the blue brush (the corridor) in the Top View as shown in this picture:

and press the Enter key.
Now, you have to make a hole in the wall between the first room and the corridor. Still in Template Mode, click on the Create Box button in the Template Panel.
Set the Top and Bottom X Sizes to 200, the Top and Bottom Z Sizes to 50, the Y Size to 260, select Solid and Cut Brush and click OK.

Move the cut brush in the Top and Side Views as follow (remember that you have to be in the Move/Rotate Brush mode):


Then press the Enter key.
To create a perfect door, it has to fit perfectly the frame (cut brush). The best way to do so is to clone our frame and to change it from a Cut Brush to a Solid Brush.
Switch to Select Mode (to clone, the "Move/Rotate", "Scale" or "Shear" Modes must be DESELECTED),

select the door frame (you can see that a cut brush is shown in orange), lock the X axis by clicking on the Lock X button,

hold down the Shift key and drag and drop the door frame a few texels up. Click on the Face/Brush Attributes button,

change the Type of the brush to Solid and and check Area.

Switch to Scale Brush mode,

and scale down (decrease the thickness) the door in the Top view as shown below (the door in cyan and the frame in orange):

Unlock the X axis by clicking on the Lock X button. In the Texture Panel, change the texture of the door. You can also change the texture of the corridor the same way you did for the first room in the Chapter 2.

To use the Door Entity, you need first to create a Model and attach the door brush to it. This way, you can set the motion of the door.
Still in Select Mode, select the door brush.
You want the door to slide, so we lock the Z axis by clicking on the Lock Z button.

Go in the Models Panel, click the Add Model button. A dialog box asks you to enter the model name. Enter "door1" and click OK. You will now create the KeyFrames.
Click on Animate, move the door brush to the right in the Top View like if the sliding door was fully opened, click Stop Animating and enter the key time 1. This means that the door will reach this position after the first second of the animation.

Click on Animate, don't move the door brush, click Stop Animating and enter the key time 1.01. This value help the engine to play a smoother animation.
Click Animate, don't move the brush, click Stop Animating and enter 3. This means that between the first and the third second, the door won't move and stay open for 2 seconds.
Click Animate, click Stop Animating, enter 3.01. Help the engine like previously.
Click Animate, move the brush back EXACTLY to its original position, click Stop Animating and enter 4.
Click Animate, Stop Animating, enter 4.01.
The Models Panel should look like this:

You can now unlock the Z axis.
Now you need to add the Door entity. Switch to Template Mode, go in the Template Panel, select the door entity in the Entity List, click on the "light bulb" button, move the entity close to the door and press the  Enter key.
Click on the Entity Dialog button, choose the Door1 entity in the Drop down menu.

Double-click on the Model parameter, choose the "door1" model and close the Entity Dialog box.
 

Now, you'll create the second room by cloning the first one. I suggest you zoom out a bit in the Top View to see a bigger part of the world. Switch to Select Mode. In the Top View, select the first room.
Hold down the Shift key and drag and drop the first room brush as shown below:

Do the same with the cut brush to make the same frame door between the corridor and the second room.

You cannot clone the door brush because it's attached to a model. By doing so, you would add a second door to the "door1" model which is attached to the Door1 entity that will trigger both doors at the same time.
Create the second door the same way you did with the first one.
Select the door frame (cut brush), lock the X axis, hold down the Shift key, drag and drop the frame a few texels up.
Click on the Face/Brush Attributes button, change the type from Cut to Solid and check Area. Texture it if you want.
Switch to Scale Mode and scale the door (decrease its thickness compare to the original Cut Brush thickness) like you did with the first one. And remember, it has to fit perfectly the frame in X and Y for the Area to work. Unlock the X axis.
With the door brush still selected, open the Models Panel and click on Add Model. Enter the name "door2".
Click on the Animate button, and click twice on the Rotate 45 button.

Move the door as shown below:

Click on the Stop Animating button and enter the key time 1. Like you did with the first door, insert another KeyFrame, without moving the door, and enter a key time of 1.01.
Click Animate, don't move the brush, Stop Animating, key time 3. Same with a key time of 3.01.
Click Animate, click 6 times on the Rotate 45 button, move the door EXACTLY on its original position, click Stop Animating and enter a key time of 4.
Then, another KeyFrame without moving the brush, with a key time of 4.01.
The Models Panel should look like the first door but for the name, door2.
Switch to Template Mode, go on the Template Panel and choose the Door entity in the Entity List.
Click the "light bulb" button, move the blue cross close to door in the Top View and press the Enter key.
Click on the Entity Dialog button and choose the Door2 entity. Double-click on the Model parameter, choose the door2 model and close the Entity Dialog box.
 

You are now ready to compile, but before, you should add a light in the second room like you learned to do in the Chapter 2.2. Give it a value of 800.
Now, compile and run.
Here's a screenshot where you can see I'm in the second room. Behind the actor running towards me, you can see the sliding door closing behind her while the swinging door open between us.

PS: Believe me! It's not easy to take some screenshots with all these girls shooting at me in these small rooms!