using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary/Diagnostics }
spin_wheel_device := class(creative_device):
@editable
SpinButton: button_device = button_device{} # the player presses this
@editable
Wheel: creative_prop = creative_prop{} # the prop that spins
@editable
PrizeGranter: item_granter_device = item_granter_device{} # awards the prize
@editable
HopCount: int = 9 # 9 x 120deg = 3 full turns
@editable
SecondsPerHop: float = 0.18
# 120 degrees in radians — one safe, unambiguous third-of-a-turn.
ThirdTurnRadians: float = 2.0943951
var IsSpinning: logic = false
OnBegin<override>()<suspends>: void =
SpinButton.InteractedWithEvent.Subscribe(OnButtonPressed)
OnButtonPressed(Agent: agent): void =
if (not IsSpinning?):
spawn { SpinAndReward(Agent) }
Verse Library
verse
03 Device
Creates an interactive prize wheel that spins on input and grants rewards.
verse-library/verse-anim-rotate-spin/03-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.