Text based rpg


SUBMITTED BY: Guest

DATE: Nov. 15, 2013, 9:42 p.m.

FORMAT: Text only

SIZE: 27.4 kB

HITS: 792

  1. //main.cpp
  2. #include <iostream>
  3. #include "Dialogues.h"
  4. #include "Fights.h"
  5. #include <windows.h>
  6. #include <string>
  7. using namespace std;
  8. int main()
  9. {
  10. Dialogues dialogue;
  11. dialogue.WelcomeScreenAct1();
  12. dialogue.CreationScreen();
  13. dialogue.SwampPath();
  14. }
  15. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  16. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  17. //dialogues.cpp
  18. #include <iostream>
  19. #include <windows.h>
  20. #include "Dialogues.h"
  21. #include "Fights.cpp"
  22. #include <fstream>
  23. using namespace std;
  24. void Dialogues::GameOver()
  25. {
  26. cout << "********************************************************************************";
  27. cout << "********************************************************************************";
  28. cout << "******** ****** ****** ********* ** ** ********";
  29. cout << "******** *************** ** ***** ******* ** ************* ********";
  30. cout << "******** ************** **** **** * ***** * ** ************* ********";
  31. cout << "******** ************* ****** *** ** *** ** ** ************* ********";
  32. cout << "******** ************ ** *** * *** ** ****** ********";
  33. cout << "******** ***** ** ********** ** **** **** ** ************* ********";
  34. cout << "******** ******** ** ********** ** *********** ** ************* ********";
  35. cout << "******** ******** ** ********** ** *********** ** ************* ********";
  36. cout << "******** ** ********** ** *********** ** ** ********";
  37. cout << "********************************************************************** ********";
  38. cout << "********************************************************************** ********";
  39. cout << "******** ** ********** ** ** ******* ********";
  40. cout << "******** ******** ** ********** ** *************** ***** ***** ********";
  41. cout << "******** ******** ** ********** ** *************** ******* *** ********";
  42. cout << "******** ******** ** ********** ** *************** ***** ***** ********";
  43. cout << "******** ******** ** ******** ** ******* ******** ********";
  44. cout << "******** ******** *** ****** *** *************** ********** ********";
  45. cout << "******** ******** **** **** **** *************** ** ******************";
  46. cout << "******** ******** ***** ** ***** *************** **** ****************";
  47. cout << "******** ****** ****** *** ****** **** ********";
  48. cout << "********************************************************************************";
  49. cout << "********************************************************************************";
  50. cout << "********************************************************************************";
  51. }
  52. void Dialogues::WelcomeScreenAct1()
  53. {
  54. string line;
  55. cout << "Welcome to the game! Thanks for playing, hope you enjoy!(Alpha Version 0.3)";
  56. cin.get();
  57. ifstream GameTitle;
  58. GameTitle.open("Game_Title_Art.txt");
  59. while(getline(GameTitle, line))
  60. {
  61. cout << line;
  62. }
  63. GameTitle.close();
  64. cin.get();
  65. system("cls");
  66. cout << "\n\n********************************************************************************";
  67. cout << "********************************************************************************";
  68. cout << "********************************************************************************";
  69. cout << "*************** ************************************ ******************";
  70. cout << "************* **** ******************************** ******************";
  71. cout << "************ ****** ****************************** * ******************";
  72. cout << "************ ****** ***************** ************** ******************";
  73. cout << "************ ****** ***** ****** ************** ******************";
  74. cout << "************ *** *********** ************** ******************";
  75. cout << "************ ****** ** ********* *********** ******************";
  76. cout << "************ ****** ** ************ ************** ******************";
  77. cout << "************ ****** ** ************ ************** ******************";
  78. cout << "************ ****** *** *********** ************** ******************";
  79. cout << "************ ****** ***** ****** ********* *************";
  80. cout << "********************************************************************************";
  81. cout << "********************************************************************************";
  82. cout << "********************************************************************************";
  83. cout << "******************************** Waking up ***********************************";
  84. cout << "********************************************************************************";
  85. cout << "********************************************************************************";
  86. cout << "********************************************************************************";
  87. cout << "********************************************************************************";
  88. cout << "********************************************************************************";
  89. cout << "********************************************************************************";
  90. cout << "********************************************************************************";
  91. cin.get();
  92. system("CLS");
  93. }
  94. Dialogues::Dialogues()
  95. {
  96. }
  97. void Dialogues::CreationScreen()
  98. {
  99. {
  100. string name;
  101. int age, gender;
  102. bool classselect = true;
  103. cout << "You wake up in a forest next to a swamp surrounded by thick bushes and trees.\n";
  104. cout << "You feel a bumb on your head as if you were hit with something.\nYou try to remember who you are...\n";
  105. cout << "You look up to the sky, it's almost midnight, the moon is shining brightly,\nyou have to find shelter.\n\n\n";
  106. while(classselect == true)
  107. {
  108. cin.get();
  109. cout << "\n\n\nWhat is your name?\n";
  110. getline(cin, name);
  111. cout << "\nWell " << name << " , How old are you?\n";
  112. cin >> age;
  113. cout << "\nWhat is your gender?\n\n[1]Male\n[2]Female\n";
  114. cin >> gender;
  115. if(gender == 1)
  116. {
  117. char answer1;
  118. system("cls");
  119. cout << "\nIs this the correct information?\n";
  120. cout << "Name: " << name << "\nage: " << age << "\nGender: Male\n";
  121. cout << "[y/n]\n";
  122. cin >> answer1;
  123. if(answer1 == 'y')
  124. {
  125. cout << "Good! Let's go on further!\n";
  126. classselect = false;
  127. cin.get();
  128. system("cls");
  129. }
  130. if(answer1 == 'n')
  131. {
  132. classselect = true;
  133. cout << "Well let's go back to the creating screen again...";
  134. cin.get();
  135. system("cls");
  136. }
  137. else
  138. {
  139. break;
  140. }
  141. }
  142. }
  143. }
  144. }
  145. void Dialogues::SwampPath()
  146. {
  147. int swampPath, housetrystart=1, vinesstart=1;
  148. system("cls");
  149. cout << "Choose the path you wanna go:\n\n";
  150. cout << "[1] An abandoned house with lights coming out of it's windows.\n";
  151. cout << "[2] A path leading somewhere (blocked by vines)\n";
  152. cin >> swampPath;
  153. system("CLS");
  154. if(swampPath == 1 && housetrystart == 1)
  155. {
  156. cout << "You approach the house\nas you hear loud grunting noises coming out of the inside,\nyou come in and open the squeacking door,\nthe noise stops and you encounter a gigantic rat!\n";
  157. }
  158. if(swampPath == 2 && vinesstart == 1)
  159. {
  160. cout << "You go up to the path,\nyou can hear screams from far away and the smell of burning wood,\nyou try to get past the vines, but they are too strong for you,\nyou need something sharp, you go back to the swamp.\n";
  161. cin.ignore();
  162. cin.get();
  163. Dialogues::SwampPath();
  164. }
  165. }
  166. #include <iostream>
  167. #include <windows.h>
  168. #include "Dialogues.h"
  169. #include "Fights.cpp"
  170. #include <fstream>
  171. using namespace std;
  172. void Dialogues::GameOver()
  173. {
  174. cout << "********************************************************************************";
  175. cout << "********************************************************************************";
  176. cout << "******** ****** ****** ********* ** ** ********";
  177. cout << "******** *************** ** ***** ******* ** ************* ********";
  178. cout << "******** ************** **** **** * ***** * ** ************* ********";
  179. cout << "******** ************* ****** *** ** *** ** ** ************* ********";
  180. cout << "******** ************ ** *** * *** ** ****** ********";
  181. cout << "******** ***** ** ********** ** **** **** ** ************* ********";
  182. cout << "******** ******** ** ********** ** *********** ** ************* ********";
  183. cout << "******** ******** ** ********** ** *********** ** ************* ********";
  184. cout << "******** ** ********** ** *********** ** ** ********";
  185. cout << "********************************************************************** ********";
  186. cout << "********************************************************************** ********";
  187. cout << "******** ** ********** ** ** ******* ********";
  188. cout << "******** ******** ** ********** ** *************** ***** ***** ********";
  189. cout << "******** ******** ** ********** ** *************** ******* *** ********";
  190. cout << "******** ******** ** ********** ** *************** ***** ***** ********";
  191. cout << "******** ******** ** ******** ** ******* ******** ********";
  192. cout << "******** ******** *** ****** *** *************** ********** ********";
  193. cout << "******** ******** **** **** **** *************** ** ******************";
  194. cout << "******** ******** ***** ** ***** *************** **** ****************";
  195. cout << "******** ****** ****** *** ****** **** ********";
  196. cout << "********************************************************************************";
  197. cout << "********************************************************************************";
  198. cout << "********************************************************************************";
  199. }
  200. void Dialogues::WelcomeScreenAct1()
  201. {
  202. string line;
  203. cout << "Welcome to the game! Thanks for playing, hope you enjoy!(Alpha Version 0.3)";
  204. cin.get();
  205. ifstream GameTitle;
  206. GameTitle.open("Game_Title_Art.txt");
  207. while(getline(GameTitle, line))
  208. {
  209. cout << line;
  210. }
  211. GameTitle.close();
  212. cin.get();
  213. system("cls");
  214. cout << "\n\n********************************************************************************";
  215. cout << "********************************************************************************";
  216. cout << "********************************************************************************";
  217. cout << "*************** ************************************ ******************";
  218. cout << "************* **** ******************************** ******************";
  219. cout << "************ ****** ****************************** * ******************";
  220. cout << "************ ****** ***************** ************** ******************";
  221. cout << "************ ****** ***** ****** ************** ******************";
  222. cout << "************ *** *********** ************** ******************";
  223. cout << "************ ****** ** ********* *********** ******************";
  224. cout << "************ ****** ** ************ ************** ******************";
  225. cout << "************ ****** ** ************ ************** ******************";
  226. cout << "************ ****** *** *********** ************** ******************";
  227. cout << "************ ****** ***** ****** ********* *************";
  228. cout << "********************************************************************************";
  229. cout << "********************************************************************************";
  230. cout << "********************************************************************************";
  231. cout << "******************************** Waking up ***********************************";
  232. cout << "********************************************************************************";
  233. cout << "********************************************************************************";
  234. cout << "********************************************************************************";
  235. cout << "********************************************************************************";
  236. cout << "********************************************************************************";
  237. cout << "********************************************************************************";
  238. cout << "********************************************************************************";
  239. cin.get();
  240. system("CLS");
  241. }
  242. Dialogues::Dialogues()
  243. {
  244. }
  245. void Dialogues::CreationScreen()
  246. {
  247. {
  248. string name;
  249. int age, gender;
  250. bool classselect = true;
  251. cout << "You wake up in a forest next to a swamp surrounded by thick bushes and trees.\n";
  252. cout << "You feel a bumb on your head as if you were hit with something.\nYou try to remember who you are...\n";
  253. cout << "You look up to the sky, it's almost midnight, the moon is shining brightly,\nyou have to find shelter.\n\n\n";
  254. while(classselect == true)
  255. {
  256. cin.get();
  257. cout << "\n\n\nWhat is your name?\n";
  258. getline(cin, name);
  259. cout << "\nWell " << name << " , How old are you?\n";
  260. cin >> age;
  261. cout << "\nWhat is your gender?\n\n[1]Male\n[2]Female\n";
  262. cin >> gender;
  263. if(gender == 1)
  264. {
  265. char answer1;
  266. system("cls");
  267. cout << "\nIs this the correct information?\n";
  268. cout << "Name: " << name << "\nage: " << age << "\nGender: Male\n";
  269. cout << "[y/n]\n";
  270. cin >> answer1;
  271. if(answer1 == 'y')
  272. {
  273. cout << "Good! Let's go on further!\n";
  274. classselect = false;
  275. cin.get();
  276. system("cls");
  277. }
  278. if(answer1 == 'n')
  279. {
  280. classselect = true;
  281. cout << "Well let's go back to the creating screen again...";
  282. cin.get();
  283. system("cls");
  284. }
  285. else
  286. {
  287. break;
  288. }
  289. }
  290. }
  291. }
  292. }
  293. void Dialogues::SwampPath()
  294. {
  295. int swampPath, housetrystart=1, vinesstart=1;
  296. system("cls");
  297. cout << "Choose the path you wanna go:\n\n";
  298. cout << "[1] An abandoned house with lights coming out of it's windows.\n";
  299. cout << "[2] A path leading somewhere (blocked by vines)\n";
  300. cin >> swampPath;
  301. system("CLS");
  302. if(swampPath == 1 && housetrystart == 1)
  303. {
  304. cout << "You approach the house\nas you hear loud grunting noises coming out of the inside,\nyou come in and open the squeacking door,\nthe noise stops and you encounter a gigantic rat!\n";
  305. }
  306. if(swampPath == 2 && vinesstart == 1)
  307. {
  308. cout << "You go up to the path,\nyou can hear screams from far away and the smell of burning wood,\nyou try to get past the vines, but they are too strong for you,\nyou need something sharp, you go back to the swamp.\n";
  309. cin.ignore();
  310. cin.get();
  311. Dialogues::SwampPath();
  312. }
  313. }
  314. #include <iostream>
  315. #include <windows.h>
  316. #include "Dialogues.h"
  317. #include "Fights.cpp"
  318. #include <fstream>
  319. using namespace std;
  320. void Dialogues::GameOver()
  321. {
  322. cout << "********************************************************************************";
  323. cout << "********************************************************************************";
  324. cout << "******** ****** ****** ********* ** ** ********";
  325. cout << "******** *************** ** ***** ******* ** ************* ********";
  326. cout << "******** ************** **** **** * ***** * ** ************* ********";
  327. cout << "******** ************* ****** *** ** *** ** ** ************* ********";
  328. cout << "******** ************ ** *** * *** ** ****** ********";
  329. cout << "******** ***** ** ********** ** **** **** ** ************* ********";
  330. cout << "******** ******** ** ********** ** *********** ** ************* ********";
  331. cout << "******** ******** ** ********** ** *********** ** ************* ********";
  332. cout << "******** ** ********** ** *********** ** ** ********";
  333. cout << "********************************************************************** ********";
  334. cout << "********************************************************************** ********";
  335. cout << "******** ** ********** ** ** ******* ********";
  336. cout << "******** ******** ** ********** ** *************** ***** ***** ********";
  337. cout << "******** ******** ** ********** ** *************** ******* *** ********";
  338. cout << "******** ******** ** ********** ** *************** ***** ***** ********";
  339. cout << "******** ******** ** ******** ** ******* ******** ********";
  340. cout << "******** ******** *** ****** *** *************** ********** ********";
  341. cout << "******** ******** **** **** **** *************** ** ******************";
  342. cout << "******** ******** ***** ** ***** *************** **** ****************";
  343. cout << "******** ****** ****** *** ****** **** ********";
  344. cout << "********************************************************************************";
  345. cout << "********************************************************************************";
  346. cout << "********************************************************************************";
  347. }
  348. void Dialogues::WelcomeScreenAct1()
  349. {
  350. string line;
  351. cout << "Welcome to the game! Thanks for playing, hope you enjoy!(Alpha Version 0.3)";
  352. cin.get();
  353. ifstream GameTitle;
  354. GameTitle.open("Game_Title_Art.txt");
  355. while(getline(GameTitle, line))
  356. {
  357. cout << line;
  358. }
  359. GameTitle.close();
  360. cin.get();
  361. system("cls");
  362. cout << "\n\n********************************************************************************";
  363. cout << "********************************************************************************";
  364. cout << "********************************************************************************";
  365. cout << "*************** ************************************ ******************";
  366. cout << "************* **** ******************************** ******************";
  367. cout << "************ ****** ****************************** * ******************";
  368. cout << "************ ****** ***************** ************** ******************";
  369. cout << "************ ****** ***** ****** ************** ******************";
  370. cout << "************ *** *********** ************** ******************";
  371. cout << "************ ****** ** ********* *********** ******************";
  372. cout << "************ ****** ** ************ ************** ******************";
  373. cout << "************ ****** ** ************ ************** ******************";
  374. cout << "************ ****** *** *********** ************** ******************";
  375. cout << "************ ****** ***** ****** ********* *************";
  376. cout << "********************************************************************************";
  377. cout << "********************************************************************************";
  378. cout << "********************************************************************************";
  379. cout << "******************************** Waking up ***********************************";
  380. cout << "********************************************************************************";
  381. cout << "********************************************************************************";
  382. cout << "********************************************************************************";
  383. cout << "********************************************************************************";
  384. cout << "********************************************************************************";
  385. cout << "********************************************************************************";
  386. cout << "********************************************************************************";
  387. cin.get();
  388. system("CLS");
  389. }
  390. Dialogues::Dialogues()
  391. {
  392. }
  393. void Dialogues::CreationScreen()
  394. {
  395. {
  396. string name;
  397. int age, gender;
  398. bool classselect = true;
  399. cout << "You wake up in a forest next to a swamp surrounded by thick bushes and trees.\n";
  400. cout << "You feel a bumb on your head as if you were hit with something.\nYou try to remember who you are...\n";
  401. cout << "You look up to the sky, it's almost midnight, the moon is shining brightly,\nyou have to find shelter.\n\n\n";
  402. while(classselect == true)
  403. {
  404. cin.get();
  405. cout << "\n\n\nWhat is your name?\n";
  406. getline(cin, name);
  407. cout << "\nWell " << name << " , How old are you?\n";
  408. cin >> age;
  409. cout << "\nWhat is your gender?\n\n[1]Male\n[2]Female\n";
  410. cin >> gender;
  411. if(gender == 1)
  412. {
  413. char answer1;
  414. system("cls");
  415. cout << "\nIs this the correct information?\n";
  416. cout << "Name: " << name << "\nage: " << age << "\nGender: Male\n";
  417. cout << "[y/n]\n";
  418. cin >> answer1;
  419. if(answer1 == 'y')
  420. {
  421. cout << "Good! Let's go on further!\n";
  422. classselect = false;
  423. cin.get();
  424. system("cls");
  425. }
  426. if(answer1 == 'n')
  427. {
  428. classselect = true;
  429. cout << "Well let's go back to the creating screen again...";
  430. cin.get();
  431. system("cls");
  432. }
  433. else
  434. {
  435. break;
  436. }
  437. }
  438. }
  439. }
  440. }
  441. void Dialogues::SwampPath()
  442. {
  443. int swampPath, housetrystart=1, vinesstart=1;
  444. system("cls");
  445. cout << "Choose the path you wanna go:\n\n";
  446. cout << "[1] An abandoned house with lights coming out of it's windows.\n";
  447. cout << "[2] A path leading somewhere (blocked by vines)\n";
  448. cin >> swampPath;
  449. system("CLS");
  450. if(swampPath == 1 && housetrystart == 1)
  451. {
  452. cout << "You approach the house\nas you hear loud grunting noises coming out of the inside,\nyou come in and open the squeacking door,\nthe noise stops and you encounter a gigantic rat!\n";
  453. }
  454. if(swampPath == 2 && vinesstart == 1)
  455. {
  456. cout << "You go up to the path,\nyou can hear screams from far away and the smell of burning wood,\nyou try to get past the vines, but they are too strong for you,\nyou need something sharp, you go back to the swamp.\n";
  457. cin.ignore();
  458. cin.get();
  459. Dialogues::SwampPath();
  460. }
  461. }
  462. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  463. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  464. //dialogues.h
  465. #ifndef DIALOGUES_H
  466. #define DIALOGUES_H
  467. #include "Fights.cpp"
  468. class Dialogues
  469. {
  470. public:
  471. void GameOver();
  472. Dialogues();
  473. void WelcomeScreenAct1();
  474. void StoryStart();
  475. void CreationScreen();
  476. void SwampPath();
  477. };
  478. #endif // DIALOGUES_H
  479. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  480. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  481. //fights.cpp
  482. #include <iostream>
  483. #include <windows.h>
  484. #include "Dialogues.h"
  485. #include <fstream>
  486. using namespace std;
  487. void RatFight()
  488. {
  489. cout << "What do you do?";
  490. cout << "[1]Fight!\n";
  491. cout << "[2]Run!";
  492. }

comments powered by Disqus