Adding a Code Door to Your WorkAdventure World

In this tutorial, we'll guide you through the process of adding a code door to your WorkAdventure world. This door will require a specific access code to open, enhancing the interactivity and security of your virtual space. We'll be using a pre-fab project where all relevant objects, layers, and properties are prepared. Let's get started!

Step 1: Preparation

Before diving into the code, ensure you have the following:

https://github.com/workadventure/map-starter-kit

codedoor prefab.tmj

Step 2: Setting Up the Door Variables

  1. Add the Codedoor to your map: To add the door, please copy: "Door" Layerfolder, Doorsteplayer, pw_door Object in the floorLayer. Make sure you've also transferred ALL Variables and Custom Properties.
  2. Define the Door Variable: Ensure you have a door variable defined on the floorLayer. This variable should have the type variable and must be named exactly as you intend to use it.
  3. Custom Properties: The door variable should have the following custom properties:

Step 3: Configuring the Tile Layers

  1. Edit/Create Doorstep Layers: The template comes with a simple doorstep-Layer. It is defined to open a Codefield whenever a player steps on the field. If a player leaves this field, the door closes, if it has been open while the player steps off the layer.
  2. (Optional) If you want to build more complex door behavior, you can add multiple doorsteps. Define two different layers inside a folder called doorsteps:
  3. Place Tiles: Place tiles on these layers where the door should open or close when a Woka (player) steps on them.

<aside> 🔥 Important: The Codedoor cant be close to a START Area. Keep at least one Tile Distance.

</aside>

(optional) Step 5: Additional Properties