Axure Quest VIII / More Fun with Random!

Greetings, citizens of Axureland!

I come bearing a gift from Axure HQ: another addition to the Fun with Random game series! Kip has mystified you with his fortune-telling Magic 8 Ball; Alex has welcomed you to the floor of Deal or No Deal; Jonathan has puzzled you with the Monty Hall Problem; and Alyssa has challenged you to a friendly game of Rock / Paper / Scissors / Lizard / Spock. In my offering, I take you back through the mists of time to the 1990s for a battle to the death with some fearsome 16-bit beasties!

The JRPG (Japanese role-playing game) has become a staple of American gaming culture. Chock full of awesome magic, global cataclysms, and some really wicked hairstyles, what’s not to love? In Axure Quest VIII: The Random Within, you’ll take command of a party of four adventurers to defeat one of three monstrous bosses in a classic JRPG turn-based battle. “Who’s controlling these creatures?” you ask. No one — their actions are entirely random! MWAHAHAHAHAHA!!!

See it live!

It all starts on the title screen, where the OnPageLoad event sets a global variable, BossSelect, to a number between one and three. It does this using the .random and .floor methods of the JavaScript Math object; the equation looks like this:

Math.floor( Math.random() * 3 ) + 1

Math.random() returns a random number between 0 (inclusive) and 1 (exclusive) which is then multiplied by 3. Math.floor takes that number and returns an integer by rounding it down. This returns a random integer between 0 and 2, so adding 1 gives us a range of 1 to 3. The “New Game” button’s OnClick event links to one of the three boss pages depending on the value returned. (You can select which boss to fight after you’ve finished your first battle. Just click “Victory!” or “Game Over” to return to the title screen.)

The battle starts on the player’s turn. After the player has selected actions for each of the four adventurers, the boss’s turn begins. What the boss does on its turn is determined by the “Announcer” dynamic panel’s OnHide event, which sets BossSelect to a value between 1 and 8 using the same syntax as above. On a 1, 2, 3, or 4, the boss will attack one of the adventurers for high damage; on a 5 or 6, it will attack the entire group for medium damage; and on a 7 or 8, it will heal itself. The amount of damage or healing done is also randomly determined using the following syntax:

Math.floor( Math.random() * ( max - min ) ) + min

“Max” is the upper limit, the maximum value that can be returned, and “min” is the lower limit, the minimum value that can be returned. This allows me to set a range of possible values for each ability in the game. All of the boss’s abilities use the BossAttack variable, which is set to a number between 20 and 30 by the “BOSS Attack Graphic” image’s OnShow event. Each ability uses this value in an equation to produce an appropriate damage or healing amount. You can view these under the OnHide event for “BOSS Attack Graphic”.

The adventurers’ abilities work in a similar fashion, but their random attack values are adjusted according to the boss being fought. (Check out the instructions on the “Title Screen” page for a hint!) The exceptions to the min/max formula are the Archer’s Trap attack and the Black Mage’s spells. Clicking “Trap” returns a number between 1 and 4; on a 1, the player immediately gets an additional turn. The Black Mage’s spells deal a constant 10 damage per second, but the duration is randomly determined (1-3 seconds).

That’s it for the random aspects of the game, but we’ve barely scratched the surface of all the interactions I had to build in order to make the game function properly. Feel free to poke around the attached .rp file for a closer look at the inner workings of Axure Quest VIII, and let me know if you have any questions. I would also love to hear feedback on the gameplay itself, so please inundate me with criticisms!
Axure Quest VIII.rp (3.03 MB)