Rock Paper Scissors Game Made in Verse

You click a button to start the game; you are prompted to choose within a short window, once you pick, your selection is locked in, and the AI will choose what to play, and the result will be displayed after (Win, Lose, Draw and Didn’t Pick)


2 Likes
using { /Fortnite.com/Devices }
using { /Verse.org/Native }
using { /EpicGames.com/Temporary/Diagnostics }
using { /Verse.org/Random }
using { /Verse.org/Simulation}

log_Rock_Paper_Scissors:=class(log_channel){}


Rock_Paper_Scissors := class<concrete>(creative_device):
    Logger:log = log{Channel:=log_Rock_Paper_Scissors}

# Main Guess Buttons ====================================================================================================
    @editable
    RockButton: button_device = button_device{}
    @editable
    PaperButton: button_device = button_device{}
    @editable
    ScissorsButton: button_device = button_device{}
    
# Main Guess Buttons Link to HUD Devices ====================================================================================================
    @editable
    HUDRockButtonInteract: hud_message_device = hud_message_device{}
    @editable
    HUDPaperButtonInteract: hud_message_device = hud_message_device{}
    @editable
    HUDScissorsButtonInteract: hud_message_device = hud_message_device{}

# Main Guess Buttons Link to HUD Devices ====================================================================================================
    @editable
    StartTimer_Button: button_device = button_device{}
    @editable
    SelectTimer: timer_device = timer_device{}
    @editable
    TimerCompleteDelay: timer_device = timer_device{}

    @editable
    TimerDelay_ShowFailAfterPick: timer_device = timer_device{}
    @editable
    TimerDelay_WinAterPick: timer_device = timer_device{}
    @editable
    TimerDelay_TieAterPick: timer_device = timer_device{}

    @editable
    HUDFailAfterPick: hud_message_device = hud_message_device{}
    @editable
    HUDWinAfterPick: hud_message_device = hud_message_device{}
    @editable
    HUDTieAfterPick: hud_message_device = hud_message_device{}
    
    @editable
    TriggersHUD_RockAIGuess: hud_message_device = hud_message_device{}
    @editable
    TriggersHUD_PaperAIGuess: hud_message_device = hud_message_device{}
    @editable
    TriggersHUD_ScissorsAIGuess: hud_message_device = hud_message_device{}
    @editable
    TriggersHUD_Fail: hud_message_device = hud_message_device{}

# Audio Effects After Result ====================================================================================================
    @editable
    WinAudio: speaker_device = speaker_device{}
    @editable
    LoseAudio: speaker_device = speaker_device{}
    @editable
    TieAudio: speaker_device = speaker_device{}

# Variables ====================================================================================================
    var ChoiceVar: int = 0
    var AIChoiceVar: int = 0

    OnBegin<override>()<suspends>:void=
        Logger.Print("Verse device started!")

# Links functions to Devices =================================================================================
        StartTimer_Button.InteractedWithEvent.Subscribe(StartTimer_Button_Interact)
        SelectTimer.SuccessEvent.Subscribe(CompleteTimer)
        TimerCompleteDelay.SuccessEvent.Subscribe(CompleteTimerCompleteDelay)
  
        RockButton.InteractedWithEvent.Subscribe(RockButtonInteract)
        PaperButton.InteractedWithEvent.Subscribe(PaperButtonInteract)
        ScissorsButton.InteractedWithEvent.Subscribe(ScissorsButtonInteract)

        TimerDelay_WinAterPick.SuccessEvent.Subscribe(Win_HUD)
        TimerDelay_ShowFailAfterPick.SuccessEvent.Subscribe(Fail_HUD)
        TimerDelay_TieAterPick.SuccessEvent.Subscribe(Tie_HUD)
# Start Timer Intarct =================================================================================
    StartTimer_Button_Interact(Player:player):void=
        SelectTimer.Start(Player)
        Logger.Print("Starting Button Interacted")
        StartTimer_Button.Disable()

# Enables Buttons for 1s After Timer Completes =================================================================================
    CompleteTimer(Player:player):void=
        
        RockButton.Enable()
        PaperButton.Enable()
        ScissorsButton.Enable()
        Logger.Print("Buttons Enabled")

        TimerCompleteDelay.Start(Player)
        Logger.Print("Timer Delay Complete START")

# Delay Timer Functions =================================================================================
    CompleteTimerCompleteDelay(Player:player):void=
        Logger.Print("Buttons Disabled")
        
        RandomNum:int = GetRandomInt(1, 3)
        set AIChoiceVar = RandomNum
# If no option was picked
        if (ChoiceVar = 0):
                TriggersHUD_Fail.Show(option {Player})
                Logger.Print("FAIL - Didn't pick in time")
                StartTimer_Button.Enable()
                RockButton.Disable()
                PaperButton.Disable()
                ScissorsButton.Disable()

# If Rock was Picked Logic
# R > S
        if (ChoiceVar = 1):
            if (AIChoiceVar = 3):
                    TriggersHUD_ScissorsAIGuess.Show(option {Player})
                    TimerDelay_WinAterPick.Start(Player)
                    Logger.Print("{ChoiceVar} & {AIChoiceVar}")
# R < P
        if (ChoiceVar = 1):
            if (AIChoiceVar = 2):
                    TriggersHUD_PaperAIGuess.Show(option {Player})
                    TimerDelay_ShowFailAfterPick.Start(Player)
                    Logger.Print("{ChoiceVar} & {AIChoiceVar}")

# If Paper was Picked Logic
# P > R
        if (ChoiceVar = 2):
            if (AIChoiceVar = 1):
                    TriggersHUD_RockAIGuess.Show(option {Player})
                    TimerDelay_WinAterPick.Start(Player)
                    Logger.Print("{ChoiceVar} & {AIChoiceVar}")
# P < S
        if (ChoiceVar = 2):
            if (AIChoiceVar = 3):
                    TriggersHUD_ScissorsAIGuess.Show(option {Player})
                    TimerDelay_ShowFailAfterPick.Start(Player)
                    Logger.Print("{ChoiceVar} & {AIChoiceVar}")

# If Scissors was Picked Logic
# S > R
        if (ChoiceVar = 3):
            if (AIChoiceVar = 1):
                    TriggersHUD_RockAIGuess.Show(option {Player})
                    TimerDelay_ShowFailAfterPick.Start(Player)
                    Logger.Print("{ChoiceVar} & {AIChoiceVar}")
# S < P
        if (ChoiceVar = 3):
            if (AIChoiceVar = 2):
                    TriggersHUD_PaperAIGuess.Show(option {Player})
                    TimerDelay_WinAterPick.Start(Player)
                    Logger.Print("{ChoiceVar} & {AIChoiceVar}")
# Tie System       
        if (ChoiceVar = AIChoiceVar):
            if (AIChoiceVar = 1):
                TriggersHUD_RockAIGuess.Show(option {Player})
            if (AIChoiceVar = 2):
                TriggersHUD_PaperAIGuess.Show(option {Player})
            if (AIChoiceVar = 3):
                TriggersHUD_ScissorsAIGuess.Show(option {Player})

            TimerDelay_TieAterPick.Start(Player)
            Logger.Print("{ChoiceVar} & {AIChoiceVar}")
                
# When Player Wins =================================================================================
    Win_HUD(Player:player):void=
            HUDWinAfterPick.Show(option {Player})
            set ChoiceVar = 0
            StartTimer_Button.Enable()
            WinAudio.Activate()
            Logger.Print("WIN HUD Triggered")

# When Player Fails =================================================================================
    Fail_HUD(Player:player):void=
            HUDFailAfterPick.Show(option {Player})
            set ChoiceVar = 0
            StartTimer_Button.Enable()
            LoseAudio.Activate()
            Logger.Print("FAIL HUD Triggered")

# When Player Ties =================================================================================
    Tie_HUD(Player:player):void=
            HUDTieAfterPick.Show(option {Player})
            set ChoiceVar = 0
            StartTimer_Button.Enable()
            TieAudio.Activate()
            Logger.Print("TIE HUD Triggered")

# Action when Player Rock Button =================================================================================
    RockButtonInteract(Player:player):void=
        set ChoiceVar = 1
        RockButton.Disable()
        PaperButton.Disable()
        ScissorsButton.Disable()
        HUDRockButtonInteract.Show(option {Player})

# Action when Player Paper Button =================================================================================
    PaperButtonInteract(Player:player):void=
        set ChoiceVar = 2
        RockButton.Disable()
        PaperButton.Disable()
        ScissorsButton.Disable()
        HUDPaperButtonInteract.Show(option {Player})

# Action when Player Scissors Button =================================================================================
    ScissorsButtonInteract(Player:player):void=
        set ChoiceVar = 3
        RockButton.Disable()
        PaperButton.Disable()
        ScissorsButton.Disable()
        HUDScissorsButtonInteract.Show(option {Player})

Looking good Snow! Love the meshes for paper and scisscor. I did notice one thing when you picked paper and the game picked rock it ended in a tie, shoudn’t you have won that round?

shhhh