Flatland

Tutorial

4 | The < body > tag

The Body
The body of a 3DML file is where you finally get to make the map itself. There are five main activities that are handled in the < body > tags are: customizing blocks, creating the map, creating popups, assigning image maps, and assigning entrances and exits. First we will create a simple map and an entrance. We’ll talk about all those other aspects shortly.

The Map
The map is made up of individual levels that act just like stories of a building. Each level in a spot must have the same number of rows and columns. If you need to add extra rows or columns to a spot you have already been working on, you will need to add those rows or columns to every level in the spot.

Each level in a spot is bounded by the < level >…< /level > tags. The < level > tag has just one attribute: number. Number=”1″ refers to the bottom level of a spot, just like floors of a building. Any character between the < level > tags will be interpreted as a block. All blocks occupy the space of a cube with 256 pixels in every dimension (256 x 256 x 256).

For this first map we will use just two kinds of blocks. You can find a complete list of blocks in the Block Reference Guides.

The full block “#”
The full block is a solid cube, filling up the entire 256 x 256 x 256 block space.

The empty block “.”
Nothing but virtual thin air. The empty block is just a place holder that keeps your maps looking like easy-to-read grids.

Put the following code between the < body> tags in your 3DML file:

< level number="1" >
###…###
#…….#
#…….#
#…….#
#…….#
#…….#
#…….#
#…….#
#########
< /level >

The < entrance > tag
You must always specify at least one entrance for your spot. The entrance doesn’t look like anything, it is just the place in the spot where your visitors will first land. The < entrance > tag has three attributes: location, name, and angle. An < entrance > tag can be placed anywhere within the < body > tag. Some builders prefer to put their < entrance > tags immediately following the level in which they occur. Other builders prefer to keep all of their < entrance > tags together just before the closing < /body > tag, after all of the levels have been defined. In this tutorial, we will ask you to keep them together at the end of the < body >. Our first spot will only have one level and one entrance.

The location is specified as an (x,y,z) coordinate, measured in blocks (with 1,1,1 being in the top left (or northwest) corner of the bottom level.)

The name attribute allows you to name each entrance, so that you can refer to them later. They act sort of like targets in HTML. Every spot must have one entrance named “default”.

The angle attribute defines what direction your visitors will be facing when they enter the spot. The angle parameter has 2 values, turn and tilt, specified in whole number degrees. The first value specifies what direction (north, south, east, west, or somewhere in between) your visitors will face. Possible values range from 0 to 359. The second value specifies whether they will be looking up or down, with possible values of -90 to 90. The default value is “0,0″ which will leave your visitors facing north, and parallel to the horizon. A value of “90,0″ will set your visitors facing directly east, “180,45″ will leave them facing south, and 45 degrees up into the “air”, etc.

Put the following code after the < /level > tag in your 3DML file:

< entrance location="(5,8,1)" name="default" angle="0,0" />

Congratulations!

body spot

You now have a fully functioning spot! Save the file as “firstspot.3dml” in the Flatland Tutorial folder, and open it in your Web browser or the Flatland Rover stand-alone browser (simply drag the file firstspot.3dml from Windows Explorer onto your browser window). You will find yourself in a room with 4 walls and no ceiling. You should see your sky texture overhead, and the ground texture underfoot. You will also see the sky texture in the open space in the wall in front of you. Go to the edge and look over.

show me the code show me the spot next lesson

Welcome | Starting | Head Tag | Body Tag | Multilevels | Navigation | Textures | Orientation | Linking | Sound | Lighting | Popups | Sprites | Actions | Streaming 1 | Streaming 2 | More Blocks | Tips & Tricks | Orientation Guide | Texture Styles