Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <windows.h>
- using namespace std;
- //funktion för text på dialog
- void txtDia(){
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN);
- }
- //funktion för att återställa färg på text
- void* txtNorm(){
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
- }
- //Function for Highligting choices in colour
- void txtChoice(){
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_BLUE);
- }
- //Funktion för UI input
- void uiInput(){
- cout << "--> ";
- }
- //Klass för att skapa en karaktär, hålla koll på stats och inventory.
- class Hero{
- public:
- string name;
- int str;
- int dex;
- int inte;
- int gold;
- int sword;
- int knife;
- int magic;
- int health;
- //Hero (string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic);
- void createHero(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic, int _health);
- };
- //Konstruktor till klassen Hero
- /*Hero::Hero(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic){
- name = _name;
- str = _str;
- dex = _dex;
- inte = _inte;
- gold = _gold;
- sword = _sword;
- knife = _knife;
- magic = _magic;
- } */
- void Hero::createHero(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic, int _health){
- cout << "Your goal is to survive one day in this crazy and messed up world.\n"
- "In order to survive you must know that every action has a consequence. Choose\nwisely who you are,"
- " your life depends on it...\n\n\n";
- cout << "Your name: "; cin >> _name;
- string choice1;
- do{
- 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"
- "A) Your father, whom was a soldier, left you his "; txtChoice(); cout << "sword\n\n"; txtNorm();
- cout << "B) Your mother was a fierce rogue while alive, she left you her beloved "; txtChoice(); cout << "dagger"; txtNorm(); cout << ".\n\n";
- 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";
- cout << "D) A dusty"; txtChoice(); cout << " book"; txtNorm(); cout << " that your mother always hid away from your father.\n\n";
- uiInput(); cin >> choice1;
- if (choice1 == "sword" || choice1 == "Sword"){
- _sword = 1;
- _str = 1;
- _health = 2;
- 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";
- break;
- }
- else if (choice1 == "Dagger" || choice1 == "dagger"){
- _knife = 1;
- _dex = 1;
- cout << "Her dagger has saved you more times than you can remember.\nThe poor district is a harsh place.\n";
- break;
- }
- else if (choice1 == "gold" || choice1 == "Gold"){
- _gold = 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";
- break;
- }
- else if (choice1 == "book" || choice1 == "Book"){
- _inte = 1;
- _magic = 1;
- cout << "While reading the book for the first time, you realise it's a book \nexplaining the principles and basics of blood magic.\n"
- "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";
- break;
- }
- else {
- system ("cls");
- continue;
- }
- }
- while (true);
- name = _name;
- str = _str;
- dex = _dex;
- inte = _inte;
- gold = _gold;
- sword = _sword;
- knife = _knife;
- magic = _magic;
- health = _health;
- }
- //Funktion för titlescreeen
- void titleScr(){
- cout << "Please extend the console window until it reaches a congenial size\n"
- "Choices in this game will be highlighted in purple.\nEnjoy:\n";
- system ("PAUSE");
- system ("cls");
- cout <<"___________________¶¶¶¶ \n"
- "_______________¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶ \n"
- "___________¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶_¶¶¶ \n"
- "_________¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "_______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "______¶¶¶¶¶¶¶¶_______¶¶¶¶¶¶¶¶¶___¶¶¶¶\n"
- "_____¶¶¶¶¶¶¶______________________¶¶\n"
- "_____¶¶¶¶¶¶___¶¶¶¶¶________________¶\n"
- "____¶¶¶¶¶¶___¶¶¶1¶¶¶\n"
- "____¶¶¶¶¶¶___¶¶111¶¶\n"
- "____¶¶¶¶¶¶___¶¶¶1¶¶¶\n"
- "____¶¶¶¶¶¶____¶¶1¶¶\n"
- "_____¶¶¶¶¶¶___¶¶1¶¶\n"
- "_____¶¶¶¶¶¶¶¶_¶¶¶¶¶\n"
- "______¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "_______¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "_________¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "__¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "____¶¶¶¶11111111111111111¶¶¶¶¶\n"
- "_______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶__¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶___¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶___¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶___¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶___¶¶¶¶¶\n"
- "______________¶¶_1_¶¶__¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶¶¶¶¶¶¶¶¶¶\n"
- "_____________¶¶¶¶¶¶¶¶¶¶\n"
- "____________¶¶¶¶¶¶¶¶¶\n"
- "___________¶¶¶¶¶¶¶_¶¶\n"
- "__________¶¶¶¶¶¶_1_¶¶\n"
- "__________¶¶¶¶¶¶_1_¶¶\n"
- "__________¶¶¶¶¶¶_1_¶¶\n"
- "__________¶¶¶¶¶¶_1_¶¶\n"
- "__________¶¶¶¶¶¶_1_¶¶\n"
- "___________¶¶¶¶¶_1_¶¶\n"
- "____________¶¶¶¶_1_¶¶\n"
- "______________¶¶_1_¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶_1_¶¶¶_¶¶¶¶¶\n"
- "______________¶¶_1_¶¶__¶¶¶¶¶\n"
- "______________¶¶___¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶___¶¶¶¶¶¶¶¶\n"
- "______________¶¶¶¶¶¶¶¶¶¶¶\n"
- "______________¶¶¶¶¶¶¶¶¶\n"
- "_____________¶¶¶¶¶¶¶¶¶\n"
- "____________¶¶¶¶¶¶¶¶¶\n"
- "___________¶¶¶¶¶___¶¶\n"
- "___________¶¶¶¶¶___¶¶\n"
- "___________¶¶¶¶¶___¶¶\n"
- "____________¶¶¶¶___¶¶\n"
- "____________¶¶¶¶___¶¶\n"
- "______________¶¶___¶¶¶¶¶¶\n"
- "______________¶¶___¶¶¶¶¶¶¶\n"
- "______________¶¶___¶¶_¶¶¶¶¶\n"
- "______________¶¶___¶¶___¶¶¶¶\n"
- "_______________¶¶_¶¶_____¶¶¶\n"
- "________________¶¶¶______¶¶¶\n"
- "_________________¶_______¶¶\n"
- " _ \n "
- "___ _ _ _ __ __ __ (_) __ __ ___ \n"
- "/ __| | | | | | '__| \\ \\ / / | | \\ \\ / / / _ \\ \n"
- "\\__ \\ | |_| | | | \\ V / | | \\ V / | __/ \n"
- "|___/ \\__,_| |_| \\_/ |_| \\_/ \\___| \n";
- system ("PAUSE");
- system ("cls");
- }
- int main() {
- titleScr();
- Hero myHero;
- myHero.createHero(myHero.name, myHero.str, myHero.dex, myHero.inte, myHero.gold, myHero.sword, myHero.knife, myHero.magic, myHero.health);
- system ("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement