vendredi 14 avril 2017

Stopping rnd = Math.floor(Math.random() * 3) + 1;

I want to be able to get a different number from

rnd = Math.floor(Math.random() * 3) + 1;

but it keeps giving me a number every time causing different statements to be true.

if (rnd == 1) {
        chest1.gotoAndStop("chest");
    }
    if (rnd == 2) {
        chest2.gotoAndStop("chest");
    }
    if (rnd == 3) {
        chest3.gotoAndStop("chest");
    }

I want it so it does it once, and then gives me another number after i successful returned the chest causing another chest to appear. But its not, just makes the same chest appear :(

Aucun commentaire:

Enregistrer un commentaire