- 1

code continued

class Monster: public Battle { public: Monster(){}; string nm[2] = {"Troll","Gargoyle"}; const int Stats[2][6] = {{40,25,40,25,130,100}, {45,28,45,28,140,110}}; int xp[2] = {30,50}; int n; //get monster selection info void GetInfo() { cout << "Which monster you want to fight?" << endl; for (int x = 0; x < 2; x++) { cout << x+1 << ". " << nm[x] << endl; } cin >> n; n -=1; InitInfo(n); } //initialize monster battle info void InitInfo(int n) { Battle::nm[1] = nm[n]; for (int x = 0; x < 6; x++) { Battle::Stats[1][x] = Stats[1][x]; } Battle::xp[1] = xp[n]; DisplayInfo(); } //display monster info void DisplayInfo() { cout << Battle::nm[1] << endl; //display stat names for (int y = 0; y < 6; y++) { cout << Battle::StatArr[y]; } cout << endl; //display monster stats for (int x = 0; x < 6; x++) { if (x < 4) { cout << Battle::Stats[1][x] << " "; } else { cout << Battle::Stats[1][x] << " "; } } cout << "Xp: " << Battle::xp[1]; cout << endl << endl; } }; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////Main function/////////////////////////////////////////////// int main() { Battle objb; Character objc; Monster objm; Battle *obj; //get name from player objc.GetInfo(); //get monster selection from player objm.GetInfo(); //////////////////////////////////////

5th Oct 2016, 4:32 PM
James Watt
2 Antworten
0
try stack overflow if you need real help!
5th Oct 2016, 7:21 PM
Mohammed Maaz
Mohammed Maaz - avatar
0
not entirely sure how I would do that but I'll look into it
5th Oct 2016, 8:49 PM
James Watt