using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /Verse.org/Native } # This is our main game manager class. # It must inherit from creative_device so UEFN can run it. disco_ball_device := class(creative_device): # This is our Prop Mover device. # Drag your DiscoBall Prop Mover onto this slot in the editor. @editable Mover : prop_mover_device = prop_mover_device{} # How many degrees to add on each loop tick. # Increase this number to spin faster. SpinStepDegrees : float = 5.0 # Current accumulated rotation in degrees around the Z-axis (Yaw). var CurrentYaw : float = 0.0 # OnBegin runs automatically when the game starts. # It is the entry point for our device. OnBegin() : void = RunSpinLoop() # This function contains the infinite spin loop. RunSpinLoop() : void = # 'loop' repeats the block inside forever. # It is the correct Verse keyword for an infinite loop. loop: # Add a small step to our running yaw total. set CurrentYaw = CurrentYaw + SpinStepDegrees # Tell the Prop Mover to move to the next keyframe. # Prop Mover plays its configured movement on demand. # We call Play() each tick to advance the animation. # note: PropMoverDevice does not expose SetRotation directly; # configure the mover's keyframes in the editor for rotation, # then drive it with Play() each iteration. Mover.Play() # Sleep pauses the loop for 0.05 seconds. # Without this the loop runs thousands of times per second # and can freeze the game. 0.05 s gives roughly 20 ticks/second. Sleep(0.05)