How to build a dice rolling?

Hi there, does enybody have any experince whit making a dice rolling? alternative dice for the board games…tnx

May be RANDOM function like :
Value = RANDOM() * 6

thanks @Bertrand_BZH , but any tutorial or step-by-step instructions on this topic would be very much appreciated - i’m begginer and have no code knowledge :confused:

Create a container and button

Create a variable DiceResult

In the container put a title component with the variable

After the logic of the button, when component tap, set app varible, assigned value :


You can create a rolling effect with delays between formulas

I hope it’s ok for you.

Hi, woow nice post, you are the man @Bertrand_BZH, thanks a lot, I’m very grateful.
I followed your instructions and successfully replicated your idea. I’m interested in how you would arrange colors instead of numbers… Six colors instead of six numbers? tnx

1 Like

There are several ways of doing things.
You can in the container put a formula in background color/new palette/formula like:
If (DiceResult== 1, “red”, if (DiceResult == 2, “green”, if (DiceResult == … etc

I just followed your advice and it works flawlessly, thanks for your help and detailed instructions. I really appreciate. :pray:


Hi, @Bertrand_BZH i ’ m struggling to find out how to put an image instend colour or number? do u have any experience? any infomration would be very helpfull? greetings

I don’t understand what you are trying to do.
Can you explain to me the result you are trying to get?

hi, thank you for responding. So i need a dice whit 6 images instead of the 6 colour,
as you did from above… i hope u understand.

The easiest way is to create the 6 images and store them on a Google Drive for example.
For each image, you create an URL image type variable.
And in the previous formula you change your colors by the name of the variable corresponding to the result.

a short tutorial would be very much appreciated or. just a formula… I did made a change/edit background colour formula… it s that correct?

HI, i find the solution. I write a formula in background image of container, whit the URL just like u said. Tnx again.

1 Like

Oh sorry, I didn’t have time to do a tutorial. But it’s better that you are found by yourself. :clap: