Hi all. Just one quick question, if you were to create a really simple RPG combat system, where the player and the monsters have three stats (HP, Attack and Defense), and the following combat function would occur each time the player hit the "Fight!" button:
Same thing for the enemy. If playerHP <= 0, go to lose frame. If enemyHP <=, win.Quote:
playerHP -= enemyAttack - playerDefense;
How would you organize your information? I mean, if I want to add 100 monsters (besides adding their unique stats), how can I build an overall function to handle all the fighting system, so I don't have to build 100 additional functions like:
This is for AS 3.0 by the way.PHP Code:btnFight.addEventListener(MouseEvent.CLICK, fightMonster1);
function fightMonster1(MouseEvent:Event):void
{
playerHP -= monster1Attack - playerDefense;
monster1HP -= playerAttack - monster1Defense;
txtPlayerHP.text = String("Player HP: "+ playerHP);
txtMonster1HP.text = String("Monster1 HP: "+ monster1HP);
}
Thanks. :cap:
Oops, I placed the thread on the wrong forum. Sorry folks. :(
