Advertisement
tusaveeiei

Untitled

Nov 9th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.94 KB | None | 0 0
  1.      case Event::MouseButtonPressed:
  2.                 if(Event.mouseButton.button == Mouse::Left)
  3.                 {
  4.                     if(!htp1 or !htp2)
  5.                     {
  6.  
  7.                         // ng
  8.                         if(mPosition.x >= ngPos.x and mPosition.x <= ngPos.x + 680)
  9.                         {
  10.                             if(mPosition.y >= ngPos.y and mPosition.y <= ngPos.y+84)
  11.                             {
  12.                                 startGame = true;
  13.                                 cout << "New game" << endl;
  14.                             }
  15.                         }
  16.  
  17.                         // htp
  18.                         if(mPosition.x >= htpPos.x and mPosition.x <= htpPos.x + 837 )
  19.                         {
  20.                             if(mPosition.y >= htpPos.y and mPosition.y <= htpPos.y + 84)
  21.                             {
  22.                                 cout << "How to play" << endl;
  23.                                 htp1 = true;
  24.                             }
  25.                         }
  26.  
  27.                         //exit
  28.                         if(mPosition.x >= exitPos.x and mPosition.x <= exitPos.x + 324 )
  29.                         {
  30.                             if(mPosition.y >= exitPos.y and mPosition.y <= exitPos.y + 81 )
  31.                             {
  32.                                 cout << "EXIT ja" << endl;
  33.                                 Window.close();
  34.                             }
  35.                         }
  36.  
  37.                         // right arrow
  38.                         if(mPosition.x >= 1487 and mPosition.x <= 1789
  39.                                 and mPosition.y >= 756 and mPosition.y <= 900)
  40.                         {
  41.                             if(htp1)
  42.                             {
  43.                                 htp1 = false;
  44.                                 htp2 = true;
  45.                             }
  46.  
  47.                             else if(htp2)
  48.                             {
  49.                                 htp2 = false;
  50.                                 startGame = true;
  51.                                 cout << "START GAME!!" << endl;
  52.                             }
  53.                         }
  54.  
  55.                         // left arrow
  56.                         if(mPosition.x >= 244 and mPosition.x <= 547
  57.                                 and mPosition.y >= 756 and mPosition.y <= 900)
  58.                         {
  59.                             if(htp1)
  60.                                 htp1 = false;
  61.                             else if(htp2)
  62.                             {
  63.                                 htp2 = false;
  64.                                 htp1 = true;
  65.                             }
  66.  
  67.                         }
  68.  
  69.                         cout << mPosition.x << " " << mPosition.y << endl;
  70.                     }
  71.                 }
  72.                 break;
  73.             case Event::MouseMoved:
  74.                 if(mPosition.x >= ngPos.x and mPosition.x <= ngPos.x + 680 and
  75.                         mPosition.y >= ngPos.y and mPosition.y <= ngPos.y+84)
  76.                 {
  77.                     newgame.setPosition(ngPos.x, ngPos.y - speed);
  78.                 }
  79.                 else newgame.setPosition(ngPos.x, ngPos.y);
  80.                 if(mPosition.x >= htpPos.x and mPosition.x <= htpPos.x + 837 and
  81.                         mPosition.y >= htpPos.y and mPosition.y <= htpPos.y + 84)
  82.                 {
  83.                     htp.setPosition(htpPos.x, htpPos.y - speed);
  84.                 }
  85.  
  86.                 else htp.setPosition(htpPos.x,htpPos.y);
  87.                 if(mPosition.x >= exitPos.x and mPosition.x <= exitPos.x + 324 and
  88.                         mPosition.y >= exitPos.y and mPosition.y <= exitPos.y + 81 )
  89.                 {
  90.                     exit.setPosition(exitPos.x, exitPos.y - speed);
  91.                 }
  92.                 else exit.setPosition(exitPos.x, exitPos.y);
  93.  
  94.                 //  cout << mPosition.x << " " << mPosition.y << endl;
  95.                 break;
  96.             }
  97.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement