I need to get them separetly to insert the number in the Variables Digit1, Digit2 and Digit3. However, I have no clue how to do that.
Could someone enlighten me?
if you have a
global number MyNumber = 123456[/code:3vjecb8n]
For any digit n (counting from 0) from the right the formula would be:[code:3vjecb8n]floor(MyNumber/10^n)%10[/code:3vjecb8n]
for example:[code:3vjecb8n]floor(MyNumber/10^0)%10 -> 6
floor(MyNumber/10^1)%10 -> 5
floor(MyNumber/10^2)%10 -> 4
Could you please, explain me what these operators does(^, %)?I just know what floor expression does. I'm looking at the tutorials but I couldn't understand.
Thank you for your attention.
^ is the exponent operator
10^0 = 1
10^1 = 10
10^2 = 100
etc...[/code:nisj0wkv]now in the formula, the / 10^n just set the digit you want to be the first digit.
% is the modulo operator
It's formal definition would be that it's the remainder of the euclidean division of two numbers
for example: [code:nisj0wkv]5 : 3 = 1 with remainder 2[/code:nisj0wkv]
If you don't like this explanation you can also look at how it behaves according to different input to get a feel for it (after all we're not mathematicians)
for example:[code:nisj0wkv]0%3 = 0
1%3 = 1
2%3 = 2
3%3 = 0
4%3 = 1
5%3 = 2
6%3 = 0
(see how things cycle?)[/code:nisj0wkv]now in the formula, the % 10 just gives you the first digit of any number
Develop games in your browser. Powerful, performant & highly capable.
I got it. Man, I love you. That's so cool!
Now i'm going to see how I'll put this into my event sheet.
Yes, I'm not a mathematician, I'm a grafic designer with an old passion to make my own game.
Thank you a lot, man. I'm very grateful.