Guest User

Untitled

a guest
Jan 24th, 2011
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 11.95 KB | None | 0 0
  1. void map2(){
  2.          while(end == false){
  3.          system("cls");
  4.          for (int y = 0; y < 10; y++){
  5.               cout << map2[y] << endl;
  6.          }
  7.      
  8.          for (int y = 0; y < 10; y++){
  9.              for (int x = 0; x < 15; x++){
  10.                  switch(map2[y][x]){
  11.                                    case '@':
  12.                                          if(GetAsyncKeyState(VK_UP) != 0){
  13.                                                  int y2 = (y - 1);
  14.                                                  int y3 = (y - 2);
  15.                                                  switch(map2[y2][x]){
  16.                                                          case ' ':
  17.                                                               map2[y][x] = ' ';
  18.                                                               y -= 1;
  19.                                                               map2[y2][x] = '@';
  20.                                                               break;
  21.                                                          case 'I':
  22.                                                               map2[y][x] = ' ';
  23.                                                               y -= 1;
  24.                                                               map2[y2][x] = '@';
  25.                                                               if(map2[y3][x] == '#'){
  26.                                                                     int y0 = (y + 1);
  27.                                                                     map2[y0][x] = '@';
  28.                                                                     map2[y2][x] = 'I';
  29.                                                               }else{
  30.                                                                     map2[y3][x] = 'I';
  31.                                                               }
  32.                                                               break;
  33.                                                          case '$':
  34.                                                               int scoreNum = 0;
  35.                                                               if(map2[y2][x] == '$'){
  36.                                                                    
  37.                                                                     scoreNum++;
  38.                                                                     levelMoney02 -= 1;
  39.                                                                     map2[y][x] = ' ';
  40.                                                                     y -= 1;
  41.                                                                     map2[y2][x] = '@';
  42.                                                                     cout << "You got a point!";
  43.                                                                     _sleep (500);
  44.                                                              
  45.                                                               }
  46.                                                               cout << scoreNum;
  47.                                                               break;
  48.                                                  
  49.                                                  };
  50.                                          }
  51.                                          
  52.                                          if(GetAsyncKeyState(VK_DOWN) != 0){
  53.                                                  int y2 = (y + 1);
  54.                                                  int y3 = (y + 2);
  55.                                                  switch(map2[y2][x]){
  56.                                                          case ' ':
  57.                                                               map2[y][x] = ' ';
  58.                                                               y += 1;
  59.                                                               map2[y2][x] = '@';
  60.                                                               break;
  61.                                                          case 'I':
  62.                                                               map2[y][x] = ' ';
  63.                                                               y += 1;
  64.                                                               map2[y2][x] = '@';
  65.                                                               if(map[y3][x] == '#'){
  66.                                                                     int y0 = (y - 1);
  67.                                                                     map2[y0][x] = '@';
  68.                                                                     map2[y2][x] = 'I';
  69.                                                               }else{
  70.                                                                     map2[y3][x] = 'I';
  71.                                                               }
  72.                                                               break;
  73.                                                          case '$':
  74.                                                               int scoreNum = 0;
  75.                                                               if(map2[y2][x] == '$'){
  76.                                                                    
  77.                                                                     scoreNum++;
  78.                                                                     levelMoney02 -= 1;
  79.                                                                     map2[y][x] = ' ';
  80.                                                                     y += 1;
  81.                                                                     map2[y2][x] = '@';
  82.                                                                     cout << "You got a point!";
  83.                                                                     _sleep (500);
  84.                                                              
  85.                                                               }
  86.                                                               cout << scoreNum;
  87.                                                               break;
  88.                                                  };
  89.                                          }
  90.                                          
  91.                                          if(GetAsyncKeyState(VK_LEFT) != 0){
  92.                                                  int x2 = (x - 1);
  93.                                                  int x3 = (x - 2);
  94.                                                  switch(map2[y][x2]){
  95.                                                          case ' ':
  96.                                                               map2[y][x] = ' ';
  97.                                                               x -= 1;
  98.                                                               map2[y][x2] = '@';
  99.                                                               break;
  100.                                                          case 'I':
  101.                                                               map2[y][x] = ' ';
  102.                                                               x -= 1;
  103.                                                               map2[y][x2] = '@';
  104.                                                               if(map2[y][x3] == '#'){
  105.                                                                     int x0 = (x + 1);
  106.                                                                     map2[y][x0] = '@';
  107.                                                                     map2[y][x2] = 'I';
  108.                                                               }else{
  109.                                                                     map2[y][x3] = 'I';
  110.                                                               }
  111.                                                               break;
  112.                                                          case '$':
  113.                                                               int scoreNum = 0;
  114.                                                               if(map2[y][x2] == '$'){
  115.                                                                    
  116.                                                                     scoreNum++;
  117.                                                                     levelMoney02 -= 1;
  118.                                                                     map2[y][x] = ' ';
  119.                                                                     x -= 1;
  120.                                                                     map2[y][x2] = '@';
  121.                                                                     cout << "You got a point!";
  122.                                                                     _sleep (500);
  123.                                                              
  124.                                                               }
  125.                                                               cout << scoreNum;
  126.                                                               break;
  127.                                                  };
  128.                                          }
  129.                                          
  130.                                          if(GetAsyncKeyState(VK_RIGHT) != 0){
  131.                                                  int x2 = (x + 1);
  132.                                                  int x3 = (x + 2);
  133.                                                  switch(map2[y][x2]){
  134.                                                          case ' ':
  135.                                                               map2[y][x] = ' ';
  136.                                                               x += 1;
  137.                                                               map2[y][x2] = '@';
  138.                                                               break;
  139.                                                          case 'I':
  140.                                                               map2[y][x] = ' ';
  141.                                                               x += 1;
  142.                                                               map2[y][x2] = '@';
  143.                                                               if(map2[y][x3] == '#'){
  144.                                                                     int x0 = (x - 1);
  145.                                                                     map2[y][x0] = '@';
  146.                                                                     map2[y][x2] = 'I';
  147.                                                               }else{
  148.                                                                     map2[y][x3] = 'I';
  149.                                                               }
  150.                                                               break;
  151.                                                          case '$':
  152.                                                               int scoreNum = 0;
  153.                                                               if(map2[y][x2] == '$'){
  154.                                                                    
  155.                                                                     scoreNum++;
  156.                                                                     levelMoney02 -= 1;
  157.                                                                     map2[y][x] = ' ';
  158.                                                                     y += 1;
  159.                                                                     map2[y][x2] = '@';
  160.                                                                     cout << "You got a point!";
  161.                                                                     _sleep (500);
  162.                                                              
  163.                                                               }
  164.                                                               cout << scoreNum;
  165.                                                               break;
  166.                                                  };
  167.                                          }
  168.                                         break;
  169.                                        
  170.                  };
  171.              }
  172.          }
  173.          _sleep (GameSpeed);
  174.      }
  175. }
Advertisement
Add Comment
Please, Sign In to add comment