VerseIsland
Feed Learn Leaderboard Guides Explore Search Docs Verse Library
Sign in
Feed Learn Leaderboard Guides Explore Search Docs Verse Library
Community Snippets › Verse Language · Up to Community Snippets · Verse Language · 74 of 106 in Verse Language
Browse Community Snippets

Spinning Wheel

Spinning Wheel

Verse from ColtonKeeley/ProjectOST-Deprecated (TycoonStomperUnstableV0_4_0/Runtimeinstantiables/lottery_wheel.verse), by ColtonKeeley, under the MIT license. Pinned at commit c2ca04004. Compile-checked and ready to adapt for UEFN.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Random }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Fortnite.com/Characters }

SpinningWheel := class(creative_device):
    #Editables
    @editable Wheel : creative_prop = creative_prop{}
    @editable Button : button_device = button_device{}
    @editable LootGranters : []item_granter_device = array{}
    OnSpin : event(int) = event(int){}
    #Varubles
    var Rotates : logic = false
    var Degrees :[]float = array{0.0, 30.0, 60.0, 90.0, 120.0, 150.0, -180.0, -150.0, -120.0, -90.0, -60.0, -30.0}
    var RandInt : int = 0
    var RotatingDegrees : float = 30.0
    var Speed : float = 0.2
    var Delay : int = 15

    OnBegin<override>()<suspends>:void=
        Button.InteractedWithEvent.Subscribe(OnButtonClicked)

    OnButtonClicked(Agent : agent):void=
        if(not Rotates?):
            set RandInt = GetRandomInt(0,Degrees.Length -1)
            if(Angle := Degrees[RandInt]):
                spawn {MakeWheelSpin(Agent,Angle)}

    MakeWheelSpin(Agent:agent,Angle:float)<suspends>:void=
        set Rotates = true
        var CurrentSpeed : float = Speed
        var CurrentDelay : int = Delay
        loop:
            Transform := Wheel.GetTransform()
            Position := Transform.Translation
            Rotation := Transform.Rotation
            NewRotation := Rotation.ApplyRoll(DegreesToRadians(RotatingDegrees))
            Wheel.MoveTo(Position,NewRotation,CurrentSpeed)
            if (CurrentDelay <= 0):
                if (CurrentSpeed <  0.35):
                    set CurrentSpeed = CurrentSpeed + 0.05
                WheelCurrentRotation : []float = Wheel.GetTransform().Rotation.GetYawPitchRollDegrees()
                if (CurrentAngle := WheelCurrentRotation[2]):
                    Print("Current Agle is : {CurrentAngle}/{Angle}")
                    if(RoundedCurrentAngle := Round[CurrentAngle]*1.0):
                        if(RoundedCurrentAngle < Angle + 10.0 and RoundedCurrentAngle > Angle - 10.0):
                            set Rotates = false
                            GrantItem(Agent)
                            break

            else:
                set CurrentDelay = CurrentDelay - 1

    GrantItem(Agent:agent):void=
        if(Item := LootGranters[RandInt]):
            Item.GrantItem(Agent)
        OnSpin.Signal(RandInt)

Comments

    Sign in to vote, comment, or suggest an edit. Sign in
    📄
    Source
    ColtonKeeley
    ColtonKeeley/ProjectOST-Deprecated
    ColtonKeeley
    MIT

    Harvested from a public GitHub repository under its own permissive license. Rights remain with the original author; the license link below governs reuse. Shown here with attribution and a link to the source.

    View original Sources & licensing
    Request removal
    Tags
    github harvested mit
    Verse code
    Compiles · verified Jun 25, 2026
    Sign in to download .verse

    Copy-paste the code above is always free.

    Keep exploring
    More in Verse Language · 74 of 106
    Prev
    santas toy factory utility module
    Next
    mandeep versemaxxing cancelabletask
    Browse all files in this folder (A–Z)
    VerseIsland · an archipelago of Verse & UEFN knowledge
    Learn Guides History About & Press Sources & Licensing Status

    Not affiliated with Epic Games. Fortnite, UEFN, Unreal Engine, and Verse are trademarks of Epic Games, Inc. Content is attributed to its source — see Sources & Licensing.