Advertisement
skitzFist

Untitled

Nov 23rd, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <windows.h>
  4.  
  5. using namespace std;
  6.  
  7. //funktion för text på dialog
  8. void txtDia(){
  9.  
  10. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN);
  11. }
  12.  
  13.  
  14. //funktion för att återställa färg på text
  15. void* txtNorm(){
  16. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
  17. }
  18.  
  19.  
  20. //Function for Highligting choices in colour
  21. void txtChoice(){
  22. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_BLUE);
  23. }
  24.  
  25.  
  26. //Funktion för UI input
  27. void uiInput(){
  28. cout << "--> ";
  29. }
  30.  
  31.  
  32. //Klass för att skapa en karaktär, hålla koll på stats och inventory.
  33. class Hero{
  34. public:
  35. string name;
  36. int str;
  37. int dex;
  38. int inte;
  39.  
  40. int gold;
  41.  
  42. int sword;
  43. int knife;
  44. int magic;
  45. int health;
  46. //Hero (string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic);
  47. void createHero(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic, int _health);
  48. };
  49.  
  50.  
  51. //Konstruktor till klassen Hero
  52. /*Hero::Hero(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic){
  53.  
  54. name = _name;
  55. str = _str;
  56. dex = _dex;
  57. inte = _inte;
  58. gold = _gold;
  59. sword = _sword;
  60. knife = _knife;
  61. magic = _magic;
  62. } */
  63.  
  64. void Hero::createHero(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic, int _health){
  65.  
  66.  
  67. cout << "Your goal is to survive one day in this crazy and messed up world.\n"
  68. "In order to survive you must know that every action has a consequence. Choose\nwisely who you are,"
  69. " your life depends on it...\n\n\n";
  70.  
  71. cout << "Your name: "; cin >> _name;
  72.  
  73. string choice1;
  74.  
  75. do{
  76. cout << "\nYour parents are since long dead, they left you with a small hut\nin the poorer districts of the city. But they also left you something else.\n\n"
  77. "A) Your father, whom was a soldier, left you his "; txtChoice(); cout << "sword\n\n"; txtNorm();
  78. cout << "B) Your mother was a fierce rogue while alive, she left you her beloved "; txtChoice(); cout << "dagger"; txtNorm(); cout << ".\n\n";
  79. cout << "C) Your parents were always poor while alive, but they had managed to save up a\nsmall pile of "; txtChoice(); cout << "gold"; txtNorm(); cout << " for you.\n\n";
  80. cout << "D) A dusty"; txtChoice(); cout << " book"; txtNorm(); cout << " that your mother always hid away from your father.\n\n";
  81. uiInput(); cin >> choice1;
  82.  
  83. if (choice1 == "sword" || choice1 == "Sword"){
  84. _sword = 1;
  85. _str = 1;
  86. _health = 2;
  87. cout << "Your fathers sword is still sharp, it feels heavy in your arms.\nIt will come of good use to you in the future\n";
  88. break;
  89. }
  90. else if (choice1 == "Dagger" || choice1 == "dagger"){
  91. _knife = 1;
  92. _dex = 1;
  93.  
  94. cout << "Her dagger has saved you more times than you can remember.\nThe poor district is a harsh place.\n";
  95. break;
  96. }
  97. else if (choice1 == "gold" || choice1 == "Gold"){
  98. _gold = 100;
  99.  
  100. cout << "All that remains of the hefty sum they left you is only a hundred gold pieces,\nstill enough money for a years living\n\n";
  101. break;
  102. }
  103. else if (choice1 == "book" || choice1 == "Book"){
  104. _inte = 1;
  105. _magic = 1;
  106.  
  107. cout << "While reading the book for the first time, you realise it's a book \nexplaining the principles and basics of blood magic.\n"
  108. "You're able to do some basic magic from the book, but the cost is always in\nblood. You only use your magic if your life depends on it.\n\n";
  109. break;
  110. }
  111. else {
  112. system ("cls");
  113. continue;
  114. }
  115. }
  116. while (true);
  117.  
  118.  
  119.  
  120. name = _name;
  121. str = _str;
  122. dex = _dex;
  123. inte = _inte;
  124. gold = _gold;
  125. sword = _sword;
  126. knife = _knife;
  127. magic = _magic;
  128. health = _health;
  129. }
  130.  
  131.  
  132.  
  133. //Funktion för titlescreeen
  134. void titleScr(){
  135.  
  136. cout << "Please extend the console window until it reaches a congenial size\n"
  137. "Choices in this game will be highlighted in purple.\nEnjoy:\n";
  138. system ("PAUSE");
  139. system ("cls");
  140.  
  141. cout <<"___________________¶¶¶¶ \n"
  142. "_______________¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶ \n"
  143. "___________¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶_¶¶¶ \n"
  144. "_________¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  145. "_______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  146. "______¶¶¶¶¶¶¶¶_______¶¶¶¶¶¶¶¶¶___¶¶¶¶\n"
  147. "_____¶¶¶¶¶¶¶______________________¶¶\n"
  148. "_____¶¶¶¶¶¶___¶¶¶¶¶________________¶\n"
  149. "____¶¶¶¶¶¶___¶¶¶1¶¶¶\n"
  150. "____¶¶¶¶¶¶___¶¶111¶¶\n"
  151. "____¶¶¶¶¶¶___¶¶¶1¶¶¶\n"
  152. "____¶¶¶¶¶¶____¶¶1¶¶\n"
  153. "_____¶¶¶¶¶¶___¶¶1¶¶\n"
  154. "_____¶¶¶¶¶¶¶¶_¶¶¶¶¶\n"
  155. "______¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  156. "_______¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  157. "_________¶¶¶¶¶¶¶¶¶¶¶¶\n"
  158. "______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  159. "__¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  160. "____¶¶¶¶11111111111111111¶¶¶¶¶\n"
  161. "_______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  162. "______________¶¶_1_¶¶¶¶¶¶¶¶¶\n"
  163. "______________¶¶_1_¶¶¶¶¶¶¶¶¶¶\n"
  164. "______________¶¶_1_¶¶__¶¶¶¶¶¶\n"
  165. "______________¶¶_1_¶¶___¶¶¶¶¶¶\n"
  166. "______________¶¶_1_¶¶___¶¶¶¶¶¶\n"
  167. "______________¶¶_1_¶¶___¶¶¶¶¶¶\n"
  168. "______________¶¶_1_¶¶___¶¶¶¶¶\n"
  169. "______________¶¶_1_¶¶__¶¶¶¶¶¶\n"
  170. "______________¶¶_1_¶¶¶¶¶¶¶¶¶\n"
  171. "______________¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  172. "______________¶¶¶¶¶¶¶¶¶¶¶\n"
  173. "_____________¶¶¶¶¶¶¶¶¶¶\n"
  174. "____________¶¶¶¶¶¶¶¶¶\n"
  175. "___________¶¶¶¶¶¶¶_¶¶\n"
  176. "__________¶¶¶¶¶¶_1_¶¶\n"
  177. "__________¶¶¶¶¶¶_1_¶¶\n"
  178. "__________¶¶¶¶¶¶_1_¶¶\n"
  179. "__________¶¶¶¶¶¶_1_¶¶\n"
  180. "__________¶¶¶¶¶¶_1_¶¶\n"
  181. "___________¶¶¶¶¶_1_¶¶\n"
  182. "____________¶¶¶¶_1_¶¶\n"
  183. "______________¶¶_1_¶¶¶¶¶¶\n"
  184. "______________¶¶_1_¶¶¶¶¶¶¶¶\n"
  185. "______________¶¶_1_¶¶¶¶¶¶¶¶¶\n"
  186. "______________¶¶_1_¶¶¶_¶¶¶¶¶\n"
  187. "______________¶¶_1_¶¶__¶¶¶¶¶\n"
  188. "______________¶¶___¶¶¶¶¶¶¶¶¶\n"
  189. "______________¶¶___¶¶¶¶¶¶¶¶\n"
  190. "______________¶¶¶¶¶¶¶¶¶¶¶\n"
  191. "______________¶¶¶¶¶¶¶¶¶\n"
  192. "_____________¶¶¶¶¶¶¶¶¶\n"
  193. "____________¶¶¶¶¶¶¶¶¶\n"
  194. "___________¶¶¶¶¶___¶¶\n"
  195. "___________¶¶¶¶¶___¶¶\n"
  196. "___________¶¶¶¶¶___¶¶\n"
  197. "____________¶¶¶¶___¶¶\n"
  198. "____________¶¶¶¶___¶¶\n"
  199. "______________¶¶___¶¶¶¶¶¶\n"
  200. "______________¶¶___¶¶¶¶¶¶¶\n"
  201. "______________¶¶___¶¶_¶¶¶¶¶\n"
  202. "______________¶¶___¶¶___¶¶¶¶\n"
  203. "_______________¶¶_¶¶_____¶¶¶\n"
  204. "________________¶¶¶______¶¶¶\n"
  205. "_________________¶_______¶¶\n"
  206. " _ \n "
  207. "___ _ _ _ __ __ __ (_) __ __ ___ \n"
  208. "/ __| | | | | | '__| \\ \\ / / | | \\ \\ / / / _ \\ \n"
  209. "\\__ \\ | |_| | | | \\ V / | | \\ V / | __/ \n"
  210. "|___/ \\__,_| |_| \\_/ |_| \\_/ \\___| \n";
  211.  
  212. system ("PAUSE");
  213. system ("cls");
  214.  
  215.  
  216.  
  217.  
  218.  
  219. }
  220.  
  221.  
  222.  
  223. int main() {
  224. titleScr();
  225.  
  226. Hero myHero;
  227.  
  228. myHero.createHero(myHero.name, myHero.str, myHero.dex, myHero.inte, myHero.gold, myHero.sword, myHero.knife, myHero.magic, myHero.health);
  229.  
  230.  
  231.  
  232. system ("PAUSE");
  233. return 0;
  234. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement