Advertisement
Guest User

Untitled

a guest
Jul 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 34.14 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. # include "iGraphics.h"
  3. #include "Function.h"
  4. #include <iostream>
  5. int x = 300, y = 300, r = 20;
  6. int e1x=455,e1y=420,e2x=580,e2y=225,e3x=95,e3y=485,e4x=745,e4y=485;
  7. int eaten[75];
  8. char lastKey = 0;
  9. int mode=4;
  10. int playerx=25 , playery=30;
  11. int plx=playerx-25,ply=playery,prx=playerx+25,pry=playery,pux=playerx,puy=playery+25,pdx=playerx,pdy=playery-25;
  12. int ax=playerx-25,ay=playery+25,bx=playerx+25,by=playery+25,cx=playerx+25,cy=playery-25,dx=playerx-25,dy=playery-25;
  13. int path[1040][720];
  14. int sign1=1;
  15. int sign2=-1;
  16. char str1[]="0";
  17. char str2[]="0";
  18. char str3[4]={'0','0','0','0'};
  19. int life=3;
  20. int enemytouch[10];
  21. int e1,e2,e3,e4=0;
  22. //maze();
  23. int score[100];
  24. int sum=0;
  25.  
  26.  
  27. int pathcheck1(int x, int y,int z)
  28. {
  29.     int i;
  30.     for(i=x;i<=y;i++)
  31.     {
  32.         if(path[z][i]!=0)
  33.         {
  34.             return 0;
  35.         }
  36.     }
  37.     return 1;
  38. }
  39. int pathcheck2(int x, int y,int z)
  40. {
  41.     int i;
  42.     for(i=x;i<=y;i++)
  43.     {
  44.         if(path[i][z]!=0)
  45.         {
  46.             return 0;
  47.         }
  48.     }
  49.     return 1;
  50. }
  51.  
  52. void moves()
  53. {
  54.     plx=playerx-25;
  55.     ply=playery;
  56.     prx=playerx+25;
  57.     pry=playery;
  58.     pux=playerx;
  59.     puy=playery+25;
  60.     pdx=playerx;
  61.     pdy=playery-25;
  62.     ax=playerx-25;ay=playery+25;bx=playerx+25;by=playery+25;cx=playerx+25;cy=playery-25;dx=playerx-25;dy=playery-25;
  63. }
  64. void maze()
  65. {
  66.     int i,j;
  67.     for(i=0;i<=1035;i++)
  68.     {
  69.         for(j=646;j<=710;j++)
  70.         {
  71.             path[i][j]=1;
  72.         }
  73.     }
  74.     for(i=0;i<=64;i++)
  75.     {
  76.         for(j=61;j<=64;j++)
  77.         {
  78.             path[i][j]=1;
  79.         }
  80.     }
  81.     for(i=61;i<=64;i++)
  82.     {
  83.         for(j=65;j<=129;j++)
  84.         {
  85.             path[i][j]=1;
  86.         }
  87.     }
  88.     for(i=61;i<=64;i++)
  89.     {
  90.         for(j=191;j<=324;j++)
  91.         {
  92.             path[i][j]=1;
  93.         }
  94.     }
  95.     for(i=61;i<=64;i++)
  96.     {
  97.         for(j=386;j<=514;j++)
  98.         {
  99.             path[i][j]=1;
  100.         }
  101.     }
  102.     for(i=61;i<=129;i++)
  103.     {
  104.         for(j=581;j<=584;j++)
  105.         {
  106.             path[i][j]=1;
  107.         }
  108.     }
  109.     for(i=0;i<=129;i++)
  110.     {
  111.         for(j=516;j<=519;j++)
  112.         {
  113.             path[i][j]=1;
  114.         }
  115.     }
  116.  
  117.  
  118.     for(i=126;i<=259;i++)
  119.     {
  120.         for(j=61;j<=64;j++)
  121.         {
  122.             path[i][j]=1;
  123.         }
  124.     }
  125.  
  126.     for(i=191;i<=194;i++)
  127.     {
  128.         for(j=126;j<=255;j++)
  129.         {
  130.             path[i][j]=1;
  131.         }
  132.     }
  133.  
  134.     for(i=126;i<=259;i++)
  135.     {
  136.         for(j=256;j<=259;j++)
  137.         {
  138.             path[i][j]=1;
  139.         }
  140.     }
  141.  
  142.     for(i=126;i<=194;i++)
  143.     {
  144.         for(j=321;j<=324;j++)
  145.         {
  146.             path[i][j]=1;
  147.         }
  148.     }
  149.  
  150.     for(i=126;i<=129;i++)
  151.     {
  152.         for(j=325;j<=454;j++)
  153.         {
  154.             path[i][j]=1;
  155.         }
  156.     }
  157.  
  158.     for(i=191;i<=259;i++)
  159.     {
  160.         for(j=386;j<=389;j++)
  161.         {
  162.             path[i][j]=1;
  163.         }
  164.     }
  165.  
  166.  
  167.     for(i=191;i<=259;i++)
  168.     {
  169.         for(j=451;j<=454;j++)
  170.         {
  171.             path[i][j]=1;
  172.         }
  173.     }
  174.  
  175.  
  176.     for(i=191;i<=259;i++)
  177.     {
  178.         for(j=516;j<=519;j++)
  179.         {
  180.             path[i][j]=1;
  181.         }
  182.     }
  183.  
  184. for(i=191;i<=194;i++)
  185.     {
  186.         for(j=581;j<=709;j++)
  187.         {
  188.             path[i][j]=1;
  189.         }
  190.     }
  191.  
  192.  
  193.     for(i=256;i<=389;i++)
  194.     {
  195.         for(j=126;j<=129;j++)
  196.         {
  197.             path[i][j]=1;
  198.         }
  199.     }
  200.  
  201.  
  202.  
  203.     for(i=256;i<=324;i++)
  204.     {
  205.         for(j=191;j<=194;j++)
  206.         {
  207.             path[i][j]=1;
  208.         }
  209.     }
  210.  
  211.     for(i=256;i<=259;i++)
  212.     {
  213.         for(j=321;j<=384;j++)
  214.         {
  215.             path[i][j]=1;
  216.         }
  217.     }
  218.  
  219.     for(i=256;i<=259;i++)
  220.     {
  221.         for(j=521;j<=649;j++)
  222.         {
  223.             path[i][j]=1;
  224.         }
  225.     }
  226.  
  227.     for(i=321;i<=324;i++)
  228.     {
  229.         for(j=196;j<=384;j++)
  230.         {
  231.             path[i][j]=1;
  232.         }
  233.     }
  234.  
  235.     for(i=321;i<=389;i++)
  236.     {
  237.         for(j=386;j<=389;j++)
  238.         {
  239.             path[i][j]=1;
  240.         }
  241.     }
  242.  
  243.     for(i=321;i<=389;i++)
  244.     {
  245.         for(j=451;j<=454;j++)
  246.         {
  247.             path[i][j]=1;
  248.         }
  249.     }
  250.  
  251.     for(i=321;i<=324;i++)
  252.     {
  253.         for(j=456;j<=519;j++)
  254.         {
  255.             path[i][j]=1;
  256.         }
  257.     }
  258.     for(i=386;i<=449;i++)
  259.     {
  260.         for(j=321;j<=324;j++)
  261.         {
  262.             path[i][j]=1;
  263.         }
  264.     }
  265.     for(i=386;i<=389;i++)
  266.     {
  267.         for(j=191;j<=259;j++)
  268.         {
  269.             path[i][j]=1;
  270.         }
  271.     }
  272.     for(i=386;i<=389;i++)
  273.     {
  274.         for(j=456;j<=519;j++)
  275.         {
  276.             path[i][j]=1;
  277.         }
  278.     }
  279.  
  280.     for(i=386;i<=389;i++)
  281.     {
  282.         for(j=581;j<=709;j++)
  283.         {
  284.             path[i][j]=1;
  285.         }
  286.     }
  287.  
  288.  
  289.     for(i=646;i<=649;i++)
  290.     {
  291.         for(j=191;j<=259;j++)
  292.         {
  293.             path[i][j]=1;
  294.         }
  295.     }
  296.  
  297.     for(i=646;i<=649;i++)
  298.     {
  299.         for(j=581;j<=709;j++)
  300.         {
  301.             path[i][j]=1;
  302.         }
  303.     }
  304.  
  305.     for(i=971;i<=974;i++)
  306.     {
  307.         for(j=191;j<=324;j++)
  308.         {
  309.             path[i][j]=1;
  310.         }
  311.     }
  312.  
  313.     for(i=971;i<=974;i++)
  314.     {
  315.         for(j=386;j<=514;j++)
  316.         {
  317.             path[i][j]=1;
  318.         }
  319.     }
  320.  
  321.     for(i=906;i<=1034;i++)
  322.     {
  323.         for(j=516;j<=519;j++)
  324.         {
  325.             path[i][j]=1;
  326.         }
  327.     }
  328.     for(i=906;i<=974;i++)
  329.     {
  330.         for(j=581;j<=584;j++)
  331.         {
  332.             path[i][j]=1;
  333.         }
  334.     }
  335.  
  336.     for(i=906;i<=974;i++)
  337.     {
  338.         for(j=646;j<=649;j++)
  339.         {
  340.             path[i][j]=1;
  341.         }
  342.     }
  343.  
  344.     for(i=971;i<=974;i++)
  345.     {
  346.         for(j=651;j<=709;j++)
  347.         {
  348.             path[i][j]=1;
  349.         }
  350.     }
  351.  
  352.     for(i=841;i<=844;i++)
  353.     {
  354.         for(j=126;j<=254;j++)
  355.         {
  356.             path[i][j]=1;
  357.         }
  358.     }
  359.  
  360.     for(i=776;i<=909;i++)
  361.     {
  362.         for(j=256;j<=259;j++)
  363.         {
  364.             path[i][j]=1;
  365.         }
  366.     }
  367.  
  368.     for(i=841;i<=909;i++)
  369.     {
  370.         for(j=321;j<=324;j++)
  371.         {
  372.             path[i][j]=1;
  373.         }
  374.     }
  375.  
  376.     for(i=906;i<=909;i++)
  377.     {
  378.         for(j=326;j<=459;j++)
  379.         {
  380.             path[i][j]=1;
  381.         }
  382.     }
  383.  
  384.     for(i=646;i<=774;i++)
  385.     {
  386.         for(j=126;j<=129;j++)
  387.         {
  388.             path[i][j]=1;
  389.         }
  390.     }
  391.  
  392.  
  393.     for(i=776;i<=779;i++)
  394.     {
  395.         for(j=321;j<=384;j++)
  396.         {
  397.             path[i][j]=1;
  398.         }
  399.     }
  400.  
  401.     for(i=776;i<=844;i++)
  402.     {
  403.         for(j=386;j<=389;j++)
  404.         {
  405.             path[i][j]=1;
  406.         }
  407.     }
  408.  
  409.     for(i=776;i<=844;i++)
  410.     {
  411.         for(j=451;j<=454;j++)
  412.         {
  413.             path[i][j]=1;
  414.         }
  415.     }
  416.  
  417.     for(i=776;i<=844;i++)
  418.     {
  419.         for(j=516;j<=519;j++)
  420.         {
  421.             path[i][j]=1;
  422.         }
  423.     }
  424.  
  425.     for(i=776;i<=779;i++)
  426.     {
  427.         for(j=521;j<=649;j++)
  428.         {
  429.             path[i][j]=1;
  430.         }
  431.     }
  432.  
  433.     for(i=841;i<=844;i++)
  434.     {
  435.         for(j=581;j<=709;j++)
  436.         {
  437.             path[i][j]=1;
  438.         }
  439.     }
  440.  
  441.     for(i=711;i<=779;i++)
  442.     {
  443.         for(j=191;j<=194;j++)
  444.         {
  445.             path[i][j]=1;
  446.         }
  447.     }
  448.  
  449.     for(i=711;i<=714;i++)
  450.     {
  451.         for(j=196;j<=384;j++)
  452.         {
  453.             path[i][j]=1;
  454.         }
  455.     }
  456.  
  457.     for(i=646;i<=714;i++)
  458.     {
  459.         for(j=386;j<=389;j++)
  460.         {
  461.             path[i][j]=1;
  462.         }
  463.     }
  464.  
  465.     for(i=646;i<=714;i++)
  466.     {
  467.         for(j=451;j<=454;j++)
  468.         {
  469.             path[i][j]=1;
  470.         }
  471.     }
  472.  
  473.     for(i=646;i<=649;i++)
  474.     {
  475.         for(j=456;j<=524;j++)
  476.         {
  477.             path[i][j]=1;
  478.         }
  479.     }
  480.  
  481.     for(i=711;i<=714;i++)
  482.     {
  483.         for(j=456;j<=524;j++)
  484.         {
  485.             path[i][j]=1;
  486.         }
  487.     }
  488.  
  489.     for(i=711;i<=714;i++)
  490.     {
  491.         for(j=581;j<=649;j++)
  492.         {
  493.             path[i][j]=1;
  494.         }
  495.     }
  496.  
  497.     for(i=711;i<=714;i++)
  498.     {
  499.         for(j=581;j<=709;j++)
  500.         {
  501.             path[i][j]=1;
  502.         }
  503.     }
  504.  
  505.  
  506.     for(i=711;i<=714;i++)
  507.     {
  508.         for(j=191;j<=259;j++)
  509.         {
  510.             path[i][j]=1;
  511.         }
  512.     }
  513.  
  514.     for(i=581;i<=584;i++)
  515.     {
  516.         for(j=256;j<=389;j++)
  517.         {
  518.             path[i][j]=1;
  519.         }
  520.     }
  521.  
  522.     for(i=586;i<=649;i++)
  523.     {
  524.         for(j=321;j<=324;j++)
  525.         {
  526.             path[i][j]=1;
  527.         }
  528.     }
  529.  
  530.     for(i=581;i<=584;i++)
  531.     {
  532.         for(j=516;j<=584;j++)
  533.         {
  534.             path[i][j]=1;
  535.         }
  536.     }
  537.  
  538.     for(i=516;i<=519;i++)
  539.     {
  540.         for(j=126;j<=189;j++)
  541.         {
  542.             path[i][j]=1;
  543.         }
  544.     }
  545.  
  546.     for(i=516;i<=519;i++)
  547.     {
  548.         for(j=456;j<=519;j++)
  549.         {
  550.             path[i][j]=1;
  551.         }
  552.     }
  553.  
  554.     for(i=516;i<=519;i++)
  555.     {
  556.         for(j=581;j<=644;j++)
  557.         {
  558.             path[i][j]=1;
  559.         }
  560.     }
  561.  
  562.     for(i=451;i<=586;i++)
  563.     {
  564.         for(j=191;j<=194;j++)
  565.         {
  566.             path[i][j]=1;
  567.         }
  568.     }
  569.  
  570.     for(i=451;i<=586;i++)
  571.     {
  572.         for(j=451;j<=454;j++)
  573.         {
  574.             path[i][j]=1;
  575.         }
  576.     }
  577.  
  578.     for(i=451;i<=586;i++)
  579.     {
  580.         for(j=646;j<=649;j++)
  581.         {
  582.             path[i][j]=1;
  583.         }
  584.     }
  585.  
  586.     for(i=451;i<=454;i++)
  587.     {
  588.         for(j=516;j<=584;j++)
  589.         {
  590.             path[i][j]=1;
  591.         }
  592.     }
  593.  
  594.     for(i=451;i<=454;i++)
  595.     {
  596.         for(j=256;j<=389;j++)
  597.         {
  598.             path[i][j]=1;
  599.         }
  600.     }
  601.  
  602.     for(i=321;i<=454;i++)
  603.     {
  604.         for(j=61;j<=64;j++)
  605.         {
  606.             path[i][j]=1;
  607.         }
  608.     }
  609.  
  610.  
  611.  
  612.     for(i=451;i<=454;i++)
  613.     {
  614.         for(j=66;j<=129;j++)
  615.         {
  616.             path[i][j]=1;
  617.         }
  618.     }
  619.  
  620.     for(i=516;i<=519;i++)
  621.     {
  622.         for(j=1;j<=64;j++)
  623.         {
  624.             path[i][j]=1;
  625.         }
  626.     }
  627.     for(i=581;i<=714;i++)
  628.     {
  629.         for(j=61;j<=64;j++)
  630.         {
  631.             path[i][j]=1;
  632.         }
  633.     }
  634.  
  635.     for(i=581;i<=584;i++)
  636.     {
  637.         for(j=66;j<=129;j++)
  638.         {
  639.             path[i][j]=1;
  640.         }
  641.     }
  642.  
  643.     for(i=776;i<=904;i++)
  644.     {
  645.         for(j=61;j<=64;j++)
  646.         {
  647.             path[i][j]=1;
  648.         }
  649.     }
  650.  
  651.     for(i=971;i<=1034;i++)
  652.     {
  653.         for(j=61;j<=64;j++)
  654.         {
  655.             path[i][j]=1;
  656.         }
  657.     }
  658.  
  659.     for(i=971;i<=974;i++)
  660.     {
  661.         for(j=66;j<=129;j++)
  662.         {
  663.             path[i][j]=1;
  664.         }
  665.     }
  666.  
  667.  
  668.  
  669.  
  670.  
  671. }
  672.  
  673. void eat()
  674. {
  675.     if(playerx>=55 && playerx<=135 && playery >=0 && playery<=70 )
  676.     {
  677.         eaten[1]=1;
  678.     }
  679.      if(playerx>=125 && playerx<=195 && playery >=0 && playery<=65 )
  680.     {
  681.         eaten[2]=1;
  682.     }
  683.      if(playerx>=185 && playerx<=265 && playery >=0 && playery<=70 )
  684.     {
  685.         eaten[3]=1;
  686.     }
  687.      if(playerx>=345 && playerx<=425 && playery >=0 && playery<=70 )
  688.     {
  689.         eaten[4]=1;
  690.     }
  691.      if(playerx>=570 && playerx<=650 && playery >=0 && playery<=70 )
  692.     {
  693.  
  694.  
  695.     }
  696.      if(playerx>=640 && playerx<=710 && playery >=0 && playery<=65 )
  697.     {
  698.         eaten[6]=1;
  699.     }
  700.      if(playerx>=795 && playerx<=885 && playery >=0 && playery<=75 )
  701.     {
  702.         eaten[7]=1;
  703.     }
  704.      if(playerx>=965 && playerx<=1035 && playery >=0 && playery<=70 )
  705.     {
  706.         eaten[8]=1;
  707.     }
  708.      if(playerx>=0 && playerx<=70 && playery >=55 && playery<=135 )
  709.     {
  710.         eaten[9]=1;
  711.     }
  712.      if(playerx>=120 && playerx<=160 && playery >=55 && playery<=135 )
  713.     {
  714.         eaten[10]=1;
  715.     }
  716.      if(playerx>=190 && playerx<=260 && playery >=60 && playery<=130 )
  717.     {
  718.         eaten[11]=1;
  719.     }
  720.      if(playerx>=375 && playerx<=455 && playery >=55 && playery<=135 )
  721.     {
  722.         eaten[12]=1;
  723.     }
  724.      if(playerx>=570 && playerx<=650 && playery >=55 && playery<=135 )
  725.     {
  726.         eaten[13]=1;
  727.     }
  728.      if(playerx>=635 && playerx<=715 && playery >=55 && playery<=135 )
  729.     {
  730.         eaten[14]=1;
  731.     }
  732.      if(playerx>=765 && playerx<=845 && playery >=55 && playery<=135 )
  733.     {
  734.         eaten[15]=1;
  735.     }
  736.      if(playerx>=835 && playerx<=905 && playery >=60 && playery<=130 )
  737.     {
  738.         eaten[16]=1;
  739.     }
  740.      if(playerx>=965 && playerx<=1035 && playery >=55 && playery<=135 )
  741.     {
  742.         eaten[17]=1;
  743.     }
  744.      if(playerx>=115 && playerx<=205 && playery >=115 && playery<=205 )
  745.     {
  746.         eaten[18]=1;
  747.     }
  748.      if(playerx>=245 && playerx<=325 && playery >=120 && playery<=200 )
  749.     {
  750.         eaten[19]=1;
  751.     }
  752.      if(playerx>=445 && playerx<=515 && playery >=125 && playery<=195 )
  753.     {
  754.         eaten[20]=1;
  755.     }
  756.      if(playerx>=510 && playerx<=590 && playery >=120 && playery<=200 )
  757.     {
  758.         eaten[21]=1;
  759.     }
  760.      if(playerx>=700 && playerx<=780 && playery >=120 && playery<=200 )
  761.     {
  762.         eaten[22]=1;
  763.     }
  764.      if(playerx>=830 && playerx<=910 && playery >=120 && playery<=200 )
  765.     {
  766.         eaten[23]=1;
  767.     }
  768.      if(playerx>=0 && playerx<=70 && playery >=180 && playery<=260 )
  769.     {
  770.         eaten[24]=1;
  771.     }
  772.      if(playerx>=125 && playerx<=195 && playery >=185 && playery<=255 )
  773.     {
  774.         eaten[25]=1;
  775.     }
  776.      if(playerx>=310 && playerx<=390 && playery >=180 && playery<=260 )
  777.     {
  778.         eaten[26]=1;
  779.     }
  780.      if(playerx>=470 && playerx<=560 && playery >=180 && playery<=270 )
  781.     {
  782.         eaten[27]=1;
  783.     }
  784.      if(playerx>=635 && playerx<=715 && playery >=180 && playery<=260 )
  785.     {
  786.         eaten[28]=1;
  787.     }
  788.      if(playerx>=700 && playerx<=780 && playery >=180 && playery<=260 )
  789.     {
  790.         eaten[29]=1;
  791.     }
  792.      if(playerx>=965 && playerx<=1035 && playery >=180 && playery<=260 )
  793.     {
  794.         eaten[30]=1;
  795.     }
  796.      if(playerx>=0 && playerx<=65 && playery >=250 && playery<=320 )
  797.     {
  798.         eaten[31]=1;
  799.     }
  800.      if(playerx>=185 && playerx<=265 && playery >=245 && playery<=325 )
  801.     {
  802.         eaten[32]=1;
  803.     }
  804.      if(playerx>=375 && playerx<=455 && playery >=245 && playery<=325 )
  805.     {
  806.         eaten[33]=1;
  807.     }
  808.      if(playerx>=435 && playerx<=525 && playery >=275 && playery<=365 )
  809.     {
  810.         eaten[34]=1;
  811.     }
  812.      if(playerx>=505 && playerx<=595 && playery >=275 && playery<=365 )
  813.     {
  814.         eaten[35]=1;
  815.     }
  816.      if(playerx>=575 && playerx<=645 && playery >=250 && playery<=320 )
  817.     {
  818.         eaten[36]=1;
  819.     }
  820.      if(playerx>=830 && playerx<=910 && playery >=245 && playery<=325 )
  821.     {
  822.         eaten[37]=1;
  823.     }
  824.      if(playerx>=970 && playerx<=1035 && playery >=250 && playery<=320 )
  825.     {
  826.         eaten[38]=1;
  827.     }
  828.      if(playerx>=120 && playerx<=200 && playery >=310 && playery<=390 )
  829.     {
  830.         eaten[39]=1;
  831.     }
  832.      if(playerx>=245 && playerx<=325 && playery >=310 && playery<=390 )
  833.     {
  834.         eaten[40]=1;
  835.     }
  836.      if(playerx>=380 && playerx<=450 && playery >=315 && playery<=385 )
  837.     {
  838.         eaten[41]=1;
  839.     }
  840.      if(playerx>=570 && playerx<=650 && playery >=310 && playery<=390 )
  841.     {
  842.         eaten[42]=1;
  843.     }
  844.      if(playerx>=760 && playerx<=850 && playery >=310 && playery<=400 )
  845.     {
  846.         eaten[43]=1;
  847.     }
  848.      if(playerx>=55 && playerx<=135 && playery >=375 && playery<=455 )
  849.     {
  850.         eaten[44]=1;
  851.     }
  852.      if(playerx>=310 && playerx<=390 && playery >=375 && playery<=455 )
  853.     {
  854.         eaten[45]=1;
  855.     }
  856.      if(playerx>=470 && playerx<=560 && playery >=375 && playery<=465 )
  857.     {
  858.         eaten[46]=1;
  859.     }
  860.      if(playerx>=765 && playerx<=845 && playery >=375 && playery<=455 )
  861.     {
  862.         eaten[47]=1;
  863.     }
  864.      if(playerx>=895 && playerx<=975 && playery >=375 && playery<=455 )
  865.     {
  866.         eaten[48]=1;
  867.     }
  868.      if(playerx>=0 && playerx<=75 && playery >=435 && playery<=525 )
  869.     {
  870.         eaten[49]=1;
  871.     }
  872.      if(playerx>=190 && playerx<=260 && playery >=445 && playery<=515 )
  873.     {
  874.         eaten[50]=1;
  875.     }
  876.      if(playerx>=305 && playerx<=350 && playery >=435 && playery<=525 )
  877.     {
  878.         eaten[51]=1;
  879.     }
  880.      if(playerx>=440 && playerx<=520 && playery >=440 && playery<=520 )
  881.     {
  882.         eaten[52]=1;
  883.     }
  884.      if(playerx>=515 && playerx<=585 && playery >=445 && playery<=515 )
  885.     {
  886.         eaten[53]=1;
  887.     }
  888.      if(playerx>=630 && playerx<=720 && playery >=435 && playery<=525 )
  889.     {
  890.         eaten[54]=1;
  891.     }
  892.      if(playerx>=835 && playerx<=905 && playery >=445 && playery<=515 )
  893.     {
  894.         eaten[55]=1;
  895.     }
  896.      if(playerx>=960 && playerx<=1035 && playery >=435 && playery<=525 )
  897.     {
  898.         eaten[56]=1;
  899.     }
  900.      if(playerx>=60 && playerx<=130 && playery >=515 && playery<=585 )
  901.     {
  902.         eaten[57]=1;
  903.     }
  904.       if(playerx>=185 && playerx<=265 && playery >=510 && playery<=590 )
  905.     {
  906.         eaten[58]=1;
  907.     }
  908.       if(playerx>=375 && playerx<=455 && playery >=510 && playery<=590 )
  909.     {
  910.         eaten[59]=1;
  911.     }
  912.       if(playerx>=570 && playerx<=650 && playery >=510 && playery<=590 )
  913.     {
  914.         eaten[60]=1;
  915.     }
  916.       if(playerx>=770 && playerx<=840 && playery >=515 && playery<=585 )
  917.     {
  918.         eaten[61]=1;
  919.     }
  920.       if(playerx>=895 && playerx<=975 && playery >=510 && playery<=590 )
  921.     {
  922.         eaten[62]=1;
  923.     }
  924.       if(playerx>=55 && playerx<=135 && playery >=575 && playery<=655 )
  925.     {
  926.         eaten[63]=1;
  927.     }
  928.       if(playerx>=185 && playerx<=265 && playery >=575 && playery<=655 )
  929.     {
  930.         eaten[64]=1;
  931.     }
  932.       if(playerx>=305 && playerx<=395 && playery >=570 && playery<=660 )
  933.     {
  934.         eaten[65]=1;
  935.     }
  936.       if(playerx>=630 && playerx<=720 && playery >=570 && playery<=660 )
  937.     {
  938.         eaten[66]=1;
  939.     }
  940.       if(playerx>=700 && playerx<=780 && playery >=575 && playery<=655 )
  941.     {
  942.         eaten[67]=1;
  943.     }
  944.       if(playerx>=760 && playerx<=850 && playery >=570 && playery<=660 )
  945.     {
  946.         eaten[68]=1;
  947.     }
  948.       if(playerx>=830 && playerx<=910 && playery >=575 && playery<=655 )
  949.     {
  950.         eaten[69]=1;
  951.     }
  952.       if(playerx>=960 && playerx<=1035 && playery >=570 && playery<=660 )
  953.     {
  954.         eaten[70]=1;
  955.     }
  956.  
  957.  
  958. }
  959.  
  960. void enemy1()
  961. {
  962.  
  963.     e1x=e1x+(sign1*125);
  964.     sign1=(-1)*sign1;
  965. }
  966. void enemy2()
  967. {
  968.     e2x=e2x+(sign2*125);
  969.     sign2=(-1)*sign2;
  970. }
  971.  
  972.  
  973. void enemy3()
  974. {
  975.     if(e3x>=95 && e3x <=289 && e3y == 485)
  976.     {
  977.         e3x++;
  978.     }
  979.     if(e3y>=291 && e3y <=485 && e3x == 290)
  980.     {
  981.         e3y--;
  982.     }
  983.     if(e3x>=96 && e3x <=290 && e3y == 290)
  984.     {
  985.         e3x--;
  986.     }
  987.     if(e3y>=290 && e3y <=484 && e3x == 95)
  988.     {
  989.         e3y++;
  990.     }
  991. }
  992. void enemy4()
  993. {
  994.  
  995.     if(e4x>=745 && e4x <=939 && e4y == 485)
  996.     {
  997.         e4x++;
  998.     }
  999.     if(e4y>=291 && e4y <=485 && e4x == 940)
  1000.     {
  1001.         e4y--;
  1002.     }
  1003.     if(e4x>=746 && e4x <=940 && e4y == 290)
  1004.     {
  1005.         e4x--;
  1006.     }
  1007.     if(e4y>=290 && e4y <=484 && e4x == 745)
  1008.     {
  1009.         e4y++;
  1010.     }
  1011. }
  1012. void timer1( ) {
  1013.    str1[0]=str1[0]+1;
  1014.     if(str1[0]==':') {
  1015.             strcpy(str1,"0");
  1016.     }
  1017. }
  1018. void timer2( ) {
  1019.     str2[0]=str2[0]+1;
  1020.     if(str2[0]==':') {
  1021.             strcpy(str2,"0");
  1022.     }
  1023. }
  1024. void gameover() {
  1025.     if(str1[0]=='4' && str2[0]=='6') {
  1026.             mode=8;
  1027.     }
  1028. }
  1029. void scorecount() {
  1030.     int i;
  1031.     score[1]=5*(eaten[1]);
  1032.     score[2]=-5*(eaten[2]);
  1033.  
  1034.     for(i=3;i<=5;i++) {
  1035.         score[i]=5*(eaten[i]);
  1036.     }
  1037.     //score[6]=(-5)*(eaten[6]);
  1038.     //score[7]=15*(eaten[7]);
  1039. }
  1040. void scoreadd() {
  1041.     int i,rem;
  1042.     for(i=1;i<=70;i++) {
  1043.             sum=sum+score[i];
  1044.     }
  1045.     int j=2;
  1046. while(sum!=0) {
  1047.         rem=sum%10;
  1048.         str3[j]=rem+48;
  1049.         sum=sum/10;
  1050.         j--;
  1051. }
  1052. str3[3]='\0';
  1053.  
  1054. }
  1055. //void enemtouch() {
  1056. //     if(playerx>=(e1x-15-25)&& playerx<=(e1x+15+25) && playery >=(e1y-15-25)&& playery<=(e1y+15+25)){
  1057. //        e1=1;
  1058. //
  1059. //    }
  1060. //    if(playerx>=(e2x-15-25)&& playerx<=(e2x+15+25) && playery >=(e2y-15-25)&& playery<=(e2y+15+25)){
  1061. //        e2=1;
  1062. //    }
  1063. //    if(playerx>=(e3x-15-25)&& playerx<=(e3x+15+25) && playery >=(e3y-15-25)&& playery<=(e3y+15+25)){
  1064. //        e3=1;
  1065. //    }
  1066. //    if(playerx>=(e4x-15-25)&& playerx<=(e4x+15+25) && playery >=(e4y-15-25)&& playery<=(e4y+15+25)){
  1067. //        e4=1;
  1068. //
  1069. //    }
  1070. //     }  //if((playerx>=(e1x-15-25)&& playerx<=(e1x+15+25) && playery >=(e1y-15-25)&& playery<=(e1y+15+25))||(playerx>=(e2x-15-25)&& playerx<=(e2x+15+25) && playery >=(e2y-15-25)&& playery<=(e2y+15+25) )||(playerx>=(e3x-15-25)&& playerx<=(e3x+15+25) && playery >=(e3y-15-25)&& playery<=(e3y+15+25) )||(playerx>=(e4x-15-25)&& playerx<=(e4x+15+25) && playery >=(e4y-15-25)&& playery<=(e4y+15+25) )&& enemymode==1) {
  1071.        // enemymode=2;
  1072.         //length=100;
  1073.         //return;
  1074.      //}    // if((playerx>=(e1x-15-25)&& playerx<=(e1x+15+25) && playery >=(e1y-15-25)&& playery<=(e1y+15+25))||(playerx>=(e2x-15-25)&& playerx<=(e2x+15+25) && playery >=(e2y-15-25)&& playery<=(e2y+15+25) )||(playerx>=(e3x-15-25)&& playerx<=(e3x+15+25) && playery >=(e3y-15-25)&& playery<=(e3y+15+25) )||(playerx>=(e4x-15-25)&& playerx<=(e4x+15+25) && playery >=(e4y-15-25)&& playery<=(e4y+15+25) )&& enemymode==2)  {
  1075.        // mode=8;
  1076.      //}
  1077. //}
  1078. //void enemytouch() {
  1079. //     if(playerx>=(e1x-15-25)&& playerx<=(e1x+15+25) && playery >=(e1y-15-25)&& playery<=(e1y+15+25) )
  1080. //    {
  1081. //        life--;
  1082. //        return;
  1083. //    }
  1084. //     if(playerx>=(e2x-15-25)&& playerx<=(e2x+15+25) && playery >=(e2y-15-25)&& playery<=(e2y+15+25) )
  1085. //    {
  1086. //        life--;
  1087. //        playerx=playerx-45;
  1088. //        return;
  1089. //    }
  1090. //     if(playerx>=(e3x-15-25)&& playerx<=(e3x+15+25) && playery >=(e3y-15-25)&& playery<=(e3y+15+25) )
  1091. //    {
  1092. //        life--;
  1093. //        return;
  1094. //    }
  1095. //     if(playerx>=(e4x-15-25)&& playerx<=(e4x+15+25) && playery >=(e4y-15-25)&& playery<=(e4y+15+25) )
  1096. //    {
  1097. //        life--;
  1098. //        return;
  1099. //    }
  1100. //}
  1101.  
  1102. void iDraw() {
  1103.     //place your drawing codes here
  1104.     iClear();
  1105.     gameover();
  1106.     eat();
  1107.     //enemtouch();
  1108.     if(mode==1)
  1109.     {
  1110.         iShowBMP(0,0,"slide1.bmp");
  1111.  
  1112.         drawTextBox2();
  1113.     }
  1114.     if(mode==2)
  1115.     {
  1116.         iShowBMP(0,0,"slide2.bmp");
  1117.  
  1118.         drawTextBox2();
  1119.     }
  1120.     if(mode==3)
  1121.     {
  1122.         iSetColor(0,0,0);
  1123.         iShowBMP(0,0,"SLIDE3.bmp");
  1124.         iRectangle(280,480,390,100);
  1125.         iRectangle(280,355,390,100);
  1126.         iRectangle(280,230,390,100);
  1127.         iRectangle(280,105,390,100);
  1128.  
  1129.  
  1130.  
  1131.     }
  1132.     if(mode==5)
  1133.     {
  1134.         iShowBMP(0,0,"slide-5.bmp");
  1135.  
  1136.         drawTextBox1();
  1137.     }
  1138.     if(mode==6)
  1139.     {
  1140.         iShowBMP(0,0,"slide6.bmp");
  1141.  
  1142.         drawTextBox1();
  1143.     }
  1144.  
  1145.  
  1146.  
  1147.  
  1148.     if(mode==7)
  1149.     {
  1150.         iShowBMP(0,0,"slide7.bmp");
  1151.  
  1152.         drawTextBox1();
  1153.     }
  1154.     if(mode==8)
  1155.     {
  1156.         iShowBMP(0,0,"SLIDE8.bmp");
  1157.  
  1158.  
  1159.     }
  1160.  
  1161.  
  1162.     if(mode==4)
  1163.     {
  1164.  
  1165.         iShowBMP(0,0,"BG.Tiles1.bmp");
  1166.         eat();
  1167.         //enemtouch();
  1168.         scorecount();
  1169.         scoreadd();
  1170.         iSetColor(26,0,0);
  1171.         iText(820,670,"TIMER- 0:",GLUT_BITMAP_TIMES_ROMAN_24);
  1172.         iText(940,670,str1,GLUT_BITMAP_TIMES_ROMAN_24);
  1173.         iText(955,670,str2,GLUT_BITMAP_TIMES_ROMAN_24);
  1174.          iText(10,670,"score",GLUT_BITMAP_TIMES_ROMAN_24);
  1175.          iText(70,670,str3,GLUT_BITMAP_TIMES_ROMAN_24);
  1176.  
  1177.          //if((e1+e2+e3+e4)==0
  1178.             iFilledRectangle(450,670,200,30);
  1179.          //if((e1+e2+e3+e4)==1)
  1180.             iFilledRectangle(450,670,150,30);
  1181.          //if((e1+e2+e3+e4)==2)
  1182.          iFilledRectangle(450,670,100,30);
  1183.          //if((e1+e2+e3+e4)==3)
  1184.         iFilledRectangle(0,60,65,5);
  1185.         iFilledRectangle(60,65,5,65);
  1186.         iFilledRectangle(125,60,135,5);
  1187.         iFilledRectangle(320,60,135,5);
  1188.         iFilledRectangle(450,65,5,65);
  1189.         iFilledRectangle(515,0,5,65);
  1190.         iFilledRectangle(580,60,135,5);
  1191.         iFilledRectangle(775,60,135,5);
  1192.         iFilledRectangle(580,65,5,65);
  1193.         iFilledRectangle(970,60,65,5);
  1194.         iFilledRectangle(970,65,5,65);
  1195.         iFilledRectangle(60,190,5,135);
  1196.         iFilledRectangle(60,580,70,5);
  1197.         iFilledRectangle(60,645,70,5);
  1198.  
  1199.         iFilledRectangle(60,385,5,130);
  1200.         iFilledRectangle(0,515,130,5);
  1201.         iFilledRectangle(125,255,135,5);
  1202.         iFilledRectangle(125,320,70,5);
  1203.         iFilledRectangle(125,325,5,130);
  1204.         iFilledRectangle(190,125,5,130);
  1205.         iFilledRectangle(190,385,70,5);
  1206.         iFilledRectangle(190,450,70,5);
  1207.         iFilledRectangle(190,515,70,5);
  1208.         iFilledRectangle(190,580,5,70);
  1209.         iFilledRectangle(255,125,135,5);
  1210.         iFilledRectangle(255,190,70,5);
  1211.         iFilledRectangle(255,320,5,65);
  1212.         iFilledRectangle(255,520,5,130);
  1213.         iFilledRectangle(320,195,5,190);
  1214.         iFilledRectangle(320,385,70,5);
  1215.         iFilledRectangle(320,450,70,5);
  1216.         iFilledRectangle(320,455,5,65);
  1217.         iFilledRectangle(320,580,5,70);
  1218.         iFilledRectangle(970,190,5,135);
  1219.         iFilledRectangle(970,385,5,130);
  1220.         iFilledRectangle(905,515,130,5);
  1221.         iFilledRectangle(905,580,70,5);
  1222.         iFilledRectangle(905,645,70,5);
  1223.  
  1224.         iFilledRectangle(840,125,5,130);
  1225.         iFilledRectangle(775,255,135,5);
  1226.         iFilledRectangle(840,320,70,5);
  1227.         iFilledRectangle(905,325,5,135);
  1228.         iFilledRectangle(645,125,130,5);
  1229.         iFilledRectangle(775,320,5,65);
  1230.         iFilledRectangle(775,385,70,5);
  1231.         iFilledRectangle(775,450,70,5);
  1232.         iFilledRectangle(775,515,70,5);
  1233.         iFilledRectangle(775,520,5,130);
  1234.         iFilledRectangle(840,580,5,70);
  1235.         iFilledRectangle(710,190,70,5);
  1236.         iFilledRectangle(710,195,5,190);
  1237.         iFilledRectangle(645,385,70,5);
  1238.         iFilledRectangle(645,450,70,5);
  1239.         iFilledRectangle(645,455,5,70);
  1240.         iFilledRectangle(710,455,5,70);
  1241.         iFilledRectangle(710,580,5,70);
  1242.         iFilledRectangle(710,580,5,70);
  1243.         iFilledRectangle(710,190,5,70);
  1244.         iFilledRectangle(580,255,5,135);
  1245.         iFilledRectangle(585,320,65,5);
  1246.         iFilledRectangle(585,515,5,70);
  1247.         iFilledRectangle(515,125,5,65);
  1248.         iFilledRectangle(515,455,5,65);
  1249.         iFilledRectangle(515,580,5,65);
  1250.         iFilledRectangle(450,190,135,5);
  1251.         iFilledRectangle(450,450,135,5);
  1252.         iFilledRectangle(450,645,135,5);
  1253.  
  1254.         iFilledRectangle(450,515,5,70);
  1255.         iFilledRectangle(450,255,5,135);
  1256.         iFilledRectangle(385,320,65,5);
  1257.         iFilledRectangle(385,190,5,70);
  1258.         iFilledRectangle(385,455,5,65);
  1259.         iFilledRectangle(385,580,5,70);
  1260.         iFilledRectangle(645,190,5,70);
  1261.         iFilledRectangle(645,580,5,70);
  1262.  
  1263.         iFilledRectangle(0,645,1035,5);
  1264.  
  1265.         iSetColor(51, 51, 204);
  1266.  
  1267.  
  1268. if(eaten[1]==0)iFilledCircle(95,30,15);
  1269.         if(eaten[3]==0)iFilledCircle(225,30,15);
  1270.         if(eaten[4]==0)iFilledCircle(385,30,15);
  1271.         if(eaten[5]==0)iFilledCircle(610,30,15);
  1272.         if(eaten[8]==0)iFilledCircle(1005,30,15);
  1273.         if(eaten[9]==0)iFilledCircle(30,95,15);
  1274.         if(eaten[10]==0)iFilledCircle(160,95,15);
  1275.         if(eaten[12]==0)iFilledCircle(415,95,15);
  1276.         if(eaten[13]==0)iFilledCircle(610,95,15);
  1277.         if(eaten[14]==0)iFilledCircle(675,95,15);
  1278.         if(eaten[15]==0)iFilledCircle(805,95,15);
  1279.         if(eaten[17]==0)iFilledCircle(1005,95,15);
  1280.         if(eaten[19]==0)iFilledCircle(285,160,15);
  1281.         if(eaten[21]==0)iFilledCircle(550,160,15);
  1282.         if(eaten[22]==0)iFilledCircle(740,160,15);
  1283.         if(eaten[23]==0)iFilledCircle(870,160,15);
  1284.         if(eaten[24]==0)iFilledCircle(30,220,15);
  1285.         if(eaten[26]==0)iFilledCircle(350,220,15);
  1286.         if(eaten[28]==0)iFilledCircle(675,220,15);
  1287.         if(eaten[29]==0)iFilledCircle(740,220,15);
  1288.         if(eaten[30]==0)iFilledCircle(1005,220,15);
  1289.         if(eaten[32]==0)iFilledCircle(225,285,15);
  1290.         if(eaten[33]==0)iFilledCircle(415,285,15);
  1291.         if(eaten[37]==0)iFilledCircle(870,285,15);
  1292.         if(eaten[39]==0)iFilledCircle(160,350,15);
  1293.         if(eaten[40]==0)iFilledCircle(285,350,15);
  1294.         if(eaten[42]==0)iFilledCircle(610,350,15);
  1295.         if(eaten[44]==0)iFilledCircle(95,415,15);
  1296.         if(eaten[45]==0)iFilledCircle(350,415,15);
  1297.         if(eaten[47]==0)iFilledCircle(805,415,15);
  1298.         if(eaten[48]==0)iFilledCircle(935,415,15);
  1299.         if(eaten[52]==0)iFilledCircle(480,480,15);
  1300.         if(eaten[58]==0)iFilledCircle(225,550,15);
  1301.         if(eaten[59]==0)iFilledCircle(415,550,15);
  1302.         if(eaten[60]==0)iFilledCircle(610,550,15);
  1303.         if(eaten[62]==0)iFilledCircle(935,550,15);
  1304.         if(eaten[63]==0)iFilledCircle(95,615,15);
  1305.         if(eaten[64]==0)iFilledCircle(225,615,15);
  1306.         if(eaten[67]==0)iFilledCircle(740,615,15);
  1307.         if(eaten[69]==0)iFilledCircle(870,615,15);
  1308.         iSetColor(0, 153, 76);
  1309.         if(eaten[2]==0)iFilledCircle(160,30,10);
  1310.         if(eaten[6]==0)iFilledCircle(675,30,10);
  1311.         if(eaten[11]==0)iFilledCircle(225,95,10);
  1312.         if(eaten[16]==0)iFilledCircle(870,95,10);
  1313.         if(eaten[20]==0)iFilledCircle(480,160,10);
  1314.         if(eaten[25]==0)iFilledCircle(160,220,10);
  1315.         if(eaten[31]==0)iFilledCircle(30,285,10);
  1316.         if(eaten[36]==0)iFilledCircle(610,285,10);
  1317.         if(eaten[38]==0)iFilledCircle(1005,285,10);
  1318.         if(eaten[41]==0)iFilledCircle(415,350,10);
  1319.         if(eaten[50]==0)iFilledCircle(225,480,10);
  1320.         if(eaten[53]==0)iFilledCircle(550,480,10);
  1321.         if(eaten[55]==0)iFilledCircle(870,480,10);
  1322.         if(eaten[57]==0)iFilledCircle(95,550,10);
  1323.         if(eaten[61]==0)iFilledCircle(805,550,10);
  1324.         iSetColor(153,51,255);
  1325.         if(eaten[7]==0)iFilledCircle(840,30,20);
  1326.         if(eaten[18]==0)iFilledCircle(160,160,20);
  1327.         if(eaten[27]==0)iFilledCircle(515,225,20);
  1328.         if(eaten[34]==0)iFilledCircle(480,320,20);
  1329.         if(eaten[35]==0)iFilledCircle(550,320,20);
  1330.         if(eaten[43]==0)iFilledCircle(805,355,20);
  1331.         if(eaten[49]==0)iFilledCircle(30,480,20);
  1332.         if(eaten[51]==0)iFilledCircle(350,480,20);
  1333.         if(eaten[46]==0)iFilledCircle(515,420,20);
  1334.         if(eaten[54]==0)iFilledCircle(675,480,20);
  1335.         if(eaten[56]==0)iFilledCircle(1005,480,20);
  1336.         if(eaten[65]==0)iFilledCircle(350,615,20);
  1337.         if(eaten[66]==0)iFilledCircle(675,615,20);
  1338.         if(eaten[68]==0)iFilledCircle(805,615,20);
  1339.         if(eaten[70]==0)iFilledCircle(1005,615,20);
  1340.  
  1341.  
  1342.         iSetColor(255,0,0);
  1343.         iFilledCircle(e1x,e1y,15);
  1344.         iFilledCircle(e2x,e2y,15);
  1345.         iFilledCircle(e3x,e3y,15);
  1346.         iFilledCircle(e4x,e4y,15);
  1347.  
  1348.  
  1349.  
  1350.         iSetColor(26,0,0);
  1351.         iFilledCircle(playerx,playery,25);
  1352.  
  1353.  
  1354.  
  1355.     }
  1356.  
  1357. //  iSetColor(20, 200, 200);
  1358. //  iFilledCircle(x, y, r);
  1359. //  iSetColor(20, 200, 0);
  1360. //  iText(40, 40, "Hi, I am iGraphics");
  1361. }
  1362.  
  1363. /*
  1364.     function iMouseMove() is called when the user presses and drags the mouse.
  1365.     (mx, my) is the position where the mouse pointer is.
  1366.     */
  1367. void iMouseMove(int mx, int my) {
  1368.     //  printf("x = %d, y= %d\n",mx,my);
  1369.     //place your codes here
  1370. }
  1371.  
  1372. /*
  1373.     function iMouse() is called when the user presses/releases the mouse.
  1374.     (mx, my) is the position where the mouse pointer is.
  1375.     */
  1376. void iMouse(int button, int state, int mx, int my) {
  1377.     if(button == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
  1378.     {
  1379.  
  1380.         if(mx >= 0 && mx <= 120 && my >= 650 && my <= 710 && (mode ==5 ||mode==6||mode||7))
  1381.         {
  1382.             mode = 3;
  1383.         }
  1384.         if(mx >= 735 && mx <= 1035 && my >= 0 && my <= 60 &&( mode == 1 || mode ==2))
  1385.         {
  1386.  
  1387.  
  1388.  
  1389.             if(mode==1)
  1390.             {
  1391.                 mode=2;
  1392.             }
  1393.             else if(mode==2)
  1394.             {
  1395.                 mode=3;
  1396.             }
  1397.  
  1398.         }
  1399.     if(mode==3) {
  1400.             if(mx>=280 && mx<=670 && my>=480 && my <=580) {
  1401.                 mode=4;
  1402.             }
  1403.         if(mx>=280 && mx<=670 && my>=355 && my <=455) {
  1404.                 mode=5;
  1405.             }
  1406.         if(mx>=280 && mx<=670 && my>=230 && my <=330) {
  1407.                 mode=6;
  1408.             }
  1409.         if(mx>=280 && mx<=670 && my>=105 && my <=205) {
  1410.                 mode=7;
  1411.             }
  1412.  
  1413.     }
  1414.  
  1415.     }
  1416.  
  1417.  
  1418. }
  1419.  
  1420. /*
  1421.     function iKeyboard() is called whenever the user hits a key in keyboard.
  1422.     key- holds the ASCII value of the key pressed.
  1423.     */
  1424. void iKeyboard(unsigned char key) {
  1425.     static int c=0;
  1426.     if (key == 'q') {
  1427.         exit(0);
  1428.     }
  1429.     else if(lastKey == key){
  1430.             c++;
  1431.     }
  1432.     else{
  1433.         printf("lastKey:%c  %d times\n",lastKey,c);
  1434.         c = 0;
  1435.         lastKey = key;
  1436.     }
  1437.  
  1438.         //printf("%c\n",key);
  1439.     //place your codes for other keys here
  1440. }
  1441.  
  1442. /*
  1443.     function iSpecialKeyboard() is called whenver user hits special keys like-
  1444.     function keys, home, end, pg up, pg down, arraows etc. you have to use
  1445.     appropriate constants to detect them. A list is:
  1446.     GLUT_KEY_F1, GLUT_KEY_F2, GLUT_KEY_F3, GLUT_KEY_F4, GLUT_KEY_F5, GLUT_KEY_F6,
  1447.     GLUT_KEY_F7, GLUT_KEY_F8, GLUT_KEY_F9, GLUT_KEY_F10, GLUT_KEY_F11, GLUT_KEY_F12,
  1448.     GLUT_KEY_LEFT, GLUT_KEY_UP, GLUT_KEY_RIGHT, GLUT_KEY_DOWN, GLUT_KEY_PAGE UP,
  1449.     GLUT_KEY_PAGE DOWN, GLUT_KEY_HOME, GLUT_KEY_END, GLUT_KEY_INSERT
  1450.     */
  1451. void iSpecialKeyboard(unsigned char key) {
  1452.     int i;
  1453.     maze();
  1454.     moves();
  1455.     eat();
  1456.      scorecount();
  1457.         scoreadd();
  1458.     if(mode==4)
  1459.     {
  1460.  
  1461.             if (key == GLUT_KEY_LEFT) {
  1462.  
  1463.                     if(pathcheck1(dy,ay,ax-1) && plx!=0)
  1464.                     {
  1465.  
  1466.                         playerx-=5;
  1467.                         moves();
  1468.                         eat();
  1469.                     }
  1470.                     //if(path[])
  1471.  
  1472.  
  1473.  
  1474.     }
  1475.     if (key == GLUT_KEY_RIGHT) {
  1476.                                 if( pathcheck1(cy,by,cx+1) && prx!=0 && prx!=1035)
  1477.                                 {
  1478.                                     playerx+=5;
  1479.                                     moves();
  1480.                                     eat();
  1481.                                 }
  1482.  
  1483.     }
  1484.     if (key == GLUT_KEY_UP) {
  1485.                             if( pathcheck2(ax,bx,ay+1) && puy!=0)
  1486.                             {
  1487.                                 playery+=5;
  1488.                                 moves();
  1489.                                 eat();
  1490.                             }
  1491.  
  1492.     }
  1493.     if (key == GLUT_KEY_DOWN) {
  1494.                             if(pathcheck2(dx,cx,dy-1) &&  pdy!=0)
  1495.                             {
  1496.                                    playery-=5;
  1497.                                 moves();
  1498.                                 eat();
  1499.                                                      }
  1500.  
  1501.  
  1502.     }
  1503.         }
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.     //place your codes for other keys here
  1510. }
  1511.  
  1512.  
  1513. int main() {
  1514.  
  1515.     iSetTimer(2000,enemy1);
  1516.     iSetTimer(2000,enemy2);
  1517.     iSetTimer(5,enemy3);
  1518.  
  1519.     iSetTimer(5,enemy4);
  1520.     iSetTimer(10000,timer1);
  1521.     iSetTimer(1000,timer2);
  1522.     //if(1) {
  1523.         //PlaySound("cello.wav", NULL ,SND_LOOP | SND_ASYNC);
  1524.     //}
  1525.     //place your own initialization codes here.
  1526.     iInitialize(1035, 710, "Clean BUET");
  1527.  
  1528.  
  1529.     return 0;
  1530. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement