Hello Everyone, I'm trying to write a simple and funny fighting game. I want to write the first class of the game called teacher and i'm not sure if i'm going about it right. I have the moves Punch, Kick, Deafening Whistle, and Textbook Takedown..haha.. don't ask! I also have methods reduceHealth() which controls nmber of health points. and an accessor method called getHealth(). Right now i'm working on the first class of the game. Later i'm going to write 4 more classes..aka levels to fight.(antagonists)..haha. here is my code for the first class called teacher:
Am I using these right for the game? How do I go about using the Health Methods. I'd apreciate any help. Thanks! I'm so rusty...with C++ ughh..Code:#include<iostream> #include<string> using namespace std; class teacher{ private: int health; string name; public: void showHealth(); void reduceHealth(int damage); int block(int damage); int punch(); int kick(); int deafeningWhistle(); int textbookTakedown(); int getHealth(); teacher(int _health, string _name); ~teacher(); }; teacher::teacher(){ health = 200; name = "Professor Spartan"; } ~teacher(){ } int teacher::block(int damage){ health = health - damage; } int teacher::punch(){ health = health - 10; } int teacher::kick(){ health = health - 15; } int teacher::defeningWhistle(){ health = health - 25; } int teacher::textbookTakedown(){ health = health - 50; }