I’ve been tinkering with arrays, and I’ve been working on creating a generic Dungeons & Dragons type random encounter, combat simulator.
I’ve created a random weapon generator like this:
//random weapon chooser
weapon = int(Math.random()*4);
randWeapon = new Array(“dagger”, “sword”, “battle axe”, “spear”);
//trace (“The orc is armed with a “+randWeapon[weapon]+”.”);
orcArm = randWeapon[weapon];
Similarly, I can create a random monster generator using the same idea. I’m still pretty much a noob in regard to working with OOP. I think I could create an opponent using prototypes, and weapons using prototypes. The thing is, I’m not too clear about using them. I’ll start simple, with weapons and hit points, then work up to adding armor, and opponent levels. Any suggestions?