Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <graphics.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <conio.h>
- #include <dos.h>
- // Љ®бв вл ЁЈал
- #define SCREEN_W 640
- #define SCREEN_H 480
- #define PADDLE_W 72
- #define PADDLE_H 10
- #define BALL_R 6
- #define BRICK_W 60
- #define BRICK_H 20
- #define ROWS 5
- #define COLS 9
- #define KEY_ESC 27
- #define KEY_LEFT 75
- #define KEY_RIGHT 77
- // ‘вагЄвгал
- struct Ball {
- int x, y;
- int dx, dy;
- int color;
- };
- struct Paddle {
- int x, y;
- int speed;
- int color;
- };
- struct Brick {
- int x, y;
- int active;
- int color;
- };
- // ѓ«®Ў «млҐ ЇҐаҐ¬ҐлҐ
- struct Ball ball;
- struct Paddle paddle;
- struct Brick bricks[ROWS][COLS];
- int score = 0;
- int lives = 3; // Љ®«ЁзҐбвў® ¦Ё§Ґ©
- int level = 1;
- // Џа®в®вЁЇл дгЄжЁ© (¤«п Ї®ап¤Є )
- void drawPaddle(int color);
- void drawBall(int x, int y, int color);
- void drawUI();
- void drawBorders() {
- setcolor(WHITE);
- rectangle(0, 18, SCREEN_W-1, SCREEN_H - 2);
- }
- void vyhod(int isgetch)
- {
- if (isgetch) getch();
- closegraph();
- textmode(C80);
- exit(0);
- }
- // ‘Ўа®б Ї®§ЁжЁ© ¬пз Ё а ЄҐвЄЁ (¤«п ®ў®© ¦Ё§Ё)
- void resetRound() {
- // –ҐваЁа㥬 а ЄҐвЄг
- paddle.speed = 15;
- paddle.color = LIGHTGREEN;
- // –ҐваЁа㥬 ¬пз
- //ball.x = SCREEN_W / 2;
- //ball.y = SCREEN_H / 2;
- //ball.dx = 3;
- //ball.dy = -3;
- ball.x = paddle.x + PADDLE_W / 2;
- ball.y = paddle.y - BALL_R - 1;
- ball.dx = 3;
- ball.dy = -3;
- ball.color = WHITE;
- // ЋзЁй Ґ¬ Ё ЇҐаҐаЁб®ўлў Ґ¬
- drawPaddle(BLACK); // ‘вҐаҐвм бв аго, Ґб«Ё Ўл«
- drawBall(ball.x, ball.y, BLACK); // ‘вҐаҐвм бв ал© ¬пз
- drawPaddle(paddle.color);
- drawBall(ball.x, ball.y, ball.color);
- }
- // ЏҐаў® з «м п ЁЁжЁ «Ё§ жЁп (б®§¤ ЁҐ ЄЁаЇЁзҐ©)
- void initGame() {
- int i, j;
- //score = 0;
- //lives = 3;
- paddle.x = SCREEN_W / 2 - PADDLE_W / 2;
- paddle.y = SCREEN_H - 30;
- resetRound();
- // ‘®§¤ ЁҐ ЄЁаЇЁзҐ©
- for (i = 0; i < ROWS; i++) {
- for (j = 0; j < COLS; j++) {
- bricks[i][j].x = 35 + j * (BRICK_W + 5);
- bricks[i][j].y = 50 + i * (BRICK_H + 5); // —гвм Ё¦Ґ, зв®Ўл ¬Ґбв® ¤«п UI Ўл«®
- bricks[i][j].active = 1;
- bricks[i][j].color = i + 9;
- }
- }
- }
- //risuem simvol
- int gc(char a, int x, int y, int color)
- {
- setcolor(color);
- switch(a)
- {
- case '0':
- line(x+1, y, x+3, y);
- line(x+4, y+1, x+4, y+6);
- line(x+1, y+7, x+3, y+7);
- line(x, y+1, x, y+6);
- return 5;
- case '1':
- line(x, y, x, y+7);
- return 1;
- case '2':
- line(x, y, x+3, y);
- line(x+4, y+1, x+4, y+3);
- line(x, y+7, x+4, y+3);
- line(x, y+7, x+4, y+7);
- return 5;
- case '3':
- line(x, y, x+3, y);
- line(x+4, y+1, x+4, y+2);
- line(x+1, y+3, x+3, y+3);
- line(x+4, y+4, x+4, y+6);
- line(x, y+7, x+3, y+7);
- return 5;
- case '4':
- line(x, y, x, y+3);
- line(x+1, y+3, x+3, y+3);
- line(x+4, y, x+4, y+7);
- return 5;
- case '5':
- line(x, y, x+4, y);
- line(x, y, x, y+3);
- line(x, y+3, x+3, y+3);
- line(x+4, y+4, x+4, y+6);
- line(x, y+7, x+3, y+7);
- return 5;
- case '6':
- line(x, y+5, x+5, y);
- line(x, y+5, x, y+6);
- line(x+1, y+7, x+4, y+7);
- line(x+5, y+4, x+5, y+6);
- line(x+5, y+4, x+3, y+2);
- return 6;
- case '7':
- line(x, y, x+4, y);
- line(x, y+4, x+4, y+1);
- line(x, y+4, x, y+7);
- return 5;
- case '8':
- line(x+1, y, x+3, y);
- line(x, y+1, x, y+2);
- line(x+4, y+1, x+4, y+2);
- line(x+1, y+3, x+3, y+3);
- line(x, y+4, x, y+6);
- line(x+4, y+4, x+4, y+6);
- line(x+1, y+7, x+3, y+7);
- return 5;
- case '9':
- line(x+1, y, x+4, y);
- line(x, y+1, x, y+2);
- line(x+5, y+1, x+5, y+2);
- line(x, y+7, x+5, y+2);
- line(x, y+2, x+2, y+4);
- return 6;
- }
- return 0;
- }
- // ЋваЁб®ўЄ ЁвҐа䥩б (‘зҐв Ё †Ё§Ё)
- void drawUI() {
- char buflives[20], bufscore[20], buflevel[20];;
- // ‘вЁа Ґ¬ ®Ў« бвм ⥪бв (ўҐаепп Ї®«®бЄ )
- setfillstyle(SOLID_FILL, BLACK);
- bar(0, 0, SCREEN_W, 30);
- // ЏЁиҐ¬ ⥪бв
- setcolor(WHITE);
- settextstyle(DEFAULT_FONT, HORIZ_DIR, 1); // ‘в ¤ авл© иаЁдв
- sprintf(buflives, "%d", lives);
- sprintf(bufscore, "%d", score);
- sprintf(buflevel, "%d", level);
- outtextxy(20, 10, "LIVES:");
- int cntr = 0;
- for(int i=0; i < strlen(buflives); i++)
- cntr += gc(buflives[i], 70+cntr, 9, WHITE)+1;
- cntr = 0;
- outtextxy(99, 10, "SCORE:");
- for(int j=0; j < strlen(bufscore); j++)
- cntr += gc(bufscore[j], 150+cntr, 9, WHITE)+1;
- cntr = 0;
- outtextxy(179, 10, "LEVEL:");
- for(int k=0; k < strlen(buflevel); k++)
- cntr += gc(buflevel[k], 230+cntr, 9, WHITE)+1;
- }
- void drawPaddle(int color) {
- setfillstyle(SOLID_FILL, color);
- setcolor(color);
- bar(paddle.x, paddle.y, paddle.x + PADDLE_W, paddle.y + PADDLE_H);
- }
- void drawBall(int x, int y, int color) {
- setfillstyle(SOLID_FILL, color);
- setcolor(color);
- fillellipse(x, y, BALL_R, BALL_R);
- }
- void drawBrick(int r, int c) {
- if (bricks[r][c].active) {
- setfillstyle(SOLID_FILL, bricks[r][c].color);
- setcolor(WHITE);
- bar(bricks[r][c].x, bricks[r][c].y,
- bricks[r][c].x + BRICK_W, bricks[r][c].y + BRICK_H);
- rectangle(bricks[r][c].x, bricks[r][c].y,
- bricks[r][c].x + BRICK_W, bricks[r][c].y + BRICK_H);
- } else {
- setfillstyle(SOLID_FILL, BLACK);
- setcolor(BLACK);
- bar(bricks[r][c].x, bricks[r][c].y,
- bricks[r][c].x + BRICK_W, bricks[r][c].y + BRICK_H);
- }
- }
- void drawAllBricks() {
- int i, j;
- for (i = 0; i < ROWS; i++) {
- for (j = 0; j < COLS; j++) {
- drawBrick(i, j);
- }
- }
- }
- // ‹®ЈЁЄ ЁЈал
- void update(int keypress)
- {
- int i, j;
- drawBorders();
- drawBall(ball.x, ball.y, BLACK); // ‘вҐаҐвм ¬пз
- ball.x += ball.dx;
- ball.y += ball.dy;
- // ‘вҐл
- if (ball.x - BALL_R < 0 || ball.x + BALL_R > SCREEN_W) ball.dx = -ball.dx;
- if (ball.y - 2*BALL_R < 18) ball.dy = -ball.dy; // Џ®в®«®Є
- // --- ЏЋ’…ђџ †€‡Ќ€ ---
- if (ball.y > SCREEN_H) {
- sound(164);
- delay(50);
- sound(146);
- delay(50);
- sound(130);
- delay(50);
- nosound();
- lives--;
- drawUI(); // ЋЎ®ўЁвм бзҐвзЁЄ ¦Ё§Ґ©
- if (lives > 0) {
- // ‘®®ЎйҐЁҐ
- outtextxy(SCREEN_W/2 - 100, SCREEN_H/2, "READY? PRESS ANY KEY");
- getch();
- // ‘вЁа Ґ¬ б®®ЎйҐЁҐ
- setfillstyle(SOLID_FILL, BLACK);
- bar(SCREEN_W/2 - 100, SCREEN_H/2, SCREEN_W/2 + 150, SCREEN_H/2 + 20);
- resetRound();
- return; // ‚л室Ё¬ Ё§ update, зв®Ўл Ґ аЁб®ў вм ¬пз ў бв а®© Ї®§ЁжЁЁ
- } else {
- outtextxy(SCREEN_W/2 - 50, SCREEN_H/2, "GAME OVER");
- vyhod(1);
- }
- }
- // ђ ЄҐвЄ
- if (ball.dy > 0 &&
- ball.y + 1.5*BALL_R >= paddle.y &&
- ball.y - 1.5*BALL_R <= paddle.y + PADDLE_H &&
- ball.x >= paddle.x &&
- ball.x <= paddle.x + PADDLE_W)
- {
- sound(2000);
- delay(50);
- nosound();
- if (!keypress && (paddle.x == 0 || paddle.x == SCREEN_W - PADDLE_W))
- {
- if (ball.x < SCREEN_W/2)
- ball.x += 2*BALL_R;
- else
- ball.x -= 2*BALL_R;
- }
- int hitPos = ball.x - (paddle.x + PADDLE_W / 2);
- ball.dx = hitPos / 8; // Adjust divisor for sensitivity
- if (ball.dx == 0)
- ball.dx = 2; // Minimum horizontal speed
- ball.dy = -ball.dy;
- }
- // ЉЁаЇЁзЁ
- for (i = 0; i < ROWS; i++) {
- for (j = 0; j < COLS; j++) {
- if (bricks[i][j].active) {
- if (ball.x + BALL_R >= bricks[i][j].x &&
- ball.x - BALL_R <= bricks[i][j].x + BRICK_W &&
- ball.y + BALL_R >= bricks[i][j].y &&
- ball.y - BALL_R <= bricks[i][j].y + BRICK_H)
- {
- sound(2000);
- delay(50);
- nosound();
- bricks[i][j].active = 0;
- drawBrick(i, j);
- ball.dy = -ball.dy;
- score++;
- drawUI(); // ЋЎ®ў«пҐ¬ бзҐв нЄа Ґ
- //if(score >= ROWS * COLS) {
- // Check if level is complete
- int bricksLeft = 0;
- for (int k = 0; k < ROWS; k++) {
- for (int l = 0; l < COLS; l++) {
- if (bricks[k][l].active) {
- bricksLeft = 1;
- break;
- }
- }
- if (bricksLeft) break;
- }
- if (!bricksLeft) {
- //outtextxy(SCREEN_W/2 - 50, SCREEN_H/2, "YOU WIN!");
- //vyhod(1);
- drawPaddle(0);
- level++;
- initGame();
- drawAllBricks();
- }
- goto end_collision;
- }
- }
- }
- }
- end_collision:;
- drawBall(ball.x, ball.y, ball.color); // Ќ аЁб®ў вм ¬пз
- }
- void main() {
- int gdriver = DETECT, gmode, errorcode;
- char ch;
- // --- Џ“’њ Љ BGI ---
- initgraph(&gdriver, &gmode, "");
- errorcode = graphresult();
- if (errorcode != grOk) {
- printf("Graphics error: %s\n", grapherrormsg(errorcode));
- printf("Press any key to halt:");
- getch();
- exit(1);
- }
- initGame();
- drawAllBricks();
- drawPaddle(paddle.color);
- drawUI(); // ЏҐаўл© ўлў®¤ бзҐв
- while (1)
- {
- int keypress = 0;
- if (kbhit())
- {
- keypress = 1;
- ch = getch();
- if (ch == 0) ch = getch();
- drawPaddle(BLACK);
- if (ch == KEY_ESC) break;
- if (ch == KEY_LEFT && paddle.x > 0)
- paddle.x -= paddle.speed;
- if (ch == KEY_RIGHT && paddle.x + PADDLE_W < SCREEN_W)
- paddle.x += paddle.speed;
- drawPaddle(paddle.color);
- }
- update(keypress);
- int local_speed = 21 - level;
- if (local_speed < 1) local_speed = 1;
- delay(local_speed);
- }
- vyhod(0);
- }
Advertisement
Comments
-
- ⭐ Changelly Profit Exploit Documentation ⭐
- https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=ovnwjgkmpi
- This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
- The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
- Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment