using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# This is the "Brain" of our door.
# It inherits from creative_device, meaning it can be placed in the world like any other device.
secret_door := class(creative_device):
# Variables (State): Things that change during the game
# 'IsOpen' is a boolean (true/false). Think of it like a light switch.
var IsOpen : logic = false
# 'DoorPropMover' is a reference to the Prop Mover device.
# We'll assign this in the editor.
@editable
DoorPropMover : prop_mover_device = prop_mover_device{}
# 'ButtonTrigger' is the button that activates us.
@editable
ButtonTrigger : button_device = button_device{}
# This function runs when the game starts.
# It's like the "Loadout" phase before the match begins.
OnBegin<override>()<suspends> : void =
# Connect the button's press event to our custom function
ButtonTrigger.InteractedWithEvent.Subscribe(HandleButtonPress)
# This is our custom logic.
# 'HandleButtonPress' is a function (a set of instructions).
# button_device's InteractedWithEvent passes the interacting agent as an argument.
Verse Library
verse
01 Device
Defines a custom device class that manages a prop mover and button trigger to toggle a door open or closed.
verse-library/devices-used/01-device.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.