dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [Problem] MX2004 RPG battler prob!

  1. #1
    Member
    Join Date
    Nov 2005
    Posts
    42

    [Problem] MX2004 RPG battler prob!

    Hi guys
    I have been going through the "How to make a RPG Battle System" tutorial by Cloud_909 and have it all working except for one thing, when someones HP hits zero they don't die they go into minus figures!
    Now I have had a look on FK about it and reworked it several times but I still can't kill anyone!
    It has this bit of code for the damage
    _root.enemyHP = _root.enemyHP-random(70);
    And then just goes back to an earlier frame with
    if (_root.HP==0) { gotoAndStop("lose"); } } if (_root.enemyHP==0) { gotoAndStop("win"); } }
    but this bit of code just seems to get ignored or is it because the above code just relates to 0?ie if it gets -1 then that code won't work?
    Thanks in advance
    JIM

  2. #2
    Member
    Join Date
    Jun 2005
    Posts
    30
    That looks like what is happening. Try

    if (_root.HP <= 0) {

    gotoAndStop("lose");

    }

    if (_root.enemyHP<= 0) {

    gotoAndStop("win");

    }


    Good luck.

  3. #3
    Member
    Join Date
    Nov 2005
    Posts
    42
    That seemed to do the trick! Thanks for the help!

  4. #4
    Lurker at Heart EgoAnt's Avatar
    Join Date
    Apr 2004
    Location
    The basement
    Posts
    314
    Another nice alternative is to add in a clause where if the damage is over a certain amount in the negative it goes to a suitably messy death... =)
    Speed up your development time with well documented and easy to implement Flash components.
    That's what I do, I save people.... Save them from work. I'm like a slacker superhero, standing for truth, justice, and the consumption of sugary pastries.

  5. #5
    Member
    Join Date
    Nov 2005
    Posts
    42
    Cheers I'll try that!

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