Doors are a special platform type that can be opened and closed by a key item (see also Items).
Doors have the following properties:
|keyType||Identifier matching the 'type' value of a Key Item. If empty the door does not require a key, if not empty the user must possess the matching key to open the door.|
|startOpen||Boolean indicating if the door starts open or closed (true for open).|
The enterable door is the most common type of door. It allows you to configure additional controls for entering the door:
|doorEntryMethod||How do we enter the door, see below.|
|actionKey||If the entry method requires an action key, this sets the action key that should be pressed to enter.|
The available entry methods are:
|AUTOMATIC||The door is entered when the character stands on the door platform.|
|PRESS_UP||The door is entered when the character presses up.|
|PRESS_ACTION_KEY||The door is entered when the user presses the key defined by the actionKey setting.|
Note: you can only enter an OPEN door.
Doors Send Events
Most doors types do not do anything to the character other than sending events. If you wish to do something when the door changes state (for example when it opens or when the character enters it) then you should respond to the door events.
|Door Event||Sent By||Sent When|
|Open||All Doors||When the door is opened.|
|Closed||All Doors||When the door is closed.|
|Enter||Enterable Doors||When the door is entered.|
The most common pattern is to create an EnterableDoor and respond to the Enter event by respawning the character in a new position or in a new level. This setup looks like this:
Note: In order to respawn at a new position you must also create a RespawnPoint (see Respawning).
You can use the templates: Template_EnterableDoor or Template_EnterableDoorNewLevel to quickly add doors.