"Wheel of Fortune" Sample
This article will explain how to edit the different dynamic elements and values in the "Wheel of Fortune" sample experience. It will not explain how to edit the overall design.
When you press the “Spin The Wheel” button, the wheel image will rotate through 180 degrees three times - i.e. one and a half turns total - at progressively slower speeds and then rotate through an additional number of degrees determined by a Random From List interface asset. The list of possible rotational values is as follows:
The values have been chosen based on the angle to which the wheel image should rotate to in order to win a prize. For example this is where the wheel will be at 21°
Or at 81°
If you change the image of the wheel with your own, you will need to find new angle values to set in the Random from list Interface Asset.
After wheel rotation, the result needs to be defined. We used an Excel spreadsheet to define the value of the prize per angle offset of the wheel.
Let’s say you want to replace the wheel’s design to this one.
You will first need to note down the different angles to which each section belongs. You can do so by playing with the wheel’s "Image angle" property in Composer:
The result will be something like this:
Next, update the "Random From List - Lucky Wheel" interface asset with these new values.
Then, open the Excel spreadsheet by right-clicking the "Wheel of Fortune - Values" interface asset in the Interface Asset panel and select “Edit in excel”:
Enter the new angle values and, in the “Prize Value” column, enter the prize amount you want to award for each section of the wheel. Save and close the Excel spreadsheet.
You may have noticed that this experience triggers a winning sound when the user earns points and a losing sound when the user earns nothing. If you changed the angle and prize values, you’ll need to edit these triggers.
If you select the button “Launch Audio Button” located below the scene (only visible in Edit Mode) you will note two triggers associated with it.
These triggers both have an “IF” symbol associated with them, meaning they are “conditional triggers” - i.e. they will only trigger if certain constraints are met. If you select the first trigger, you will see that the conditional trigger is:
99 and 8 are the losing angles. These conditional triggers will play a happy sound and show animated confetti if the value of the "Random From List - Lucky Wheel" interface asset does not equal 99 or 8. Change these values to your own losing angle values. Use the same approach for the other trigger.
In this case, if the "Random From List - Lucky Wheel" interface asset equals 99 or 8 then play the losing audio. Change these values to your losing angles.