Verse Library verse

02 Device

Initializes a customizable hero device that stores configuration data and logs its name at game start.

verse-library/verse-classes-and-structs-to-model-your-game-s-objects/02-device.verse

# We use these modules to access devices and math types.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Colors }

# This is our hero blueprint.
# It inherits from creative_device, which is the real
# base class for placeable Verse objects in UEFN.
color_chaser := class(creative_device):

    # This is the data box we made earlier.
    # We give it default values so it is always valid.
    var Info : MyHeroInfo = MyHeroInfo{
        Name := "Hero",
        HeroColor := NamedColors.Red
    }

    # A prop_device is a real UEFN device you can place
    # and reference in the editor to drive a visual prop.
    # Wire this in the editor's Details panel.
    # note: prop_device is the closest real device for
    # a placeable visual object in UEFN.
    MeshProp : prop_device = prop_device{}

    # This function runs automatically when the game starts.
    OnBegin<override>()<suspends> : void =
        # Say hello using the name in the struct.
        # note: Print() writes to the UEFN output log;
        # there is no standalone DisplayMessage() in 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.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in