8 Responses to RPG Battle in cocos2d part one.

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!!

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,

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]];