Advertisement
VIPToxic

CODE

Nov 2nd, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.31 KB | None | 0 0
  1.  
  2. #include "stdafx.h"
  3. #include <iostream>
  4. #include <sstream>
  5. #include <ctime>
  6. #include <stdlib.h>
  7. #include <string>
  8. #include <random>
  9. #include <cstdlib>
  10. #include <windows.h>
  11. #ifdef __unix__
  12. # include <unistd.h>
  13. #elif defined _WIN32
  14. # include <windows.h>
  15. #define sleep(x) Sleep(1000 * x)
  16. #endif
  17.  
  18.  
  19.  
  20. using namespace std;
  21. //Intro and Menu
  22. void Intro();
  23. void Menu();
  24.  
  25. //Back to menu
  26. void BToMenu();
  27. //Functions
  28. void hunt();
  29. void MeatA();
  30. void Rest();
  31. //Rest and How much is awarded during Rest
  32. int rest = 10;
  33. int RAward = 1.00;
  34. //Menu
  35. int menu;
  36. //Random Meat Gen , Meat Count and Meat Awarded
  37.  
  38. int Meat = 0;
  39. int MAward = 1.00;
  40.  
  41.  
  42. //Arrays Begin
  43. //Arrays End
  44.  
  45. int main()
  46. {
  47.     //Launches on start up
  48.     Intro();
  49.     Menu();
  50.     return 0;
  51. }
  52.  
  53. void Intro()
  54. {
  55.     cout << "Welcome to the RPG Game by Karl O'Connor" << endl;
  56.     //cout << "You need to level up to rank 10 to fight Jason" << endl;
  57.     cout << "You need to hunt to find food to survive." << endl;
  58.     cout << endl;
  59.     cout << endl;
  60. }
  61.  
  62.  
  63.  
  64. void Menu()
  65. {
  66.     system("color e");
  67.     cout << " Would you like to" << endl
  68.         << "1. Hunt  2 . Rest 3. Quit" << endl
  69.         << "You have " << Meat << " meat and you are " << rest << " tired" << endl;
  70.     cin >> menu;
  71.     if (menu == 1)
  72.     {
  73.         hunt();
  74.     }
  75.  
  76.     if (menu == 2)
  77.     {
  78.         Rest();
  79.     }
  80.     if (menu == 3)
  81.     {
  82.         system("cls");
  83.         system("color 4");
  84.         cout << "QUITING" << endl;
  85.         system("exit");
  86.     }
  87.  
  88. }
  89.  
  90.  
  91.  
  92.  
  93. void Rest()
  94. {
  95.     if (rest == 10)
  96.     {
  97.         system("cls");
  98.         cout << "You are not tired" << endl;
  99.         cout << endl;
  100.         Menu();
  101.  
  102.     }
  103.  
  104.     if (menu == 2)
  105.     {
  106.         if (rest != 10)
  107.         {
  108.             system("cls");
  109.             rest += 5;
  110.             cout << "Rest is now " << rest << endl;
  111.             cout << endl;
  112.             cout << endl;
  113.             Menu();
  114.         }
  115.     }
  116.  
  117. }
  118.  
  119. void BToMenu()
  120. {
  121.     Menu();
  122. }
  123.  
  124. void hunt()
  125. {
  126.     if (rest < 5)
  127.     {
  128.         system("cls");
  129.         cout << "You need to rest";
  130.         cout << endl;
  131.         cout << endl;
  132.  
  133.         Menu();
  134.     }
  135.     if (menu == 1)
  136.     {
  137.         system("color 3");
  138.         system("cls");
  139.             cout << "HUNTING." << endl;
  140.             sleep(1);
  141.             system("cls");
  142.             cout << "HUNTING.." << endl;
  143.             sleep(1);
  144.             system("cls");
  145.             cout << "HUNTING..." << endl;
  146.             sleep(1);
  147.             system("cls");
  148.             Meat += 1;
  149.             rest -= 5;
  150.             cout << "You gained 1 Meat. You currently have " << Meat << endl;
  151.             sleep(2);
  152.             BToMenu();
  153.  
  154.  
  155.     }
  156.    
  157.  
  158. }
  159.  
  160. void MeatA()
  161. {
  162.    
  163.  
  164. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement