RPG Battle in cocos2d part one.

This entry was posted in cocos2d. Bookmark the permalink.

8 Responses to RPG Battle in cocos2d part one.

  1. Chris 420 says:

    Great start to a battle scene been looking forever for a piece of code to build on, will you be making any updates to it such as attacks that take random amounts of HP within a set limit, and occasionally dodge attacks or get critical hits, also when you attack both the hp of the player and monster are decreasing at the same time im trying to figure out a way to make the monster attack after the player attacks so when i add my attack animations they each take a turn and not both go off at once any kind of help with turn based issue would be very apreciated
    Thanks in Advance!!

  2. chris 420 says:

    Awsome Thank you very much for the fast reply, i managed to get the attacks random thanks to your arc4random post i just switched the strength value to caricters.strength = (arc4random()%(20-10))+10; or you could do the same on the attack method itself and switch around the values for different attacks, the random attack worked great but i havent figured out how to make the hp value get down to zero it stops once the last random # is greater then the current HP (i have my win battle scene set to activate once the hp reaches 0, I can only make it work is when i set the strength value back to the original way and set a value that will allways end in 0,

    Thanks again!!

    • admin says:

      I have fixed it for the next post.
      so you have the
      if(_monster.curHp>=_player.strength){
      }
      else{
      }
      Inside the else you can set _monster.curHp =0 and then update the monster labels.
      [_labelHp2 setString:[NSString stringWithFormat:@"Monster HP: %d/%d", _monster.curHp, _monster.maxHp]];

      [_labelMp2 setString:[NSString stringWithFormat:@"Monster HP: %d/%d", _monster.curHp, _monster.maxHp]];

  3. Thromordyn says:

    This looks good, but double spaced code? And a serif font in a programming tutorial? Ew.

  4. Andreas Löw says:

    Hi,

    this is not meant as a post – I just wanted to contact you but didn’t find any mail address….

    Are you interested in testing http://www.physicseditor.de or http://texturepacker.com for free?
    I can give you a free license for both.

    Cheers
    Andreas

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>