A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Simple RPG Combat System

Threaded View

  1. #1
    Senior Member
    Join Date
    Jan 2008
    Posts
    107

    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.CLICKfightMonster1);

    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center