This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int startGame(Player *p_player, World **p_p_worldArr) | |
{ | |
system("cls"); //tu moga sie pojawic pierwsze klopoty na niektorych IDE. | |
std::cout << "Witam w qube txt" << std::endl; | |
std::cout << "\nzaraz wejdziesz do losowego boxu " << std::endl; | |
std::cout << "twoim zadaniem bedzie wydostanie sie na zewnatrz" << std::endl; | |
std::cout << "w tym celu uzyj klawiszy WSAD :" << std::endl; | |
std::cout << "\n W - polnoc\n E - poludnie\n A - zachod\n D - wschod" << std::endl; | |
std::cout << "lub klawiszami strzałek" << std::endl; | |
std::cout << "spokojnie - nie musisz tego zapamietac - bedzie to podawane podczas gry :)" << std::endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void World::set_infoCell(int data2, std::string data1) //ustawiamy wartości domyślne zmiennych | |
{ | |
infoCell = data1; //początek opisu lokacji | |
infoCell += ' '; //wstawienie spacji po pierwszym czlonie opisu | |
if (data2 > 0) //jeśli numer jest większy od zera | |
{ | |
infoCell += "numer: "; //dopisujemy informacje o numerowaniu | |
infoCell += std::to_string(data2); //dopisanie do nazwy otrzymanego numeru pokoju (bardzo wygodna konwersja int na string) | |
} | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int gameLoop(Player * p_player, World ** p_p_worldArr) | |
{ | |
std::cout << "Tu bedziemy grali!!" << std::endl; | |
_getch(); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
....... | |
HWND console = GetConsoleWindow(); //zmiana wielkosci okna konsoli copy-paste - wazne, ze dziala, nie wazne jak ;) (windows.h lib);) | |
RECT r; | |
GetWindowRect(console, &r); | |
MoveWindow(console, r.left, r.top, 900, 600, TRUE); // tu ustawiamy wysokosc i szerokosc okna konsoli ... koniec copy-paste. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void lockArea(Player* p_player, World** p_p_worldArr) | |
{ | |
int p = 1; //numerator pokojow do opisu | |
const int xM = p_player->get_sizeX(); //wyciagamy z obiektu rozmiar gry, mozemy zastosowac odwolanie do metody w kodzie za kazdym razem, | |
const int yM = p_player->get_sizeY(); //ale tak bedzie to bardziej przejrzyste | |
for (int i = 0; i < xM; i++) | |
for (int j = 0; j < yM; j++) | |
{ | |
p_p_worldArr[i][j].set_infoCell(p); //wprowadzamy przy okazji mumer pokoju (reszte roboty robi metoda set_infoCell() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void hardMode(Player *p_player, World** p_p_worldArr) | |
//zamykamy jedno losowe przejscie w kazdym pokoju, z wylaczeniem pokojow zewnetrznych | |
//taki sposob losowania i ustawiania parametrow, pozwala na to, ze sporo drzwi bedzie nie do przejscia tylko w jedna strone. | |
{ | |
for (int i = 1; i < (p_player->get_sizeX() - 1); i++) | |
for (int j = 1; j < (p_player->get_sizeY() - 1); j++) | |
{ | |
int tmp = (rand() % 4); //wartosc tymczasowa, wykorzystywana w nastepnej linijce do okreslenia ktore drzwi zamknac | |
p_p_worldArr[i][j].set_exitCell(tmp, false); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
move = (key == 'w' || key == 'W') ? 1 | |
: (key == 's' || key == 'S') ? 2 | |
: (key == 'a' || key == 'A') ? 3 | |
: (key == 'd' || key == 'D') ? 4 | |
: (key == 'q' || key == 'Q') ? 0 | |
: 9; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (key == 'w' || key == 'W') move = 1; | |
else if (key == 's' || key == 'S') move = 2; | |
else if (key == 'a' || key == 'A') move = 3; | |
else if (key == 'd' || key == 'D') move = 4; | |
else if (key == 'q' || key == 'Q') move = 0; | |
else move = 9; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string name = "adela"; | |
int number = 22; | |
std::string endData = name; | |
endData += ' '; | |
endData += std::to_string(number); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string name = "adela"; | |
int number = 22; | |
std::string endData; | |
std::stringstream temp; | |
temp << name; | |
temp << ' '; | |
temp << number; |
OlderNewer