View Full Version : Tutorial 1.3 - Designing a Basic Elevator

Logic Pack
11-05-2009, 01:41 AM
Tutorial 1.3 - Designing a Basic Elevator
By CCubbage (http://www.lbpcentral.com/forums/member.php?u=1923) and comphermc (http://www.lbpcentral.com/forums/member.php?u=4697)

In this tutorial, we'll be covering how to build a basic elevator that will take you from one floor to another. We'll also be including a set of working doors to the elevator, so that the elevator behaves more realistically. Let's get started, shall we?


The first thing we need to do is construct an elevator shaft. Before we do so, we will enable the small grid so it will be easy to place the elevator and to maintain consistent, straight lines. Here, we have constructed the shaft for the elevator to fit into the middle thin layer. The back thick layer is exactly the same as the middle except it does not have a shaft cut into it. The player will navigate in the front thick layer.


Next we create the front, thick layer. It is the same as the middle layer except it has had a floor and ceiling cut out from it. Also, we have cut down into the floor so we have access to the bottom of the elevator shaft. The bottom of the shaft should be one small grid layer beneath the floor in the front layer.


We don't want our level moving around on us, so we glue a piece of Dark matter to our thick layers.


Next we will construct the elevator using the small grid. This will consist of a rectangle with a rectangular hole in the middle. One thing to keep in mind when constructing the elevator is that we don't want the elevator to rub against other material while ascending- this could cause friction which would prevent the elevator from working properly. So, we could either make sure the elevator has no material to the left and right, or we can turn off the grid and slightly decrease the size of the elevator once it is drawn. We have made the elevator slightly smaller than the shaft around it. Also, we have put a back thin layer on the elevator (gluing it, of course). This will allow us to place a sensor switch later.


By keeping the small grid on, we can grab our elevator and move it up a few spaces. Attach a piston to the elevator and the bottom of the shaft as shown in the accompanying image. We want to ensure the piston is set to stiff, and we have set the timing to be 7 seconds. Your model may vary, and that is fine. We will also want to set the length limits for the piston. Keep in mind that one small grid space is equal to 2.5 units. Set the minimum length of the piston so that the elevator is flush with the bottom of the shaft.


Repeat this process for the top of the shaft. Notice that we have carved out a one grid tall "hole" in the middle thick layer. This is so our elevator goes slightly above the top of the front thick layer (and it just looks a bit nicer).


Next, we add the sensor switch to the back of our elevator (don't be frightened, we changed the material to cardboard for continuity with the rest of the level). Set the sensor switch to be just smaller than the inside of the car, but large enough that it will activate anywhere in the car. We don't want it to activate unless the player is actually in the elevator. It might be a good idea to set this to be 'require-all' so it is multiplayer friendly. Set the output for the sensor switch to be directional.


Next, we are going to add a delay switch, which can be found in the Beginner Logic Vault. If you do not have one, either go copy it now, or construct your own. By default, the trigger area for the magnetic key switch should be as shown. When the key extends beyond this zone, the magnetic key switch will trigger (since it is set to inverted). Here, we have set the timing of the piston to be 5 seconds.


Time to do some wiring! Wire your directional sensor switch to the piston in the Delay Switch. Wire the magnetic key switch in the Delay Switch to the piston of the elevator car. Ensure the output for your Delay Switch is directional.

At this point, our elevator will actually work. However, we will continue by adding some doors and making it a much more complete package.


We start by actually creating the doors (as shown in blue). You can use the grid to create the doors, but it might be a good idea to turn off the grid to get the sizing right. They should look similar to the doors in picture.


Turning the grid back on (if it was off), allows us to grab each door and pull it to the side. Move the doors just outside the width of the elevator and attach pistons. If symmetry is needed, pistons can overlap one another, but we have offset them for simplicity. It is at this time that we need to tweak the max and min distance of each door. Since it's symmetric, you just need to calibrate one piston and copy the settings to the other. We have set the timing for each to be 2 seconds. Make sure they are both stiff.


Next, we add in the last piece of our logic. You should notice that this looks very similar to the Switcher that is given away in the Beginner Logic Vault. We have modified it slightly to achieve our intended goal. We have the piston set to run from 0 to 10 units, so that at each end it will stop over top one of the keys. You should tweak the trigger radius of the magnetic key switch to match the image. We have set the timing of this piston to be 10 seconds. It's purpose will be explained shortly.


We want to wire the sensor switch in the back of the elevator to the piston in this modified Switcher that was just added. Then, we want to wire the magnetic key switch in the Switcher to each of the pistons on the elevator doors.

What will happen, now, is that when the player steps on the door, the piston in the switcher will slowly extend. When the magnetic key switch is not directly over one of the keys, the doors of the elevator will close. By setting the timing of the piston to the correct measure (by trial and error, really), we can ensure the doors of the elevator close when the player steps on the elevator and open when the elevator reaches the top floor.


Next, we go through and "smooth" out the front thick layer. We close up the hole that was cut from the floor to access the bottom of the elevator shaft, and we cover up the visible shaft.


Everything's pretty much done at this point. You may want to add a scoreboard at some point so players can complete the level. If you'd like, you're free to go through and add details and sounds wherever you deem fit.