Verse Library verse

03 Device

Extends the timer with a half-second blink loop that toggles widget visibility during the final seconds.

verse-library/making-an-animated-timer-in-unreal-editor-for-fortnite/03-device.verse

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

PanicTimerLogic := class(creative_device):

    @editable
    TimerDevice: timer_device = timer_device{}

    var IsPanic: logic = false
    var PanicScale: float = 1.0

    # NEW: drives the blink effect below 5 s
    var BlinkState: logic = false

    OnBegin<override>()<suspends>: void =
        TimerDevice.Start()
        TimerDevice.SuccessEvent.Subscribe(OnTimerEnd)
        spawn { RunUpdateLoop() }
        spawn { RunBlinkLoop() }   # second coroutine for blinking

    # ---- per-second state update ----
    RunUpdateLoop()<suspends>: void =
        loop:
            Sleep(1.0)
            UpdatePanicState()

    # ---- half-second blink toggle (only visible when BlinkState matters) ----
    RunBlinkLoop()<suspends>: void =
        loop:
            Sleep(0.5)

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