Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- using namespace std;
- void PlaceCursor(const int x, const int y) {
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- COORD PlaceCursorHere;
- PlaceCursorHere.X = x;
- PlaceCursorHere.Y = y;
- SetConsoleCursorPosition(hConsole, PlaceCursorHere);
- return;
- }
- void ClearConsole() {
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- COORD coordScreen = { 0, 0 };
- DWORD cCharsWritten;
- CONSOLE_SCREEN_BUFFER_INFO csbi;
- DWORD dwConSize;
- if (!GetConsoleScreenBufferInfo(hConsole, &csbi)) { return; }
- dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
- if (!FillConsoleOutputCharacter(hConsole, (TCHAR) ' ', dwConSize, coordScreen, &cCharsWritten)) { return; }
- if (!GetConsoleScreenBufferInfo(hConsole, &csbi)) { return; }
- if (!FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten)) { return; }
- return;
- }
- void Map();
- void Creatures();
- int main(){
- Map();
- Creatures();
- return 0;
- }
- void Map()
- {
- ClearConsole();
- PlaceCursor(0, 0);
- cout << (" # # # # \n");
- cout << (" ###### # # ########### \n");
- cout << (" # # # # \n");
- cout << (" # ###### ########### # \n");
- cout << (" # # # # \n");
- cout << (" # # # # \n");
- cout << (" # # # # \n");
- cout << (" # # # # \n");
- cout << (" # # # # \n");
- cout << (" # # ############### # # \n");
- cout << (" # # # # # # \n");
- cout << (" # ##### ####### # # # \n");
- cout << (" # # # # # # \n");
- cout << (" ############# # # # # \n");
- cout << (" # # # # \n");
- cout << (" # # # # \n");
- cout << (" ################### # # # \n");
- cout << (" # # # # \n");
- cout << (" # ################### # # \n");
- cout << (" # # # # \n");
- cout << (" # # # # \n");
- cout << (" # # # # \n");
- cout << (" # ######################### # \n");
- cout << (" # # \n");
- cout << (" ################################# \n");
- }
- void Creatures()
- {
- int x = 23, y=0;
- for( ; y!=2 ; y++)
- {
- PlaceCursor(x, y);
- cout << ("O\b");
- Sleep( 500 );
- cout << (" \b");
- }
- for( ; x!=18 ; x-- )
- {
- PlaceCursor(x, y);
- cout << ("O\b");
- Sleep( 500 );
- cout << (" \b");
- }
- for( ; y!=12 ; y++) {
- PlaceCursor(x, y);
- cout << ("O\b");
- Sleep( 500 );
- cout << (" \b");
- }
- for( ; x!=26 ; x++) {
- PlaceCursor(x, y);
- cout << ("O\b");
- Sleep( 500 );
- cout << (" \b");
- }
- for( ; y!=10 ; y--) {
- PlaceCursor(x, y);
- cout << ("O\b");
- Sleep( 500 );
- cout << (" \b");
- }
- for( ; x!=36 ; x++) {
- PlaceCursor(x, y);
- cout << ("O\b");
- Sleep( 500 );
- cout << (" \b");
- }
- for( ; y!=17 ; y++) {
- PlaceCursor(x, y);
- cout << ("O\b");
- Sleep( 500 );
- cout << (" \b");
- }
- for( ; x!=18 ; x--) {
- PlaceCursor(x, y);
- cout << ("O\b");
- Sleep( 500 );
- cout << (" \b");
- }
- for( ; y!=23 ; y++) {
- PlaceCursor(x, y);
- cout << ("O\b");
- Sleep( 500 );
- cout << (" \b");
- }
- for( ; x!=46 ; x++) {
- PlaceCursor(x, y);
- cout << ("O\b");
- Sleep( 500 );
- cout << (" \b");
- }
- for( ; y!=2 ; y--) {
- PlaceCursor(x, y);
- cout << ("O\b");
- Sleep( 500 );
- cout << (" \b");
- }
- for( ; x!=36 ; x--) {
- PlaceCursor(x, y);
- cout << ("O\b");
- Sleep( 500 );
- cout << (" \b");
- }
- for( ; y!=-1 ; y--) {
- PlaceCursor(x, y);
- cout << ("O\b");
- Sleep( 500 );
- cout << (" \b");
- }
- }
Add Comment
Please, Sign In to add comment