I am making a math game. Its a race and to increase your speed you need to answer a math question (2+8) for exsample so i need to random nubers to appear on the screen and answers the player can choose from.
2 options:
Random(range[,....])
choose(0,1,2,3,4,5,6,7,8,15,19,35)
Have a look in manual
edit: use floor with random for whole numbers floor(random(10)) is random 0,1,2,3,4,5,6,7,8,9
See Joskin below posted too, with better explanation
Hi,
For random number use the random() function.
random(x)
Generate a random float from 0 to x, not including x. E.g. random(4) can generate 0, 2.5, 3.29293, but not 4. Use floor(random(4)) to generate just the whole numbers 0, 1, 2, 3.
random(a, b)
Generate a random float between a and b, including a but not including b.
For the display use the text object or a sprite font.
Develop games in your browser. Powerful, performant & highly capable.
You would need a global variable for each number to check if the answer give adds up to correct amount
see this CAPX and work it out