#include #include #include #include #include #include int t=0,h=0,g=0,o=0,a=0,f=0,r=4,m,q=199,w=439,x=319,y=430,n=0,p=10,k=-1,sag=400,l=-4,v,b=4; int qwadr[3] [10]; FILE *fp; struct sav { int sx; int sy; int sk; int sl; int sm; int sv; int sp; int sq; int sw; int so; int sqwadr [3] [10]; }; sav sve; sav sv; void doska() //procedura vipolnjaet peremeshenie doski { h=getch(); if (h==75 && q-19+m>=0) t=-20; if (h==77 && w+19-m<=639) t=20; setfillstyle(1,BLUE); bar(q+m,450,w-m,479); setfillstyle(1,RED); bar(q+t+m,450,w+t-m,479); q+=t;w+=t; t=0; return; } void save() { sav sve= {x,y,k,l,m,v,p,q,w,o,qwadr[3][10]}; fp = fopen("save.bin","w+b"); if (fp==NULL) { printf ("Error\n"); getch(); return; } fwrite (&sve,sizeof(sve),1,fp); fflush(fp); fclose(fp); return; } void load() { fp = fopen("save.bin","rb"); fseek(fp,0,SEEK_SET); fread(&sv,sizeof(sv),1,fp); x=sv.sx,y=sv.sy,k=sv.sk,l=sv.sl,m=sv.sm,v=sv.sv,p=sv.sp,q=sv.sq,w=sv.sw,o=sv.so; for(int i=0;i<3;i++) for(int j=0;j<10;j++) qwadr [i] [j]=sv.sqwadr[i] [j]; g=1; fclose(fp); return; } void menu() { cleardevice(); setfillstyle(1,LIGHTGREEN); bar(50,60,590,400); setfillstyle(1,WHITE); bar(200,420,410,460); setbkcolor(LIGHTBLUE); setcolor(CYAN); settextstyle(TRIPLEX_FONT,HORIZ_DIR,5); outtextxy(60,80,"A");outtextxy(180,80,"K"); outtextxy(300,80,"N");outtextxy(420,80,"I"); outtextxy(540,80,"E"); setcolor(DARKGRAY); outtextxy(120,100,"R");outtextxy(240,100,"A"); outtextxy(360,100,"O");outtextxy(480,100,"D"); setcolor(YELLOW); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(240,240,"CONTINUE"); outtextxy(240,270,"NEW GAME"); //outtextxy(240,300,"SAVE"); outtextxy(240,300,"EXIT"); setcolor(RED); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); outtextxy(220,440,"MADE BY ANOSOW MAKSIM"); int x2=215,y2=245; while(1) { setcolor(LIGHTGREEN); setfillstyle(1,RED); fillellipse(x2,y2,10,10); a=getch(); if (a==72 && f!=0) { f--; setfillstyle(1,LIGHTGREEN); fillellipse(x2,y2,10,10); setfillstyle(1,RED); fillellipse(x2,y2-30,10,10);y2-=30; } if (a==80 && f!=2) { f++; setfillstyle(1,LIGHTGREEN); fillellipse(x2,y2,10,10); setfillstyle(1,RED); fillellipse(x2,y2+30,10,10);y2+=30; } if (a==13 && f==0) { load(); g=1; break; } /* if (a==13 && f==2) { save(); a=0,f=0; break; } */ if (a==13 && f==1) { a=0,f=0,m=0; break; } if (a==13 && f==2) break; } cleardevice(); return; } void label() { setbkcolor(LIGHTBLUE); setcolor(WHITE); settextstyle(DEFAULT_FONT,VERT_DIR,4); outtextxy(50,80,"ARKANOIDE"); setcolor(YELLOW); settextstyle(DEFAULT_FONT,HORIZ_DIR,3); outtextxy(240,240,"LeVeL"); char num[1]; sprintf(num,"%i",m/20+1); outtextxy(380,240,num); setcolor(LIGHTRED); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); outtextxy(220,440,"Press Enter to continue"); while(2) { a=getch(); if (a==13) break; } cleardevice(); return; } void del() { { qwadr [(y-8)/64] [x/64]=0; setfillstyle(1,BLUE); bar(x/64*64+2,((y-8)/64)*64+2,x/64*64+61,((y-8)/64)*64+61); } return; } void del1() { { qwadr [(y)/64] [(x+8)/64]=0; setfillstyle(1,BLUE); bar((x+8)/64*64+2,y/64*64+2,(x+8)/64*64+61,y/64*64+61); } return; } void del2() { { qwadr [(y)/64] [(x-8)/64]=0; setfillstyle(1,BLUE); bar((x-8)/64*64+2,y/64*64+2,(x-8)/64*64+61,y/64*64+61); } return; } void del3() { { qwadr [(y+8)/64] [x/64]=0; setfillstyle(1,BLUE); bar(x/64*64+2,(y+8)/64*64+2,x/64*64+61,(y+8)/64*64+61); } return; } void move() { if (y<=198 && ((x+8)%64<=12) && yx-k*b*v/sag && qwadr [(y)/64] [(x+8)/64] == 1) { del1(); k=-1,l=-4; } if (y<=198 && y>=193 && x=193 && x>x-k*b*v/sag && qwadr [(y-8)/64] [x/64] == 1) { del(); k=1,l=4; } if (y<=134 && y>=130 && x=130 && x>x-k*b*v/sag && qwadr [(y-8)/64] [x/64] == 1) { del(); k=1,l=4; } if (y<=70 && y>=64 && x=64 && x>x-k*b*v/sag && qwadr [(y-8)/64] [x/64] == 1) { del(); k=1,l=4; } if (y<198 && ((x+8)%64<=14) && y>y-l*v/sag && xy-l*v/sag && x>x-k*b*v/sag && qwadr [(y)/64] [(x+8)/64] == 1) { del1(); k=-1,l=4; } if (y<198 && ((y+8)%64<=14) && y>y-l*v/sag && xy-l*v/sag && x>x-k*b*v/sag && qwadr [(y+8)/64] [x/64] == 1) { del3(); k=1,l=-4; } if (y<=8 && y>=6 && x=6 && x>x-k*b*v/sag) k=1,l=4; if (y>=438 && y<=440 && x<=w-m && x >=q+m && x>x-k*b*v/sag) { doska; if (b!=2 && h==75) b-=2; if (b!=6 && h==77) b+=2; k=1,l=-4; } if (y<438) h=0; if (y>=438 && y<=440 && x<=w-m && x >=q+m && x441 && y<=446 && x<=w-m && x >= q-10+m && x>x-k*b*v/sag) k=-1,l=-4; if (y>441 && y<=446 && x<=w+10-m && x >=q+m && xy-l*v/sag) k=1,l=4; if (x<=8 && y=632 && y>y-l*v/sag) k=-1,l=4; if (x>=632 && y=441 && (!(x>=q-10) || !(x<=w+10))) { menu(); break; } if (a==13 && f==2) { a=0,f=0; return; } label(); if (a==13 && f==2) { a=0, f=0; return; } int x1; for(int y1=2,i=0;i<3;y1+=64,i++) { x1=2; for(int j=0;j<=9;j++,x1+=64) { setbkcolor(BLUE); setfillstyle(1,WHITE); if (qwadr [i] [j] == 1) bar(x1,y1,x1+59,y1+59); } } setfillstyle(1,RED); bar(q+m,450,w-m,479); for (o;;o++) { v=400*b; move(); if (kbhit()) { doska(); if (h==27) break; } paint(); if(o%(p*b)==0) sag=400*b; else sag=44000; for (n=0,i=0;i<3;i++) for (int j=0;j<10;j++) if (qwadr [i] [j]==0) n++; switch (n) { case 7: p=8;break; case 14: p=6;break; case 21: p=4;break; } if (n==30) { g=0; cleardevice(); break; } } } closegraph(); }