|
-
Simple RPG Combat System
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:
playerHP -= enemyAttack - playerDefense;
Same thing for the enemy. If playerHP <= 0, go to lose frame. If enemyHP <=, win.
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:
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);
}
This is for AS 3.0 by the way.
Thanks. 
Oops, I placed the thread on the wrong forum. Sorry folks.
Last edited by Hurdarr; 06-02-2009 at 07:44 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|