Description:
The door serves as the finishing state of the level. Once the player has met all the required conditions (e.g., collecting a key, solving a puzzle), the door becomes interactable. Interacting with the door initiates a level transition animation, and the door locks behind the player once they progress to the next level.
Script:
Mechanics:
Locked State:
By default, the door is locked until the player fulfills the necessary requirements.
The door is highlighted when looked at but remains inactive until conditions are met.
If the player tries to interact early, they receive a feedback message (e.g., “The door is locked”).
Unlocking the Door:
Once all conditions are met, the door becomes interactable.
The player presses E, triggering:
A door opening animation.
A transition effect to the next level.
The door locking behind the player, preventing backtracking.
Visual & Audio Feedback:
Locked Door: A UI notification or sound cue (e.g., rattling door handle).
Unlocking Door: A subtle sound effect (e.g., clicking lock, creaking hinges).
Transitioning Levels: A fade-to-black or distortion effect occurs before loading the next level.