Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.12 KB | None | 0 0
  1. /*Header*/
  2.  
  3. #include <iostream>
  4. #include <winbgim.h>
  5. #include <cstdlib>
  6. #include <windows.h>
  7. #include <MMSystem.h>
  8. #include <string>
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <time.h>
  12. using namespace std;
  13. int main()
  14. {
  15.     int gdriver=9; int gmode=2;
  16.     initgraph(&gdriver, &gmode, "");
  17.     setbkcolor(BLACK);
  18.     setcolor(WHITE);
  19.     cleardevice();
  20.  
  21.     /*Menu screen*/
  22.     int bro=0;
  23.             int rad;
  24.             settextstyle(SMALL_FONT,HORIZ_DIR,6);
  25.             outtextxy(10,10, "Press ESC to exit");
  26.             settextstyle(GOTHIC_FONT,HORIZ_DIR,10); setcolor(RED);
  27.             outtextxy(55,100,"3USA"); setcolor(WHITE);
  28.             settextstyle(SMALL_FONT,HORIZ_DIR,6);
  29.             outtextxy(260,230,"Press ENTER to start");
  30.  
  31.             rad=getch();
  32.  
  33.             if(rad==27){getch(); closegraph(); return 0;}
  34.             if(rad==13){
  35.                 cleardevice();
  36.     outtextxy(260,230,"Choose difficulty");
  37.     outtextxy(260,250,"EASY    press E");
  38.     outtextxy(260,270,"HARD    press H");
  39.  
  40.     char dif;
  41.     dif=getch();
  42.  
  43.     /*Easy mode*/
  44.  
  45.     if(dif=='e'||dif=='E'){
  46.         cleardevice();
  47.  
  48.         for(int i=0;i<5;i++){
  49.             if(i==1)
  50.             {
  51.                 settextstyle(GOTHIC_FONT,HORIZ_DIR,10);
  52.                 setcolor(RED);
  53.                 outtextxy(200,100,"3");
  54.                 delay(400);
  55.                 PlaySound(TEXT("beep-07"),NULL, SND_FILENAME);
  56.             }
  57.             if(i==2){
  58.                 cleardevice();
  59.                 settextstyle(GOTHIC_FONT,HORIZ_DIR,10);
  60.                 setcolor(RED);
  61.                 outtextxy(200,100,"2");
  62.                 delay(400);
  63.                 PlaySound(TEXT("beep-07"),NULL, SND_FILENAME);
  64.             }
  65.             if(i==3)
  66.             {
  67.                 cleardevice();
  68.                 settextstyle(GOTHIC_FONT,HORIZ_DIR,10);
  69.                 setcolor(RED);
  70.                 outtextxy(200,100,"1");
  71.                 delay(400);
  72.                 PlaySound(TEXT("beep-07"),NULL, SND_FILENAME);
  73.             }
  74.             if(i==4)
  75.             {
  76.                 cleardevice();
  77.                 settextstyle(GOTHIC_FONT,HORIZ_DIR,10);
  78.                 setcolor(RED);
  79.                 outtextxy(150,100,"GO");
  80.                 delay(400);
  81.                 PlaySound(TEXT("beep-09"),NULL, SND_FILENAME);
  82.             }
  83.  
  84.     }
  85.     int counter = 0;
  86.     int coordinates[10][2];
  87.    
  88.    
  89.    
  90.    while(dif!=kbhit())
  91.     {
  92.        
  93.         if(ismouseclick(WM_MOUSEMOVE))
  94.         {
  95.             cleardevice();
  96.             line(mousex()-20, mousey(), mousex()+20, mousey());
  97.             line(mousex(), mousey()-20, mousex(), mousey()+20);
  98.             for (int i = 0; i <10; i++)
  99.             {
  100.                 setfillstyle(SOLID_FILL, RED);
  101.                 setcolor(RED);
  102.                 srand (time(NULL));
  103.                 int randomX = 50 + (rand() % 490);
  104.                 int randomY = 50 + (rand() % 370);
  105.                 circle(randomX,randomY,50);
  106.                 floodfill(randomX,randomY,RED);
  107.                 coordinates[i][0] = randomX;
  108.                 coordinates[i][1] = randomY;
  109.             }
  110.         }
  111.         clearmouseclick(WM_MOUSEMOVE);
  112.        
  113.         for(int i=0; i<10; i++)
  114.         {
  115.             if((mousex()>coordinates[i][0])&&(mousex()<coordinates[i][0])&&(mousey()>coordinates[i][1])&&(mousey()<coordinates[i][1])&&ismouseclick(WM_LBUTTONDOWN))
  116.             {
  117.                 coordinates[i][0] = -1;
  118.                 coordinates[i][1] = -1;
  119.                 bro=bro+1;
  120.                 PlaySound(TEXT("Skorpion.wav"),NULL, SND_FILENAME);
  121.                 cleardevice();
  122.                 counter++;
  123.             }
  124.         }
  125.        
  126.         if(counter == 9) break;
  127.     }
  128.  
  129.     while(dif!=kbhit())
  130.     {
  131.         if(bro==1)break;
  132.         if(ismouseclick(WM_MOUSEMOVE))
  133.         {
  134.             cleardevice();
  135.             line(mousex()-20, mousey(), mousex()+20, mousey());
  136.             line(mousex(), mousey()-20, mousex(), mousey()+20);
  137.         }
  138.         clearmouseclick(WM_MOUSEMOVE);
  139.     }
  140.  
  141.  
  142.     settextstyle(GOTHIC_FONT,HORIZ_DIR,8);
  143.     outtextxy(55,100,"THE END");
  144. }
  145.  
  146. /*Hard mode*/
  147. /*.....*/
  148.  
  149.     /*Footer*/
  150.     getch();
  151.     closegraph();
  152.     return 0;
  153.  
  154. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement