- Notifications
You must be signed in to change notification settings - Fork 0
Creating Maps
Maps in this engine are designed to be a list of Areas which are connected to other Areas via their properties.
We link these Areas together using the Map, which determines which Areas lead to which other Areas via an AreaExit.
Some AreaExits may be locked to only be opened with a specific Key Item.
All AreaExits are closed by default until opened.
We write this in a JavaScript object where the "key" is a Area number and the "value" is an object made up of all 4 Area directions, like below:
1: { north: { direction: Direction.N, destination: 2, status: AreaExitStatus.locked, itemReferenceNeeded: "73c02921-f0a6-4ea1-8b24-97842ee28fb6", keyColourNeeded: "green" }, east: null, south: null, west: null, } as IAreaExits Leave directions as null if you do not want to generate a door for this direction
You can see that the number 1 is the Area number, and inside the object ({...}) are properties named after navigational directions (north, east etc.).
Each of these directions can lead to aN Area and will need to be set here which Areas this Area points to through those directions.
Here we have an example where the direction is made up of 5 properties, direction, destination, status, itemReferenceNeeded and keyColourNeeded. These will determine what type of Door will be generated when loading the Area.
| Property name | Property type | Property example value | Description |
|---|---|---|---|
direction | Direction | Direction.N | This Direction must always match the direction preceding it in the object "key" ("north"), but be of the enumerable type Direction. Direction can be found here: Direction. |
destination | number | 2 | This is the reference for the Area this direction leads to. If we leave through the North exit of this Area, we will enter Area 2. |
status | AreaExitStatus | AreaExitStatus.locked | This status is the default state of the Door when you first enter the Area, locked, open etc, and must be of the enumerable type AreaExitStatus, which can be found here: AreaExitStatus. |
itemReferenceNeeded | string | random GUID | This is the unique ID of the Key Item you need equipped to unlock this Door. Here we have generated a random GUID (You can generate these here: https://www.uuidgenerator.net/guid). This reference must match the reference you will see on the Key Item in the Creating Items page. |
keyColourNeeded | string | "green" | This is for the text which will display when you attempt to open the Door without the correct Key Item as your Active Item. |
4: { north: { direction: Direction.N, destination: 5, status: AreaExitStatus.closed, itemReferenceNeeded: "", keyColourNeeded: "" }, east: null, south: { direction: Direction.S, destination: 3, status: AreaExitStatus.closed, itemReferenceNeeded: "", keyColourNeeded: "" }, west: null, } as IAreaExits, You can see above that we have destinations in the destination property, but we have AreaExitStatus set to closed instead of locked and itemReferenceNeeded and keyColourNeeded are both set to "", this means that there will be no lock on this Door and you can open this with any or no Key Item equipped.
Note that these objects ({...}) must satisfy the IAreaExits interface or the build will fail. This is available here: IAreaExit
-Project ngIne by Adam Kissaglis-