lundi 13 juillet 2015

Word randomization in Actionscript

In Actionscript, I'm trying to find a way to produce strings and string variables which spit out different text each time they're brought up. To purely visualize:

var text:String "Red||Blue"; //Whenever the variable is called, it's either Red or Blue

textoutput("You spot a grey||black cat."); //A function equivalent of the same issue

I can produce a function which does this effect, but it seems a variable cannot be a function, as far as I can tell.

I've considered array variables, but I have no idea how to use an array to spit out a single entry when the variable is called, and I don't know how to make this work for a string that isn't a variable -- assuming I can get away with a single system that works for both situations.




Aucun commentaire:

Enregistrer un commentaire