Jump to content
  • Advertisement
Sign in to follow this  
hothead

making things do damage

This topic is 4972 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've got a function called fight() what I want it to do is the enemy chooses a random move between three moves,and their damage is constantly the same how do I do this?I also want to do the same thing for the player with four moves that looks some thing like this _____________________________ (1)slash (10) damage (2)claws of blood (25) damage (3)claws of steel (50) damage (4)windscar (100) damage ----------------------------- you start with 150HP the enemy starts with 150 HP. edit:there is no defense just offense

Share this post


Link to post
Share on other sites
Advertisement
Well, it sounds like you got the hard part done.... the function name, etc.

But seriously I would use an array, then rand().

unsigned int Attacks[4];

Sidenote:
Your into Inu Yasha huh? Hehe. I have episodes 1-155... and getting the last few right now.... Good luck w/ your game.

Share this post


Link to post
Share on other sites
Quote:
Original post by hothead
I've got a function called fight() what I want it to do is the enemy chooses a random move between three moves,and their damage is constantly the same how do I do this?


void creatureAttack(Creature *c, Player *p)
{
printf("%s",c->attacks[rand()%3].name);
p->health -= C; // Some constant damage
}



Quote:
Original post by hothead
I also want to do the same thing for the player with four moves that looks some thing like this
_____________________________
(1)slash (10) damage
(2)claws of blood (25) damage
(3)claws of steel (50) damage
(4)windscar (100) damage
-----------------------------
you start with 150HP the enemy starts with 150 HP.
edit:there is no defense just offense


void playerAttack(Player *p, Creature *c)
{
c->health -= p->attacks[rand()%4].dmg;
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!