Hi, I started a battle game today for practice and maybe im blind but I cannot see why this does not work.
Well here is the problem.........Code:void town() { int placechoice, life, maxLife; life = 100; maxLife = 200; system("CLS"); cout << "Life = " << life << endl << endl; cout << "Welcome to the townsquare." << endl; cout << "1. Go into the forest" << endl; cout << "2. Go to the shop" << endl; cin >> placechoice; if (placechoice == 1) introforest(); else if (placechoice == 2) shop(life, maxLife); } void shop(int &life, int &maxLife) { int shopchoice; system("CLS"); cout << "Welcome to my store, I am the shopkeeper Alkhaza." << endl; cout << "What would you like?" << endl; cout << "1. Free Healing" << endl; cout << "2. Leave shop" << endl; cin >> shopchoice; if (shopchoice == 2) town(); else if (shopchoice == 1) { system("CLS"); life = maxLife; cout << "You have been healed for no fee!" << endl; cout << "Goodluck on your adventures" << endl; system("PAUSE"); town(); } }
I am testing changing the life when you heal, but for some reason it never sets it to 200, it stays 100. Any suggestions would be gladly appreciated. Thanks guys.



LinkBack URL
About LinkBacks


