Advertisement
Guest User

Player.h

a guest
Mar 17th, 2015
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. class Player
  7. {
  8. public:
  9. Player(string name_, int maxhp_, int strenght_, int attackspeed_)
  10. {
  11. name = name_;
  12. maxhp = maxhp_;
  13. hp = maxhp;
  14. strenght = strenght_;
  15. attackspeed = attackspeed_;
  16. isdead = false;
  17. }
  18. void fullhp()
  19. {
  20. hp = maxhp;
  21. }
  22.  
  23. void dmg(int dmg)
  24. {
  25. hp -= dmg;
  26. if (hp < 0)
  27. dead();
  28. }
  29.  
  30. void dead()
  31. {
  32. isdead = true;
  33. cout << name <<" died like a pessant";
  34.  
  35.  
  36.  
  37. }
  38.  
  39. string get_name()
  40. {
  41. return name;
  42. }
  43. int get_hp()
  44. {
  45. return hp;
  46. }
  47. int get_maxhp()
  48. {
  49. return maxhp;
  50. }
  51. int get_str()
  52. {
  53. return strenght;
  54. }
  55. int get_as()
  56. {
  57. return attackspeed;
  58. }
  59. bool ask_dead()
  60. {
  61. return isdead;
  62. }
  63.  
  64.  
  65. private:
  66. string name;
  67. int maxhp;
  68. int hp;
  69. int strenght;
  70. int attackspeed;
  71. bool isdead;
  72.  
  73.  
  74. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement