Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- # include "iGraphics.h"
- #include "Function.h"
- #include <iostream>
- int x = 300, y = 300, r = 20;
- int e1x=455,e1y=420,e2x=580,e2y=225,e3x=95,e3y=485,e4x=745,e4y=485;
- int eaten[75];
- char lastKey = 0;
- int mode=4;
- int playerx=25 , playery=30;
- int plx=playerx-25,ply=playery,prx=playerx+25,pry=playery,pux=playerx,puy=playery+25,pdx=playerx,pdy=playery-25;
- 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;
- int path[1040][720];
- int sign1=1;
- int sign2=-1;
- char str1[]="0";
- char str2[]="0";
- char str3[4]={'0','0','0','0'};
- int life=3;
- int enemytouch[10];
- int e1,e2,e3,e4=0;
- //maze();
- int score[100];
- int sum=0;
- int pathcheck1(int x, int y,int z)
- {
- int i;
- for(i=x;i<=y;i++)
- {
- if(path[z][i]!=0)
- {
- return 0;
- }
- }
- return 1;
- }
- int pathcheck2(int x, int y,int z)
- {
- int i;
- for(i=x;i<=y;i++)
- {
- if(path[i][z]!=0)
- {
- return 0;
- }
- }
- return 1;
- }
- void moves()
- {
- plx=playerx-25;
- ply=playery;
- prx=playerx+25;
- pry=playery;
- pux=playerx;
- puy=playery+25;
- pdx=playerx;
- pdy=playery-25;
- ax=playerx-25;ay=playery+25;bx=playerx+25;by=playery+25;cx=playerx+25;cy=playery-25;dx=playerx-25;dy=playery-25;
- }
- void maze()
- {
- int i,j;
- for(i=0;i<=1035;i++)
- {
- for(j=646;j<=710;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=0;i<=64;i++)
- {
- for(j=61;j<=64;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=61;i<=64;i++)
- {
- for(j=65;j<=129;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=61;i<=64;i++)
- {
- for(j=191;j<=324;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=61;i<=64;i++)
- {
- for(j=386;j<=514;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=61;i<=129;i++)
- {
- for(j=581;j<=584;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=0;i<=129;i++)
- {
- for(j=516;j<=519;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=126;i<=259;i++)
- {
- for(j=61;j<=64;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=191;i<=194;i++)
- {
- for(j=126;j<=255;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=126;i<=259;i++)
- {
- for(j=256;j<=259;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=126;i<=194;i++)
- {
- for(j=321;j<=324;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=126;i<=129;i++)
- {
- for(j=325;j<=454;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=191;i<=259;i++)
- {
- for(j=386;j<=389;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=191;i<=259;i++)
- {
- for(j=451;j<=454;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=191;i<=259;i++)
- {
- for(j=516;j<=519;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=191;i<=194;i++)
- {
- for(j=581;j<=709;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=256;i<=389;i++)
- {
- for(j=126;j<=129;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=256;i<=324;i++)
- {
- for(j=191;j<=194;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=256;i<=259;i++)
- {
- for(j=321;j<=384;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=256;i<=259;i++)
- {
- for(j=521;j<=649;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=321;i<=324;i++)
- {
- for(j=196;j<=384;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=321;i<=389;i++)
- {
- for(j=386;j<=389;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=321;i<=389;i++)
- {
- for(j=451;j<=454;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=321;i<=324;i++)
- {
- for(j=456;j<=519;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=386;i<=449;i++)
- {
- for(j=321;j<=324;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=386;i<=389;i++)
- {
- for(j=191;j<=259;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=386;i<=389;i++)
- {
- for(j=456;j<=519;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=386;i<=389;i++)
- {
- for(j=581;j<=709;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=646;i<=649;i++)
- {
- for(j=191;j<=259;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=646;i<=649;i++)
- {
- for(j=581;j<=709;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=971;i<=974;i++)
- {
- for(j=191;j<=324;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=971;i<=974;i++)
- {
- for(j=386;j<=514;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=906;i<=1034;i++)
- {
- for(j=516;j<=519;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=906;i<=974;i++)
- {
- for(j=581;j<=584;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=906;i<=974;i++)
- {
- for(j=646;j<=649;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=971;i<=974;i++)
- {
- for(j=651;j<=709;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=841;i<=844;i++)
- {
- for(j=126;j<=254;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=776;i<=909;i++)
- {
- for(j=256;j<=259;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=841;i<=909;i++)
- {
- for(j=321;j<=324;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=906;i<=909;i++)
- {
- for(j=326;j<=459;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=646;i<=774;i++)
- {
- for(j=126;j<=129;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=776;i<=779;i++)
- {
- for(j=321;j<=384;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=776;i<=844;i++)
- {
- for(j=386;j<=389;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=776;i<=844;i++)
- {
- for(j=451;j<=454;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=776;i<=844;i++)
- {
- for(j=516;j<=519;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=776;i<=779;i++)
- {
- for(j=521;j<=649;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=841;i<=844;i++)
- {
- for(j=581;j<=709;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=711;i<=779;i++)
- {
- for(j=191;j<=194;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=711;i<=714;i++)
- {
- for(j=196;j<=384;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=646;i<=714;i++)
- {
- for(j=386;j<=389;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=646;i<=714;i++)
- {
- for(j=451;j<=454;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=646;i<=649;i++)
- {
- for(j=456;j<=524;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=711;i<=714;i++)
- {
- for(j=456;j<=524;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=711;i<=714;i++)
- {
- for(j=581;j<=649;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=711;i<=714;i++)
- {
- for(j=581;j<=709;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=711;i<=714;i++)
- {
- for(j=191;j<=259;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=581;i<=584;i++)
- {
- for(j=256;j<=389;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=586;i<=649;i++)
- {
- for(j=321;j<=324;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=581;i<=584;i++)
- {
- for(j=516;j<=584;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=516;i<=519;i++)
- {
- for(j=126;j<=189;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=516;i<=519;i++)
- {
- for(j=456;j<=519;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=516;i<=519;i++)
- {
- for(j=581;j<=644;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=451;i<=586;i++)
- {
- for(j=191;j<=194;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=451;i<=586;i++)
- {
- for(j=451;j<=454;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=451;i<=586;i++)
- {
- for(j=646;j<=649;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=451;i<=454;i++)
- {
- for(j=516;j<=584;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=451;i<=454;i++)
- {
- for(j=256;j<=389;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=321;i<=454;i++)
- {
- for(j=61;j<=64;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=451;i<=454;i++)
- {
- for(j=66;j<=129;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=516;i<=519;i++)
- {
- for(j=1;j<=64;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=581;i<=714;i++)
- {
- for(j=61;j<=64;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=581;i<=584;i++)
- {
- for(j=66;j<=129;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=776;i<=904;i++)
- {
- for(j=61;j<=64;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=971;i<=1034;i++)
- {
- for(j=61;j<=64;j++)
- {
- path[i][j]=1;
- }
- }
- for(i=971;i<=974;i++)
- {
- for(j=66;j<=129;j++)
- {
- path[i][j]=1;
- }
- }
- }
- void eat()
- {
- if(playerx>=55 && playerx<=135 && playery >=0 && playery<=70 )
- {
- eaten[1]=1;
- }
- if(playerx>=125 && playerx<=195 && playery >=0 && playery<=65 )
- {
- eaten[2]=1;
- }
- if(playerx>=185 && playerx<=265 && playery >=0 && playery<=70 )
- {
- eaten[3]=1;
- }
- if(playerx>=345 && playerx<=425 && playery >=0 && playery<=70 )
- {
- eaten[4]=1;
- }
- if(playerx>=570 && playerx<=650 && playery >=0 && playery<=70 )
- {
- }
- if(playerx>=640 && playerx<=710 && playery >=0 && playery<=65 )
- {
- eaten[6]=1;
- }
- if(playerx>=795 && playerx<=885 && playery >=0 && playery<=75 )
- {
- eaten[7]=1;
- }
- if(playerx>=965 && playerx<=1035 && playery >=0 && playery<=70 )
- {
- eaten[8]=1;
- }
- if(playerx>=0 && playerx<=70 && playery >=55 && playery<=135 )
- {
- eaten[9]=1;
- }
- if(playerx>=120 && playerx<=160 && playery >=55 && playery<=135 )
- {
- eaten[10]=1;
- }
- if(playerx>=190 && playerx<=260 && playery >=60 && playery<=130 )
- {
- eaten[11]=1;
- }
- if(playerx>=375 && playerx<=455 && playery >=55 && playery<=135 )
- {
- eaten[12]=1;
- }
- if(playerx>=570 && playerx<=650 && playery >=55 && playery<=135 )
- {
- eaten[13]=1;
- }
- if(playerx>=635 && playerx<=715 && playery >=55 && playery<=135 )
- {
- eaten[14]=1;
- }
- if(playerx>=765 && playerx<=845 && playery >=55 && playery<=135 )
- {
- eaten[15]=1;
- }
- if(playerx>=835 && playerx<=905 && playery >=60 && playery<=130 )
- {
- eaten[16]=1;
- }
- if(playerx>=965 && playerx<=1035 && playery >=55 && playery<=135 )
- {
- eaten[17]=1;
- }
- if(playerx>=115 && playerx<=205 && playery >=115 && playery<=205 )
- {
- eaten[18]=1;
- }
- if(playerx>=245 && playerx<=325 && playery >=120 && playery<=200 )
- {
- eaten[19]=1;
- }
- if(playerx>=445 && playerx<=515 && playery >=125 && playery<=195 )
- {
- eaten[20]=1;
- }
- if(playerx>=510 && playerx<=590 && playery >=120 && playery<=200 )
- {
- eaten[21]=1;
- }
- if(playerx>=700 && playerx<=780 && playery >=120 && playery<=200 )
- {
- eaten[22]=1;
- }
- if(playerx>=830 && playerx<=910 && playery >=120 && playery<=200 )
- {
- eaten[23]=1;
- }
- if(playerx>=0 && playerx<=70 && playery >=180 && playery<=260 )
- {
- eaten[24]=1;
- }
- if(playerx>=125 && playerx<=195 && playery >=185 && playery<=255 )
- {
- eaten[25]=1;
- }
- if(playerx>=310 && playerx<=390 && playery >=180 && playery<=260 )
- {
- eaten[26]=1;
- }
- if(playerx>=470 && playerx<=560 && playery >=180 && playery<=270 )
- {
- eaten[27]=1;
- }
- if(playerx>=635 && playerx<=715 && playery >=180 && playery<=260 )
- {
- eaten[28]=1;
- }
- if(playerx>=700 && playerx<=780 && playery >=180 && playery<=260 )
- {
- eaten[29]=1;
- }
- if(playerx>=965 && playerx<=1035 && playery >=180 && playery<=260 )
- {
- eaten[30]=1;
- }
- if(playerx>=0 && playerx<=65 && playery >=250 && playery<=320 )
- {
- eaten[31]=1;
- }
- if(playerx>=185 && playerx<=265 && playery >=245 && playery<=325 )
- {
- eaten[32]=1;
- }
- if(playerx>=375 && playerx<=455 && playery >=245 && playery<=325 )
- {
- eaten[33]=1;
- }
- if(playerx>=435 && playerx<=525 && playery >=275 && playery<=365 )
- {
- eaten[34]=1;
- }
- if(playerx>=505 && playerx<=595 && playery >=275 && playery<=365 )
- {
- eaten[35]=1;
- }
- if(playerx>=575 && playerx<=645 && playery >=250 && playery<=320 )
- {
- eaten[36]=1;
- }
- if(playerx>=830 && playerx<=910 && playery >=245 && playery<=325 )
- {
- eaten[37]=1;
- }
- if(playerx>=970 && playerx<=1035 && playery >=250 && playery<=320 )
- {
- eaten[38]=1;
- }
- if(playerx>=120 && playerx<=200 && playery >=310 && playery<=390 )
- {
- eaten[39]=1;
- }
- if(playerx>=245 && playerx<=325 && playery >=310 && playery<=390 )
- {
- eaten[40]=1;
- }
- if(playerx>=380 && playerx<=450 && playery >=315 && playery<=385 )
- {
- eaten[41]=1;
- }
- if(playerx>=570 && playerx<=650 && playery >=310 && playery<=390 )
- {
- eaten[42]=1;
- }
- if(playerx>=760 && playerx<=850 && playery >=310 && playery<=400 )
- {
- eaten[43]=1;
- }
- if(playerx>=55 && playerx<=135 && playery >=375 && playery<=455 )
- {
- eaten[44]=1;
- }
- if(playerx>=310 && playerx<=390 && playery >=375 && playery<=455 )
- {
- eaten[45]=1;
- }
- if(playerx>=470 && playerx<=560 && playery >=375 && playery<=465 )
- {
- eaten[46]=1;
- }
- if(playerx>=765 && playerx<=845 && playery >=375 && playery<=455 )
- {
- eaten[47]=1;
- }
- if(playerx>=895 && playerx<=975 && playery >=375 && playery<=455 )
- {
- eaten[48]=1;
- }
- if(playerx>=0 && playerx<=75 && playery >=435 && playery<=525 )
- {
- eaten[49]=1;
- }
- if(playerx>=190 && playerx<=260 && playery >=445 && playery<=515 )
- {
- eaten[50]=1;
- }
- if(playerx>=305 && playerx<=350 && playery >=435 && playery<=525 )
- {
- eaten[51]=1;
- }
- if(playerx>=440 && playerx<=520 && playery >=440 && playery<=520 )
- {
- eaten[52]=1;
- }
- if(playerx>=515 && playerx<=585 && playery >=445 && playery<=515 )
- {
- eaten[53]=1;
- }
- if(playerx>=630 && playerx<=720 && playery >=435 && playery<=525 )
- {
- eaten[54]=1;
- }
- if(playerx>=835 && playerx<=905 && playery >=445 && playery<=515 )
- {
- eaten[55]=1;
- }
- if(playerx>=960 && playerx<=1035 && playery >=435 && playery<=525 )
- {
- eaten[56]=1;
- }
- if(playerx>=60 && playerx<=130 && playery >=515 && playery<=585 )
- {
- eaten[57]=1;
- }
- if(playerx>=185 && playerx<=265 && playery >=510 && playery<=590 )
- {
- eaten[58]=1;
- }
- if(playerx>=375 && playerx<=455 && playery >=510 && playery<=590 )
- {
- eaten[59]=1;
- }
- if(playerx>=570 && playerx<=650 && playery >=510 && playery<=590 )
- {
- eaten[60]=1;
- }
- if(playerx>=770 && playerx<=840 && playery >=515 && playery<=585 )
- {
- eaten[61]=1;
- }
- if(playerx>=895 && playerx<=975 && playery >=510 && playery<=590 )
- {
- eaten[62]=1;
- }
- if(playerx>=55 && playerx<=135 && playery >=575 && playery<=655 )
- {
- eaten[63]=1;
- }
- if(playerx>=185 && playerx<=265 && playery >=575 && playery<=655 )
- {
- eaten[64]=1;
- }
- if(playerx>=305 && playerx<=395 && playery >=570 && playery<=660 )
- {
- eaten[65]=1;
- }
- if(playerx>=630 && playerx<=720 && playery >=570 && playery<=660 )
- {
- eaten[66]=1;
- }
- if(playerx>=700 && playerx<=780 && playery >=575 && playery<=655 )
- {
- eaten[67]=1;
- }
- if(playerx>=760 && playerx<=850 && playery >=570 && playery<=660 )
- {
- eaten[68]=1;
- }
- if(playerx>=830 && playerx<=910 && playery >=575 && playery<=655 )
- {
- eaten[69]=1;
- }
- if(playerx>=960 && playerx<=1035 && playery >=570 && playery<=660 )
- {
- eaten[70]=1;
- }
- }
- void enemy1()
- {
- e1x=e1x+(sign1*125);
- sign1=(-1)*sign1;
- }
- void enemy2()
- {
- e2x=e2x+(sign2*125);
- sign2=(-1)*sign2;
- }
- void enemy3()
- {
- if(e3x>=95 && e3x <=289 && e3y == 485)
- {
- e3x++;
- }
- if(e3y>=291 && e3y <=485 && e3x == 290)
- {
- e3y--;
- }
- if(e3x>=96 && e3x <=290 && e3y == 290)
- {
- e3x--;
- }
- if(e3y>=290 && e3y <=484 && e3x == 95)
- {
- e3y++;
- }
- }
- void enemy4()
- {
- if(e4x>=745 && e4x <=939 && e4y == 485)
- {
- e4x++;
- }
- if(e4y>=291 && e4y <=485 && e4x == 940)
- {
- e4y--;
- }
- if(e4x>=746 && e4x <=940 && e4y == 290)
- {
- e4x--;
- }
- if(e4y>=290 && e4y <=484 && e4x == 745)
- {
- e4y++;
- }
- }
- void timer1( ) {
- str1[0]=str1[0]+1;
- if(str1[0]==':') {
- strcpy(str1,"0");
- }
- }
- void timer2( ) {
- str2[0]=str2[0]+1;
- if(str2[0]==':') {
- strcpy(str2,"0");
- }
- }
- void gameover() {
- if(str1[0]=='4' && str2[0]=='6') {
- mode=8;
- }
- }
- void scorecount() {
- int i;
- score[1]=5*(eaten[1]);
- score[2]=-5*(eaten[2]);
- for(i=3;i<=5;i++) {
- score[i]=5*(eaten[i]);
- }
- //score[6]=(-5)*(eaten[6]);
- //score[7]=15*(eaten[7]);
- }
- void scoreadd() {
- int i,rem;
- for(i=1;i<=70;i++) {
- sum=sum+score[i];
- }
- int j=2;
- while(sum!=0) {
- rem=sum%10;
- str3[j]=rem+48;
- sum=sum/10;
- j--;
- }
- str3[3]='\0';
- }
- //void enemtouch() {
- // if(playerx>=(e1x-15-25)&& playerx<=(e1x+15+25) && playery >=(e1y-15-25)&& playery<=(e1y+15+25)){
- // e1=1;
- //
- // }
- // if(playerx>=(e2x-15-25)&& playerx<=(e2x+15+25) && playery >=(e2y-15-25)&& playery<=(e2y+15+25)){
- // e2=1;
- // }
- // if(playerx>=(e3x-15-25)&& playerx<=(e3x+15+25) && playery >=(e3y-15-25)&& playery<=(e3y+15+25)){
- // e3=1;
- // }
- // if(playerx>=(e4x-15-25)&& playerx<=(e4x+15+25) && playery >=(e4y-15-25)&& playery<=(e4y+15+25)){
- // e4=1;
- //
- // }
- // } //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) {
- // enemymode=2;
- //length=100;
- //return;
- //} // 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) {
- // mode=8;
- //}
- //}
- //void enemytouch() {
- // if(playerx>=(e1x-15-25)&& playerx<=(e1x+15+25) && playery >=(e1y-15-25)&& playery<=(e1y+15+25) )
- // {
- // life--;
- // return;
- // }
- // if(playerx>=(e2x-15-25)&& playerx<=(e2x+15+25) && playery >=(e2y-15-25)&& playery<=(e2y+15+25) )
- // {
- // life--;
- // playerx=playerx-45;
- // return;
- // }
- // if(playerx>=(e3x-15-25)&& playerx<=(e3x+15+25) && playery >=(e3y-15-25)&& playery<=(e3y+15+25) )
- // {
- // life--;
- // return;
- // }
- // if(playerx>=(e4x-15-25)&& playerx<=(e4x+15+25) && playery >=(e4y-15-25)&& playery<=(e4y+15+25) )
- // {
- // life--;
- // return;
- // }
- //}
- void iDraw() {
- //place your drawing codes here
- iClear();
- gameover();
- eat();
- //enemtouch();
- if(mode==1)
- {
- iShowBMP(0,0,"slide1.bmp");
- drawTextBox2();
- }
- if(mode==2)
- {
- iShowBMP(0,0,"slide2.bmp");
- drawTextBox2();
- }
- if(mode==3)
- {
- iSetColor(0,0,0);
- iShowBMP(0,0,"SLIDE3.bmp");
- iRectangle(280,480,390,100);
- iRectangle(280,355,390,100);
- iRectangle(280,230,390,100);
- iRectangle(280,105,390,100);
- }
- if(mode==5)
- {
- iShowBMP(0,0,"slide-5.bmp");
- drawTextBox1();
- }
- if(mode==6)
- {
- iShowBMP(0,0,"slide6.bmp");
- drawTextBox1();
- }
- if(mode==7)
- {
- iShowBMP(0,0,"slide7.bmp");
- drawTextBox1();
- }
- if(mode==8)
- {
- iShowBMP(0,0,"SLIDE8.bmp");
- }
- if(mode==4)
- {
- iShowBMP(0,0,"BG.Tiles1.bmp");
- eat();
- //enemtouch();
- scorecount();
- scoreadd();
- iSetColor(26,0,0);
- iText(820,670,"TIMER- 0:",GLUT_BITMAP_TIMES_ROMAN_24);
- iText(940,670,str1,GLUT_BITMAP_TIMES_ROMAN_24);
- iText(955,670,str2,GLUT_BITMAP_TIMES_ROMAN_24);
- iText(10,670,"score",GLUT_BITMAP_TIMES_ROMAN_24);
- iText(70,670,str3,GLUT_BITMAP_TIMES_ROMAN_24);
- //if((e1+e2+e3+e4)==0
- iFilledRectangle(450,670,200,30);
- //if((e1+e2+e3+e4)==1)
- iFilledRectangle(450,670,150,30);
- //if((e1+e2+e3+e4)==2)
- iFilledRectangle(450,670,100,30);
- //if((e1+e2+e3+e4)==3)
- iFilledRectangle(0,60,65,5);
- iFilledRectangle(60,65,5,65);
- iFilledRectangle(125,60,135,5);
- iFilledRectangle(320,60,135,5);
- iFilledRectangle(450,65,5,65);
- iFilledRectangle(515,0,5,65);
- iFilledRectangle(580,60,135,5);
- iFilledRectangle(775,60,135,5);
- iFilledRectangle(580,65,5,65);
- iFilledRectangle(970,60,65,5);
- iFilledRectangle(970,65,5,65);
- iFilledRectangle(60,190,5,135);
- iFilledRectangle(60,580,70,5);
- iFilledRectangle(60,645,70,5);
- iFilledRectangle(60,385,5,130);
- iFilledRectangle(0,515,130,5);
- iFilledRectangle(125,255,135,5);
- iFilledRectangle(125,320,70,5);
- iFilledRectangle(125,325,5,130);
- iFilledRectangle(190,125,5,130);
- iFilledRectangle(190,385,70,5);
- iFilledRectangle(190,450,70,5);
- iFilledRectangle(190,515,70,5);
- iFilledRectangle(190,580,5,70);
- iFilledRectangle(255,125,135,5);
- iFilledRectangle(255,190,70,5);
- iFilledRectangle(255,320,5,65);
- iFilledRectangle(255,520,5,130);
- iFilledRectangle(320,195,5,190);
- iFilledRectangle(320,385,70,5);
- iFilledRectangle(320,450,70,5);
- iFilledRectangle(320,455,5,65);
- iFilledRectangle(320,580,5,70);
- iFilledRectangle(970,190,5,135);
- iFilledRectangle(970,385,5,130);
- iFilledRectangle(905,515,130,5);
- iFilledRectangle(905,580,70,5);
- iFilledRectangle(905,645,70,5);
- iFilledRectangle(840,125,5,130);
- iFilledRectangle(775,255,135,5);
- iFilledRectangle(840,320,70,5);
- iFilledRectangle(905,325,5,135);
- iFilledRectangle(645,125,130,5);
- iFilledRectangle(775,320,5,65);
- iFilledRectangle(775,385,70,5);
- iFilledRectangle(775,450,70,5);
- iFilledRectangle(775,515,70,5);
- iFilledRectangle(775,520,5,130);
- iFilledRectangle(840,580,5,70);
- iFilledRectangle(710,190,70,5);
- iFilledRectangle(710,195,5,190);
- iFilledRectangle(645,385,70,5);
- iFilledRectangle(645,450,70,5);
- iFilledRectangle(645,455,5,70);
- iFilledRectangle(710,455,5,70);
- iFilledRectangle(710,580,5,70);
- iFilledRectangle(710,580,5,70);
- iFilledRectangle(710,190,5,70);
- iFilledRectangle(580,255,5,135);
- iFilledRectangle(585,320,65,5);
- iFilledRectangle(585,515,5,70);
- iFilledRectangle(515,125,5,65);
- iFilledRectangle(515,455,5,65);
- iFilledRectangle(515,580,5,65);
- iFilledRectangle(450,190,135,5);
- iFilledRectangle(450,450,135,5);
- iFilledRectangle(450,645,135,5);
- iFilledRectangle(450,515,5,70);
- iFilledRectangle(450,255,5,135);
- iFilledRectangle(385,320,65,5);
- iFilledRectangle(385,190,5,70);
- iFilledRectangle(385,455,5,65);
- iFilledRectangle(385,580,5,70);
- iFilledRectangle(645,190,5,70);
- iFilledRectangle(645,580,5,70);
- iFilledRectangle(0,645,1035,5);
- iSetColor(51, 51, 204);
- if(eaten[1]==0)iFilledCircle(95,30,15);
- if(eaten[3]==0)iFilledCircle(225,30,15);
- if(eaten[4]==0)iFilledCircle(385,30,15);
- if(eaten[5]==0)iFilledCircle(610,30,15);
- if(eaten[8]==0)iFilledCircle(1005,30,15);
- if(eaten[9]==0)iFilledCircle(30,95,15);
- if(eaten[10]==0)iFilledCircle(160,95,15);
- if(eaten[12]==0)iFilledCircle(415,95,15);
- if(eaten[13]==0)iFilledCircle(610,95,15);
- if(eaten[14]==0)iFilledCircle(675,95,15);
- if(eaten[15]==0)iFilledCircle(805,95,15);
- if(eaten[17]==0)iFilledCircle(1005,95,15);
- if(eaten[19]==0)iFilledCircle(285,160,15);
- if(eaten[21]==0)iFilledCircle(550,160,15);
- if(eaten[22]==0)iFilledCircle(740,160,15);
- if(eaten[23]==0)iFilledCircle(870,160,15);
- if(eaten[24]==0)iFilledCircle(30,220,15);
- if(eaten[26]==0)iFilledCircle(350,220,15);
- if(eaten[28]==0)iFilledCircle(675,220,15);
- if(eaten[29]==0)iFilledCircle(740,220,15);
- if(eaten[30]==0)iFilledCircle(1005,220,15);
- if(eaten[32]==0)iFilledCircle(225,285,15);
- if(eaten[33]==0)iFilledCircle(415,285,15);
- if(eaten[37]==0)iFilledCircle(870,285,15);
- if(eaten[39]==0)iFilledCircle(160,350,15);
- if(eaten[40]==0)iFilledCircle(285,350,15);
- if(eaten[42]==0)iFilledCircle(610,350,15);
- if(eaten[44]==0)iFilledCircle(95,415,15);
- if(eaten[45]==0)iFilledCircle(350,415,15);
- if(eaten[47]==0)iFilledCircle(805,415,15);
- if(eaten[48]==0)iFilledCircle(935,415,15);
- if(eaten[52]==0)iFilledCircle(480,480,15);
- if(eaten[58]==0)iFilledCircle(225,550,15);
- if(eaten[59]==0)iFilledCircle(415,550,15);
- if(eaten[60]==0)iFilledCircle(610,550,15);
- if(eaten[62]==0)iFilledCircle(935,550,15);
- if(eaten[63]==0)iFilledCircle(95,615,15);
- if(eaten[64]==0)iFilledCircle(225,615,15);
- if(eaten[67]==0)iFilledCircle(740,615,15);
- if(eaten[69]==0)iFilledCircle(870,615,15);
- iSetColor(0, 153, 76);
- if(eaten[2]==0)iFilledCircle(160,30,10);
- if(eaten[6]==0)iFilledCircle(675,30,10);
- if(eaten[11]==0)iFilledCircle(225,95,10);
- if(eaten[16]==0)iFilledCircle(870,95,10);
- if(eaten[20]==0)iFilledCircle(480,160,10);
- if(eaten[25]==0)iFilledCircle(160,220,10);
- if(eaten[31]==0)iFilledCircle(30,285,10);
- if(eaten[36]==0)iFilledCircle(610,285,10);
- if(eaten[38]==0)iFilledCircle(1005,285,10);
- if(eaten[41]==0)iFilledCircle(415,350,10);
- if(eaten[50]==0)iFilledCircle(225,480,10);
- if(eaten[53]==0)iFilledCircle(550,480,10);
- if(eaten[55]==0)iFilledCircle(870,480,10);
- if(eaten[57]==0)iFilledCircle(95,550,10);
- if(eaten[61]==0)iFilledCircle(805,550,10);
- iSetColor(153,51,255);
- if(eaten[7]==0)iFilledCircle(840,30,20);
- if(eaten[18]==0)iFilledCircle(160,160,20);
- if(eaten[27]==0)iFilledCircle(515,225,20);
- if(eaten[34]==0)iFilledCircle(480,320,20);
- if(eaten[35]==0)iFilledCircle(550,320,20);
- if(eaten[43]==0)iFilledCircle(805,355,20);
- if(eaten[49]==0)iFilledCircle(30,480,20);
- if(eaten[51]==0)iFilledCircle(350,480,20);
- if(eaten[46]==0)iFilledCircle(515,420,20);
- if(eaten[54]==0)iFilledCircle(675,480,20);
- if(eaten[56]==0)iFilledCircle(1005,480,20);
- if(eaten[65]==0)iFilledCircle(350,615,20);
- if(eaten[66]==0)iFilledCircle(675,615,20);
- if(eaten[68]==0)iFilledCircle(805,615,20);
- if(eaten[70]==0)iFilledCircle(1005,615,20);
- iSetColor(255,0,0);
- iFilledCircle(e1x,e1y,15);
- iFilledCircle(e2x,e2y,15);
- iFilledCircle(e3x,e3y,15);
- iFilledCircle(e4x,e4y,15);
- iSetColor(26,0,0);
- iFilledCircle(playerx,playery,25);
- }
- // iSetColor(20, 200, 200);
- // iFilledCircle(x, y, r);
- // iSetColor(20, 200, 0);
- // iText(40, 40, "Hi, I am iGraphics");
- }
- /*
- function iMouseMove() is called when the user presses and drags the mouse.
- (mx, my) is the position where the mouse pointer is.
- */
- void iMouseMove(int mx, int my) {
- // printf("x = %d, y= %d\n",mx,my);
- //place your codes here
- }
- /*
- function iMouse() is called when the user presses/releases the mouse.
- (mx, my) is the position where the mouse pointer is.
- */
- void iMouse(int button, int state, int mx, int my) {
- if(button == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
- {
- if(mx >= 0 && mx <= 120 && my >= 650 && my <= 710 && (mode ==5 ||mode==6||mode||7))
- {
- mode = 3;
- }
- if(mx >= 735 && mx <= 1035 && my >= 0 && my <= 60 &&( mode == 1 || mode ==2))
- {
- if(mode==1)
- {
- mode=2;
- }
- else if(mode==2)
- {
- mode=3;
- }
- }
- if(mode==3) {
- if(mx>=280 && mx<=670 && my>=480 && my <=580) {
- mode=4;
- }
- if(mx>=280 && mx<=670 && my>=355 && my <=455) {
- mode=5;
- }
- if(mx>=280 && mx<=670 && my>=230 && my <=330) {
- mode=6;
- }
- if(mx>=280 && mx<=670 && my>=105 && my <=205) {
- mode=7;
- }
- }
- }
- }
- /*
- function iKeyboard() is called whenever the user hits a key in keyboard.
- key- holds the ASCII value of the key pressed.
- */
- void iKeyboard(unsigned char key) {
- static int c=0;
- if (key == 'q') {
- exit(0);
- }
- else if(lastKey == key){
- c++;
- }
- else{
- printf("lastKey:%c %d times\n",lastKey,c);
- c = 0;
- lastKey = key;
- }
- //printf("%c\n",key);
- //place your codes for other keys here
- }
- /*
- function iSpecialKeyboard() is called whenver user hits special keys like-
- function keys, home, end, pg up, pg down, arraows etc. you have to use
- appropriate constants to detect them. A list is:
- GLUT_KEY_F1, GLUT_KEY_F2, GLUT_KEY_F3, GLUT_KEY_F4, GLUT_KEY_F5, GLUT_KEY_F6,
- GLUT_KEY_F7, GLUT_KEY_F8, GLUT_KEY_F9, GLUT_KEY_F10, GLUT_KEY_F11, GLUT_KEY_F12,
- GLUT_KEY_LEFT, GLUT_KEY_UP, GLUT_KEY_RIGHT, GLUT_KEY_DOWN, GLUT_KEY_PAGE UP,
- GLUT_KEY_PAGE DOWN, GLUT_KEY_HOME, GLUT_KEY_END, GLUT_KEY_INSERT
- */
- void iSpecialKeyboard(unsigned char key) {
- int i;
- maze();
- moves();
- eat();
- scorecount();
- scoreadd();
- if(mode==4)
- {
- if (key == GLUT_KEY_LEFT) {
- if(pathcheck1(dy,ay,ax-1) && plx!=0)
- {
- playerx-=5;
- moves();
- eat();
- }
- //if(path[])
- }
- if (key == GLUT_KEY_RIGHT) {
- if( pathcheck1(cy,by,cx+1) && prx!=0 && prx!=1035)
- {
- playerx+=5;
- moves();
- eat();
- }
- }
- if (key == GLUT_KEY_UP) {
- if( pathcheck2(ax,bx,ay+1) && puy!=0)
- {
- playery+=5;
- moves();
- eat();
- }
- }
- if (key == GLUT_KEY_DOWN) {
- if(pathcheck2(dx,cx,dy-1) && pdy!=0)
- {
- playery-=5;
- moves();
- eat();
- }
- }
- }
- //place your codes for other keys here
- }
- int main() {
- iSetTimer(2000,enemy1);
- iSetTimer(2000,enemy2);
- iSetTimer(5,enemy3);
- iSetTimer(5,enemy4);
- iSetTimer(10000,timer1);
- iSetTimer(1000,timer2);
- //if(1) {
- //PlaySound("cello.wav", NULL ,SND_LOOP | SND_ASYNC);
- //}
- //place your own initialization codes here.
- iInitialize(1035, 710, "Clean BUET");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement