so what I'm trying to do is generate a random number from 1 to 3 when a symbol on the stage is clicked. Once this number is generated, i want this number to determine which of these next 3 symbols will spawn. How can I call upon this function's random number? Does the random number the generator spits out need to be declared as an integer?
//Random hitmarker generator
function randomRange(minNum:1, maxNum:3):Number
return (Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum);
}
if (Number = 1){
boom.x = 340;
boom.y = 600;
boom.visible = true;
}
if (Number = 2){
boom.x = 370;
boom.y = 500;
boom.visible = true;
}
if (Number = 3){
boom.x = 330;
boom.y = 340;
boom.visible = true;
}
Aucun commentaire:
Enregistrer un commentaire