Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <conio.h>
- #include <Windows.h>
- #include <string>
- using namespace std;
- void gotoxy(int x, int y)
- {
- COORD coord;
- coord.X = x;
- coord.Y = y;
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
- }
- void logo()
- {
- gotoxy(1, 1);
- std::cout << " " << std::endl;
- std::cout << " _|_| _|_|_| _| _| _|_| _| _| _|_| _|_|_| _|_|_| " << std::endl;
- std::cout << " _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| " << std::endl;
- std::cout << " _|_|_|_| _|_|_| _|_| _|_|_|_| _| _| _| _| _| _| _| _| " << std::endl;
- std::cout << " _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| " << std::endl;
- std::cout << " _| _| _| _| _| _| _| _| _| _| _|_| _|_|_| _|_|_| " << std::endl;
- std::cout << " " << std::endl;
- Sleep(2000);
- for (int i = 7; i > 0; i--)
- {
- gotoxy(1, i);
- cout << " " << endl;
- Sleep(50);
- }
- system("cls");
- }
- void pp(int aa)
- {
- gotoxy(75, 10); std::cout << "Punkty:" << aa;
- }
- void menu()
- {
- cout << " " << endl;
- cout << " ==========" << endl;
- cout << " ===MENU===" << endl;
- cout << " =ARKANOID=" << endl;
- cout << " ==========" << endl;
- cout << "1. Rozpocznij gre\n" << "2. Informacja o autorze" << endl << "3. Zamknij program" << endl;
- }
- void gra()
- {
- logo();
- int punkty = 0;
- int x = 3;
- int y = 3;
- int xp = 3; //x paletki
- int kxp = 1; //kierunek x paletki
- int kx = 1;
- int ky = 1;
- char aa;
- aa = 218; //z kodu asci
- gotoxy(1, 1); //lewy gorny naroznik
- cout << aa;
- aa = 192;
- gotoxy(1, 22); //prawy gorny naroznik
- cout << aa;
- aa = 217;
- gotoxy(70, 22); //prawy dolny naroznik
- cout << aa;
- aa = 191;
- gotoxy(70, 1); //lewy dolny naroznik
- cout << aa;
- aa = 196;
- //ramka 70x22
- for (int i = 2; i < 70; i++)
- {
- gotoxy(i, 1);
- cout << aa;
- }
- aa = 179;
- for (int i = 2; i < 22; i++)
- {
- gotoxy(1, i);
- cout << aa;
- }
- aa = 196;
- for (int i = 2; i < 70; i++)
- {
- gotoxy(i, 22);
- cout << aa;
- }
- aa = 179;
- for (int i = 2; i < 22; i++)
- {
- gotoxy(70, i);
- cout << aa;
- }
- char ee = 'q';
- while (ee == 'q')
- {
- gotoxy(x, y);
- cout << "o"; //piłeczka
- gotoxy(xp, 19); //kordy paletki
- aa = 196;
- cout << aa << aa << aa << aa << aa;
- Sleep(50);
- gotoxy(x, y);
- cout << " ";
- gotoxy(xp, 19);
- cout << " ";
- //odbicie
- if ((xp > 64) || (xp < 3))
- {
- kxp = -1 * kxp;
- }
- xp = xp + kxp;
- if ((x > 67) || (x < 3))
- {
- kx = -1 * kx;
- }
- x = x + kx;
- if ((y > 20) || (y < 3))
- {
- ky = -1 * ky;
- }
- y = y + ky;
- if ((y == 19) && (x >= xp) && (x <= xp + 4))
- {
- ky = -1 * ky;
- punkty = punkty + 1;
- }
- char ch1;
- while (_kbhit())
- {
- ch1 = _getch();
- if (ch1 == 'e')
- {
- ee = 'e';
- }
- if (ch1 == ' ')
- {
- kxp = -1 * kxp;
- }
- }
- pp(punkty);
- }
- getchar();
- getchar(); system("Pause");
- }
- int main()
- {
- int wybor;
- while (1)
- {
- system("cls");
- menu();
- cin >> wybor;
- switch (wybor)
- {
- case 1:
- gra();
- case 2:
- cout << "Patryk Sokolowski" << endl;
- cout << "Politechnika Bialostocka" << endl;
- cout << "kierunek: mechatronika";
- break;
- case 3:
- exit(0);
- default: cout << "Nie ma takiej opcji w menu!";
- }
- getchar(); getchar();
- system("cls");
- }
- logo();
- int punkty = 0;
- int x = 3;
- int y = 3;
- int xp = 3; //x paletki
- int kxp = 1; //kierunek x paletki
- int kx = 1;
- int ky = 1;
- char aa;
- aa = 218; //z kodu asci
- gotoxy(1, 1); //lewy gorny naroznik
- cout << aa;
- aa = 192;
- gotoxy(1, 22); //prawy gorny naroznik
- cout << aa;
- aa = 217;
- gotoxy(70, 22); //prawy dolny naroznik
- cout << aa;
- aa = 191;
- gotoxy(70, 1); //lewy dolny naroznik
- cout << aa;
- aa = 196;
- //ramka 70x22
- for (int i = 2; i < 70; i++)
- {
- gotoxy(i, 1);
- cout << aa;
- }
- aa = 179;
- for (int i = 2; i < 22; i++)
- {
- gotoxy(1, i);
- cout << aa;
- }
- aa = 196;
- for (int i = 2; i < 70; i++)
- {
- gotoxy(i, 22);
- cout << aa;
- }
- aa = 179;
- for (int i = 2; i < 22; i++)
- {
- gotoxy(70, i);
- cout << aa;
- }
- char ee = 'q';
- while (ee == 'q')
- {
- gotoxy(x, y);
- cout << "o"; //piłeczka
- gotoxy(xp, 19); //kordy paletki
- aa = 196;
- cout << aa << aa << aa << aa << aa;
- Sleep(50);
- gotoxy(x, y);
- cout << " ";
- gotoxy(xp, 19);
- cout << " ";
- //odbicie
- if ((xp > 64) || (xp < 3))
- {
- kxp = -1 * kxp;
- }
- xp = xp + kxp;
- if ((x > 67) || (x < 3))
- {
- kx = -1 * kx;
- }
- x = x + kx;
- if ((y > 20) || (y < 3))
- {
- ky = -1 * ky;
- }
- y = y + ky;
- if ((y == 19) && (x >= xp) && (x <= xp + 4))
- {
- ky = -1 * ky;
- punkty = punkty + 1;
- }
- char ch1;
- while (_kbhit())
- {
- ch1 = _getch();
- if (ch1 == 'e')
- {
- ee = 'e';
- }
- if (ch1 == ' ')
- {
- kxp = -1 * kxp;
- }
- }
- pp(punkty);
- }
- getchar();
- getchar(); system("Pause");
- return 0;
- }
- //animacja do loga
- //zrobic menu
- //zrobic punkty
- //ZRobic logo z ascii ART (google)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement