Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include "shuvas.h"
using namespace std;
void cls()
{
system ("clear");
}
void GameClass2::beachFun() //creating and naming a function
{
cout << "congratulations, you are at the beach now..." << endl; //used to output text on to the screen
sleep(2);
cout << "The sand is softly golden with just the right comforting warmth..." << endl;// endl used for a new line
sleep(2);
cout << "To rest on the beach feels like a cosy hug, one only matched by the sunshine filled sky..." << endl;
sleep(2);
cout << "you can move to the next level..." << endl;
}
void GameClass::wrongFun()
{
cout << "Warning! Warning!" << endl;
cout << "You are doing it wrong player!" << endl;
cout << "Please" << endl;
cout << "Please" << endl;
cout << "Please Enter: " << endl;
cout << "1 for Yes & 2 for No" << endl;
cout << "Thank You for reading this, player!" << endl;
}
void GameClass::riverFun()
{
string RiverChoice; //declaring a string a variable so it can be used to store user input
cout << "you are at the Rio River now. " << endl;
sleep(3);
cout << "the river is clear blue, beautiful and very deep(the with hasn't been here yet)." << endl;
sleep(3);
cout << "it is also oozing with amazing sealife " << endl;
sleep(3);
cls();
cout << "there seems to be a shaky bridge leading to the other side of the river." << endl;
sleep(3);
goFish:
cout << "\nenter 1 to kill and eat a fish, enter 2 to go back to the pathway, enter 3 to cross the river";
sleep(2);
cout << "Enter your choice: ";
cin >> RiverChoice;//used to capture input from the user(crucial for output)
if (RiverChoice == "1")//condition to run the if statement
{
//beach
//increase attack
DataBase::modifyPlayerAttack(DataBase::playerID, +20);
DataBase::modifyPlayerHealth(DataBase::playerID, +20);
cout << "Your attack and health have increased by 20" << endl;
}
else if (RiverChoice == "2")
{
//back to pathway
choice1pathway();
}
else if (RiverChoice == "3")
{
GameClass2 beachObject;
beachObject.beachFun();
}
else
{
wrongFun();
goto goFish; //goes back to where "goFish:" was declared
}
}
void GameClass::cottageFun()
{
//cottage
string battleStr;
cout << "the cottage looks old and dirty..." << endl;
sleep(3);
cout << "it has a bright white door and two small windows..." << endl;
sleep(3);
cout << "an enemy is guarding the door" << endl;
sleep(3);
cout << "\nDo you wish to battle? (enter 1 for yes, 2 for no)... " << endl;
cout << "Enter your choice: ";
goBattle:
cin >> battleStr;
if (battleStr == "1")
{
string ToRiver;
cout << "you defeat the enemey but your health drops by 20..." << endl;
DataBase::modifyPlayerHealth(DataBase::playerID, -20);
cout << "you defeat enemey so you recieve money of 1000" << endl;
//update money
cout << "Enter 1 to battle again or Enter 2 to leave " << endl;
cout << "Enter your choice: ";
cin >> ToRiver;
if (ToRiver == "1")
{
goto goBattle;
}
else
{
cout << "you are forced to make your way to the extraordinary Rio River" << endl;
riverFun();
}
}
else if (battleStr == "2")
{
cout << "you are forced to make your way to the extraordinary Rio River" << endl;
//drop defence
riverFun();
}
else
{
wrongFun();
goto goBattle;
}
}
void GameClass::moreForestFun()
{
string fightLeeches, useMachete;
cout << "the sheer amount of vines and branches is overwhelming and you can't get through" << endl;
sleep(3);
cout << "do you want to use you machete to cut through the trees and the vines?" << endl;
sleep(3);
cout << "enter 1 for yes and 2 for no" << endl;
goMachete:
cin >> useMachete;
if (useMachete == "1")
{
cout << "health drops by 5" << endl;
DataBase::modifyPlayerHealth(DataBase::playerID, -20);
}
else if (useMachete == "1")
{
cout << "attack increases by 5" << endl;
DataBase::modifyPlayerAttack(DataBase::playerID, +20);
}
else
{
wrongFun();
goto goMachete;
}
cout << "dirty leeches are covering your arms and you are hurting" << endl;
sleep(3);
cout << "health drops by 20" << endl;
DataBase::modifyPlayerHealth (DataBase::playerID, -20);
goLeeches:
cout << "you can either burn off the leeches whilst they are on your arm...(enter 1) " << endl;
cout << "or you can remove them one by one (by entering 2)" << endl;
cout << "what do you want to do: " << endl;
cin >> fightLeeches;
if (fightLeeches == "1")
{
cout << "whilst burning the leeches you have burned yourself too" << endl;
DataBase::modifyPlayerHealth (DataBase::playerID, -20);
cout << "you go to the river so you can cool yourself" << endl;
riverFun();
}
else if (fightLeeches == "2")
{
cout << "you have got rid of the leeches but it took you very long" << endl;
cout << "now you are very hungry so you go to the cottage" << endl;
cottageFun();
}
else
{
wrongFun();
goto goLeeches;
}
}
void GameClass::followAnimal()
{
string fightAnimals;
cout << "It's been a few minutes since you started following this animal..." << endl;
sleep(3);
cout << "This animal is very ugly, your eyes hurt just looking at it..." << endl;
sleep(3);
cout << "This creature has lead you to its pack" << endl;
sleep(3);
cout << "The pack is quite large but it is possible to attack them" << endl;
sleep(3);
cls();
goFightAnimals:
cout << "What do you choose to do?" << endl;
cout << "Enter 1 to attack the animals for extra attack" << endl;
cout << "Enter 2 to leave the animal and steal their money" << endl;
cout << "Enter: ";
cin >> fightAnimals;
if (fightAnimals == "1")
{
DataBase::modifyPlayerAttack(DataBase::playerID, -20);
cout << "you are too strong for the animals" << endl;
sleep(3);
cout << "you have completely brutally mashed up the animals and their habitat" << endl;
sleep(3);
cout << "there is so much blood everywhere" << endl;
sleep(3);
cout << "you are an evil savage" << endl;
sleep(3);
cls();
//attack increases by 20
}
else if (fightAnimals == "2")
{
cout << "you recieve 20 coins and leave to the forest" << endl;
moreForestFun();
}
else
{
wrongFun();
goto goFightAnimals;
}
}
void GameClass::choice1pathway ()
{
string choiceTwo_Path;
cls();
//pathway
cout << "You are at the pathway" << endl;
sleep(2);
cout << "\nThis is a safe choice but might not lead anywhere." << endl;
sleep(2);
cout << "But, this could be a risky choice because you are easier to be spotted by enemeies" << endl;
sleep(2);
cout << "you walk for a half an hour"<< endl;
sleep(2);
cout << "a small ugly strange animal rushes past you" << endl;
sleep(2);
cout << "you see a small cottage in the distance" << endl;
sleep(2);
cout << "you have two options now " << endl;
sleep(3);
cls();
gofollowAnimal2:
cout << "Enter 1 to follow animal. Enter 2 to go to the cottage " << endl;
do {
cin >> choiceTwo_Path;
if(choiceTwo_Path == "1")
{
//river
followAnimal();
}
else if (choiceTwo_Path == "2")
{
//cottage
GameClass cottageObject;
cottageObject.cottageFun();
}
else
{
wrongFun();
goto gofollowAnimal2;
}
} while (choiceTwo_Path != "1" && choiceTwo_Path != "2");
}
void GameClass::choice2forest ()
{
string choiceTwo_Path;
cls();
//forest
cout << "This is a risky choice as you might get lost" << endl;
sleep(3);
cout << "There is no clear way and you will need to make your own way" << endl;
sleep(3);
cout << "you have made your way through for 20 minutes but now there are too many vines and branches in your way" << endl;
sleep(3);
cout << "you have two choices now, you can see a small cottage in the distance outside of the forest." << endl;
sleep(3);
cls();
do
{
cout << "enter 1 to continue making your way through the forest." << endl;
cout << "enter 2 to approch the small cottage." << endl;
cout << "\nenter your choice: ";
cin >> choiceTwo_Path;
if(choiceTwo_Path == "1")
{
//moreForest
GameClass forestObject;//you state the class and create instance of that class
forestObject.moreForestFun(); //you assign the function to the instance
}
else if (choiceTwo_Path == "2")
{
//cottage
GameClass cottageObject;
cottageObject.cottageFun();
}
else
{
wrongFun();
}
} while (choiceTwo_Path != "1" && choiceTwo_Path != "2");
}
void GameClass::introFun ()
{
cout <<""<< endl;
sleep (1);
cls();
cout << "Hello|Hello|Hello|Hello|Hello|Hello|Hello|" << endl;
sleep(1);
cout << "And|And|And|And|And|And|And|And|And|" << endl;
sleep(1);
cout << "Welcome|Welcome|Welcome|Welcome|Welcome|" << endl;
sleep(1);
cout << "To|To|To|To|To|To|To|To|To|" << endl;
sleep(1);
cout << "The Forest|The Forest|The Forest|The Forest|The Forest|The Forest|The Forest|" << endl;
sleep(2);
cls();
cout << "Copyrights Shuvas Rayamajhi 2018." << endl;
sleep(2);
cls();
cout << "Hold up!" << endl;
sleep(1);
cout << "Hold up!" << endl;
sleep(1);
cout << "Hold up!" << endl;
sleep(1);
cout << "Hold up!" << endl;
sleep(1);
cout << "Where the hell are you...." << endl;
sleep(2);
cout << "You look around..." << endl;
sleep(2);
cout << "The forest looks ancient... " << endl;
sleep(3);
cout << "The trees thick and old, roots that brutally twisted..." << endl;
sleep(3);
cout << "There might once have been filled with bird-song and animals that roamed..." << endl;
sleep(3);
cout << "But now it's ages past its former glory..." << endl;
sleep(3);
cout << "It's canopy was so dense that you could only see the occasional streak of sunlight that rarely touched the forest floor..." << endl;
sleep(3);
cout << "Even its thick vines were slowly taking away the last remnants of the temple that stood in the centre..." << endl;
sleep(3);
cls();
}