Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <windows.h>
- #include <string>
- const int h = 20;
- const int w = 20;
- char town[w][h] ={{'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','H','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','S','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','#','#','#','#','#','.','.','.','.','.','.','.','#'},
- {'#','T','.','.','.','.','.','#','~','~','~','#','.','.','.','.','.','Z','.','#'},
- {'#','T','.','.','.','.','.','#','~','~','~','#','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','#','#','#','#','#','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','K','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','G','.','.','G','.','.','.','.','.','.','.','.','#'},
- {'#','#','#','#','#','#','#','#','D','D','#','#','#','#','#','#','#','#','#','#'}};
- char pub[w][h]= {{'#','#','#','#','#','#','#','#','#','D','D','#','#','#','#','#','#','#','#','#'},
- {'#','.','.','.','#','.','.','.','.','.','.','.','.','#','.','.','.','.','.','#'},
- {'#','.','.','.','#','.','.','.','.','.','.','.','.','#','.','.','.','.','.','#'},
- {'#','.','.','.','#','.','.','.','B','.','.','.','.','#','.','.','.','.','.','#'},
- {'#','.','.','.','#','#','#','#','#','#','#','#','#','#','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'},
- {'#','#','#','#','#','#','#','#','#','G','G','#','#','#','#','#','#','#','#','#'}};
- char button;
- int time = 3000;
- int playerArea = 1;
- struct Creation
- {
- int age;
- int strength;
- int agility;
- int inteligent;
- std::string kingdom;
- std::string name;
- int x = 8;
- int y = 18;
- };
- Creation player;
- void character()
- {
- std::cout << "Welcome in ToroTomo!" << std::endl;
- Sleep(time);
- system("cls");
- std::cout << "I think you have arrived here on.." << std::endl;
- Sleep(time);
- system("cls");
- std::cout << "GLADIATOR TOURNAMENT!!" << std::endl;
- Sleep(time);
- system("cls");
- std::cout << "Alright, what is your name?" << std::endl;
- std::cin >> player.name;
- system("cls");
- std::cout << "My name is " << player.name << std::endl;
- Sleep(time);
- system("cls");
- std::cout << "Your age?" <<std::endl;
- std::cin >> player.age;
- Sleep(time);
- system("cls");
- std::cout << "So " << player.name << " from which kingdom you are?" << std::endl;
- std::cout << std::endl;
- std::cin >> player.kingdom;
- system("cls");
- std::cout << "I'm from " << player.kingdom << std::endl;
- Sleep(time);
- system("cls");
- std::cout << "Now take this list and fill it" << std::endl;
- Sleep(time);
- system("cls");
- int points = 13;
- int str = 0;
- int inte = 0;
- int agil = 0;
- do
- {
- std::cout << "You have "<< points << " points to expand" << std::endl;
- std::cout << "Press 1 - 3 to add points" << std::endl;
- std::cout << "**********************************************" << std::endl;
- std::cout << "1.Strength = " << player.strength << std::endl;
- std::cout << "2.Intelligent = " << player.inteligent << std::endl;
- std::cout << "3.Agility = " << player.agility << std::endl;
- std::cout << "5.Age = " << player.age << std::endl;
- std::cout << "6.Name = " << player.name << std::endl;
- std::cout << "7.Kingdom = " << player.kingdom << std::endl;
- button = getch();
- switch(button)
- {
- case '1':
- {
- system("cls");
- std::cout << "How strong you are?" << std::endl;
- std::cout << "Remember you have only " << points << " points" << std::endl;
- std::cin >> str;
- if(str > points)
- {
- std::cout << "Only "<< points << " points!!" << std::endl;
- break;
- } else if(str <= points )
- {
- player.strength = str;
- points -= str;
- }
- break;
- }
- case '2':
- {
- system("cls");
- std::cout << "How strong your brain is?" <<std::endl;
- std::cout << "Remember you have only " << points << " points" << std::endl;
- std::cin >> inte;
- if(inte > points)
- {
- std::cout << "Only " << points << " points!!" << std::endl;
- break;
- } else if(inte <= points )
- {
- player.inteligent = inte;
- points -= inte;
- }
- break;
- }
- case '3':
- {
- system("cls");
- std::cout << "How fast your legs move?" <<std::endl;
- std::cout << "Remember you have only " << points << " points" << std::endl;
- std::cin >> agil;
- if(inte > agil)
- {
- std::cout << "Only " << points << " points!!" << std::endl;
- break;
- } else if(agil <= points )
- {
- player.agility = agil;
- points -= agil;
- }
- break;
- }
- default:
- {
- break;
- }
- }
- system("cls");
- }while(points > 0);
- std::cout << "Open gates!" << std::endl;
- Sleep(time);
- system("cls");
- std::cout << "Next!" << std::endl;
- Sleep(time);
- system("cls");
- }
- void world(char (&city)[w][h])
- {
- for(int iH = 0; iH < h; iH++)
- {
- for(int iW = 0; iW < w; iW++)
- {
- if(iW == player.y && iH == player.x)
- {
- std::cout << "@";
- }
- else
- {
- std::cout << city[iW][iH];
- }
- }
- std::cout << std::endl;
- }
- }
- void render()
- {
- if(playerArea == 1)
- {
- world(town);
- }
- if(playerArea == 2)
- {
- world(pub);
- }
- }
- void choice(int cor)
- {
- system("cls");
- if(cor == 'D')
- {
- std::cout << "*CLOSED GATE*" << std::endl;
- Sleep(time);
- }
- if(cor == 'G')
- {
- std::cout << "What are you trying to do!?" << std::endl;
- Sleep(1000);
- system("cls");
- std::cout << "FUS!" << std::endl;
- Sleep(500);
- std::cout << "RO!" << std::endl;
- Sleep(500);
- std::cout << "DAH!" << std::endl;
- Sleep(500);
- }
- if(cor == '~')
- {
- std::cout << "Just another boring game without swimming!";
- Sleep(time);
- }
- if(cor == 'T')
- {
- std::cout << "*OLD DOORS*" << std::endl;
- std::cout << "You want to open them?" << std::endl;
- std::cout << "Y/N?" << std::endl;
- button = getch();
- switch(button)
- {
- case 'y':
- {
- playerArea = 2;
- player.x = 8;
- player.y = 18;
- break;
- }
- case 'n':
- {
- break;
- }
- default:
- {
- break;
- }
- }
- }
- if(cor == 'K')
- {
- std::cout << "6\n";
- }
- if(cor == 'Z')
- {
- std::cout << "7\n";
- }
- if(cor == 'S')
- {
- std::cout << "8\n";
- }
- if(cor == 'H')
- {
- std::cout << "9\n";
- }
- if(cor == 10)
- {
- std::cout << "You want to leave pub?" << std::endl;
- std::cout << "Y/N?" << std::endl;
- button = getch();
- switch(button)
- {
- case 'y':
- {
- playerArea = 1;
- break;
- }
- case 'n':
- {
- break;
- }
- default:
- {
- break;
- }
- }
- }
- if(cor == 11)
- {
- std::cout << "*" << player.name << " :" << std::endl;
- std::cout << "Have you free rooms?" << std::endl;
- Sleep(time);
- system("cls");
- std::cout << "*Stranger:" << std::endl;
- std::cout << "Yes I have, 10 golden coins, 1 room for 5 nights" << std::endl;
- Sleep(time);
- system("cls");
- std::cout << "One room" << std::endl;
- std::cout << "*-10 golden coins" << std::endl;
- Sleep(time);
- system("cls");
- }
- }
- void run()
- {
- char cor;
- button = getch();
- switch(button)
- {
- case 'w':
- {
- if(town[player.y][player.x - 1] == '#')
- {
- break;
- }
- if(town[player.y][player.x - 1] != '#')
- {
- cor = town[player.y][player.x - 1];
- choice(cor);
- }
- player.x --;
- break;
- }
- case 's':
- {
- if(town[player.y][player.x + 1] == '#')
- {
- break;
- }
- if(town[player.y][player.x + 1] != '#')
- {
- cor = town[player.y][player.x + 1];
- choice(cor);
- }
- player.x ++;
- break;
- }
- case 'a':
- {
- if(town[player.y - 1][player.x] == '#')
- {
- break;
- }
- if(town[player.y - 1][player.x] != '#')
- {
- cor = town[player.y - 1][player.x];
- choice(cor);
- }
- player.y --;
- break;
- }
- case 'd':
- {
- if(town[player.y + 1][player.x] == '#')
- {
- break;
- }
- if(town[player.y + 1][player.x] != '#')
- {
- cor = town[player.y + 1][player.x];
- choice(cor);
- }
- player.y ++;
- break;
- }
- }
- }
- int main()
- {
- bool Game = true;
- while(Game == true)
- {
- //character();
- render();
- run();
- system("cls");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement