# The Haunted Library Part 1: Droning the Exterior

Planning
Step 1
Welcome to the Library. . .

In this lesson, we will be building the outside of a giant library using the ScriptCraft Drone.

Step 2
Choose a location

Instead of having to target a block each time we rebuild the library like we did with the Temple Dungeon, we are going to define a location where it builds every time.

You may want to use `/js box(blocks.air, 30, 20, 30)` to clear out some space.

Information
Step 3
Yaw and Pitch

With the drone, you need to know two things:
- where it is (X, Y, Z)
- which way it is facing (yaw).

Yaw means which way you are facing, if you look from left to right. It is also the North, South, East, and West in the game.

The drone only has 4 possibilities, so we will always give it either 0, 90, -90, or 180.

Pitch refers to the angle up and down. This doesn't affect the drone, so we will always give a pitch of *0

Step 4
Save the location for the outer corner

Make a new object called `library`, and give it a property, `outerCorner`, that refers to the location of the front right corner of the building.

### Your location will be different!

Step 5
Make a function to build the library

Define a new export function to put the first quartz base for the library, using this location.

Step 6

Save, deploy, and reload on your server. Then, test that your function is working and appearing in the correct spot by calling `/js buildLibrary()` in the console.

Step 7
Build steps around the edges

Because we want the stairs to always face in, we need to build each side one at a time. Us this for loop to build one row, then turn and move over for the next one.

Step 8

Save, deploy, reload on your server, and call `/js buildLibrary()` again.

Challenge
Step 9
Build the next tier

Your challenge is to build the next 2 tiers of the base of the library building.
- Review the diagram below for block counts
- Think back to the beacon you made in the first drone lesson
- You can probably re-use some code for this.

Step 10

Have the drone build a pillar that is 6 blocks tall, and then more right 4 blocks. Using a for loop, we can repeat this code 7 times to create all the pillars.

Planning
Step 11
Where is the drone now?

After each column, the drone moves right 4 blocks. At the end of the loop, the drone should be 4 blocks to the right of the last pillar.

How can we move it back? Checkpoints!

Step 12
Create a checkpoint

You can create a checkpoint any time in drone code, by using `.chkpt("name of my checkpoint")`, with any name you want in the `" "`.

Once a checkpoint exists, you an use `.move("name of my checkpoint")` to get the drone to go there.

Challenge
Step 13

We want to add stairs on either side of the middle column, because this is where the doors will be. Check out the diagram below to see where you need to move the drone.

Step 14
Build the library walls

We're going to use the hollow box drone method (`.box0()`), then build columns and doors into it.

Step 15
Check out your library outer walls.

Save, deploy, reload, and call `/js buildLibrary()` on your server.

If things are not in the correct place, make sure you spelled the name of your checkpoint exactly the same each time.

Challenge
Step 16

This challenge is optional, but if you want to see out, add some windows!

1. Move the drone back to the "inner column corner" checkpoint
2. The doors were 1 block up, so for these windows the drone will need to move up 2.
3. Count the blocks between each window, and move right that many blocks + 1
4. Try using `blocks.glass_pane` or `blocks.stained_glass_pane.gray`
Step 17

We're going to add a quartz block roof with a half-slab quartz block all around it. In the diagram, the red circle represents where the drone starts once you move it up.

Step 18
Check out the roof

Save, deploy, reload and call `/js buildLibrary()`.

Make sure you walk all around the building to check that the roof is the right size and shape.

Planning
Step 19

To give a roof a more interesting shape, we will use the `prism()` method to add a house-shaped roof (YouTubers sometimes call this the "newb roof").

To make it face the correct direction, we need to move the drone to the back of the library and turn it.

Step 20
Add a triangular prism to the roof

Just like `.box0()`, `prism0` will build the outside blocks without filling it in. Add this code to move the drone into position and build the first layer of the prism roof.

Step 21
Check out the roof now!

Save, deploy, reload, call `/js buildLibrary`.

Make sure to check the roof on all sides to be sure that it's centered and not hanging over anywhere.

Planning
Step 22
Adding more layers to the roof

We are going to use the `.prism()` method to fill in this roof. The chiseled quartz blocks will be one block in from the roof, and the air blocks only go on the part that is inside the library walls.

Step 23
Fill in the prism

Add a second quartz block layer, and the chiseled quartz inside.

Step 24
Check out the filled-in roof

Save, deploy, reload and call `/js buildLibrary()`.

Step 25
Clear out space with air blocks

Make a prism of air blocks to open up the inside of the roof.

Step 26
Check out the inside of the roof

Save, deploy, reload and call `/js buildLibrary()`.

Then, go inside to see the empty space below the roof. Make sure that the walls on either side line up.

Planning
Step 27
You built the exterior!

That's it for the outside of the library!

In the next lesson, we will learn how to add our own custom methods to the Drone, and use those to build out the inside of the library.

The Haunted Library Part 1: Droning the Exterior Info

Account

MVCode Clubs

Created By

Course:

The Haunted Library

Access Level