Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Header*/
- #include <iostream>
- #include <winbgim.h>
- #include <cstdlib>
- #include <windows.h>
- #include <MMSystem.h>
- #include <string>
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- using namespace std;
- int coordinates[10][2];
- bool checkCoordinates(int mouseX, int mouseY, int coordinates[10][2] )
- {
- for(int i = 0; i<10; i++)
- {
- if((mouseX>coordinates[i][0])&&(mouseX<coordinates[i][0])&&(mouseY>coordinates[i][1])&&(mouseY<coordinates[i][1]))
- {
- coordinates[i][0] = -1;
- coordinates[i][1] = -1;
- //PlaySound(TEXT("Skorpion.wav"),NULL, SND_FILENAME);
- return true;
- }
- }
- return false;
- }
- int main()
- {
- int gdriver=9; int gmode=2;
- initgraph(&gdriver, &gmode, "");
- setbkcolor(BLACK);
- setcolor(WHITE);
- cleardevice();
- /*Menu screen*/
- int bro=0;
- int rad;
- settextstyle(SMALL_FONT,HORIZ_DIR,6);
- outtextxy(10,10, "Press ESC to exit");
- settextstyle(GOTHIC_FONT,HORIZ_DIR,10); setcolor(RED);
- outtextxy(55,100,"3USA"); setcolor(WHITE);
- settextstyle(SMALL_FONT,HORIZ_DIR,6);
- outtextxy(260,230,"Press ENTER to start");
- rad=getch();
- if(rad==27){getch(); closegraph(); return 0;}
- if(rad==13){
- cleardevice();
- outtextxy(260,230,"Choose difficulty");
- outtextxy(260,250,"EASY press E");
- outtextxy(260,270,"HARD press H");
- char dif;
- dif=getch();
- /*Easy mode*/
- if(dif=='e'||dif=='E'){
- cleardevice();
- for(int i=0;i<5;i++){
- if(i==1)
- {
- settextstyle(GOTHIC_FONT,HORIZ_DIR,10);
- setcolor(RED);
- outtextxy(200,100,"3");
- delay(400);
- //PlaySound(TEXT("beep-07"),NULL, SND_FILENAME);
- }
- if(i==2){
- cleardevice();
- settextstyle(GOTHIC_FONT,HORIZ_DIR,10);
- setcolor(RED);
- outtextxy(200,100,"2");
- delay(400);
- //PlaySound(TEXT("beep-07"),NULL, SND_FILENAME);
- }
- if(i==3)
- {
- cleardevice();
- settextstyle(GOTHIC_FONT,HORIZ_DIR,10);
- setcolor(RED);
- outtextxy(200,100,"1");
- delay(400);
- //PlaySound(TEXT("beep-07"),NULL, SND_FILENAME);
- }
- if(i==4)
- {
- cleardevice();
- settextstyle(GOTHIC_FONT,HORIZ_DIR,10);
- setcolor(RED);
- outtextxy(150,100,"GO");
- delay(400);
- //PlaySound(TEXT("beep-09"),NULL, SND_FILENAME);
- }
- }
- int counter = 0;
- bool moved = false;
- while(dif!=kbhit())
- {
- if(ismouseclick(WM_MOUSEMOVE))
- {
- line(mousex()-20, mousey(), mousex()+20, mousey());
- line(mousex(), mousey()-20, mousex(), mousey()+20);
- if(!moved)
- {
- moved = true;
- for (int i = 0; i <10; i++)
- {
- setfillstyle(SOLID_FILL, RED);
- setcolor(RED);
- srand (time(NULL));
- int randomX = 50 + (rand() % 490);
- int randomY = 50 + (rand() % 370);
- circle(randomX,randomY,50);
- floodfill(randomX,randomY,RED);
- coordinates[i][0] = randomX;
- coordinates[i][1] = randomY;
- }
- }
- clearmouseclick(WM_MOUSEMOVE);
- }
- if(ismouseclick(WM_LBUTTONDOWN))
- {
- if(checkCoordinates(mousex(), mousey(), coordinates))
- {
- bro=bro+1;
- counter++;
- }
- }
- if(counter == 9) break;
- }
- while(dif!=kbhit())
- {
- if(bro==1)break;
- if(ismouseclick(WM_MOUSEMOVE))
- {
- cleardevice();
- line(mousex()-20, mousey(), mousex()+20, mousey());
- line(mousex(), mousey()-20, mousex(), mousey()+20);
- }
- clearmouseclick(WM_MOUSEMOVE);
- }
- settextstyle(GOTHIC_FONT,HORIZ_DIR,8);
- outtextxy(55,100,"THE END");
- }
- /*Hard mode*/
- /*.....*/
- /*Footer*/
- getch();
- closegraph();
- return 0;
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement