Verse Programming Basics
31,610 Views
-
using { /Fortnite.com/Devices } using { /Verse.org/Simulation } # A Verse-authored creative device that can be placed in a level hello_world_device := class(creative_device): # Runs when the device is started in a running game OnBegin<override>()<suspends>:void= # TODO: Replace this with your code # Welcome to the game of mice and coins! Let's start with 5 gold coins. var goldcoins: int = 5 # Display the starting amount of gold coins to the player with a witty message. Print("Welcome to the game of mice and coins! You're starting with {goldcoins} shiny gold pieces!") # Now, let's set up the variables for the game: the number of mice caught and the additional gold pieces they're worth. var micecaught: int = 0 var additionalgold: int = 1 # If the player catches a mouse, they get additional gold coins. If not, they lose some. Simple, right? if (micecaught > 0): set goldcoins = goldcoins + additionalgold Print("You caught a mouse! Congrats! You now have {goldcoins} gold coins! Keep it up!") else: set goldcoins = goldcoins - additionalgold Print("Oh no, a mouse escaped! You now have {goldcoins} gold coins. Better luck next time, champ!")
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.