#include #include #include #include #include #define VEL 15 char s; int i,x1,x2,px=520; void pallina(int x) { int j,lim=0,mpy=1,y,mpx=-1; if(x==0) { lim=640; mpx=1; } y=365; if(lim==0) y=270; j=y; do { if (y>=j+15 || y<=j-35) mpy*=-1; setcolor(14); circle(x,y,8); setfillstyle(1,14); floodfill(x,y,14); delay(2); setcolor(1); circle(x,y,8); setfillstyle(0,1); floodfill(x,y,1); x+=mpx; y+=mpy; } while(x!=lim); } void barra1() { if (kbhit()) { s=getche(); setfillstyle(1,0); bar(x1,30,x1+45,35); if (s=='k' && x1>=0) x1-=20; else if (s=='l' && x1<=595) x1+=20; } setfillstyle(1,12); bar(x1,30,x1+45,35); } void barra2() { if (kbhit()) { s=getche(); setfillstyle(1,0); bar(x2,451,x2+45,456); if (s=='a' && x2>=0) x2-=20; else if (s=='s' && x2<=595) x2+=20; } setfillstyle(1,12); bar(x2,451,x2+45,456); } void pl2() { setfillstyle(1,0); bar(x2,451,x2+45,456); if(x20) { setfillstyle(1,4); for (i=0;i=320;i-=10) { setcolor(14); outtextxy(i,50,"SuperBall"); delay(20); setcolor(1); outtextxy(i,50,"SuperBall"); if (kbhit()) goto gioca; } setcolor(14); outtextxy(i,50,"SuperBall"); settextstyle(3,0,6); outtextxy(180,200,"Player 1"); outtextxy(450,200,"Player 2"); settextstyle(3,0,4); outtextxy(180,300,"Sinistra= A"); outtextxy(180,400,"Destra= S"); outtextxy(450,300,"Sinistra= K"); outtextxy(450,400,"Destra= L"); pallina(0); delay(VEL); pallina(640); settextstyle(4,0,3); for(i=0;i<=320;i+=10) { setcolor(14); outtextxy(i,460,"Creato da Riva Oscar"); delay(20); setcolor(1); outtextxy(i,460,"Creato da Riva Oscar"); if (kbhit()) { i=320; break; } } setcolor(14); outtextxy(i,460,"Creato da Riva Oscar"); getch(); gioca: x1=x2=100; cleardevice(); settextstyle(3,0,4); setcolor(14); outtextxy(320,240,"1 o 2 giocatori"); do { g=getche(); } while(g!=49 && g!=50); cleardevice(); setbkcolor(0); settextstyle(4,0,3); do { if (ab==1) barra1(); else { if (g==49) pl2(); else barra2(); } if (px>=630 || px<=10) mpx*=-1; if (py>=440 || py<=46) mpy*=-1; if ((pxx1+46) && (mpy==1) && (py<=46)) p2[1]++; if ((pxx2+46) && (mpy==-1) && (py>=440)) p1[1]++; if (p2[1]==6) { setfillstyle(1,0); bar(0,470,100,480); bar(0,0,100,12); p1[1]=0; p2[1]=0; p2[0]++; } if (p1[1]==6) { setfillstyle(1,0); bar(0,470,100,480); bar(0,0,100,12); p2[1]=0; p1[1]=0; p1[0]++; } setcolor(14); circle(px,py,10); setfillstyle(1,14); floodfill(px,py,14); delay(VEL); if (mpy==1) ab=2; else ab=1; setcolor(0); circle(px,py,10); setfillstyle(0,0); floodfill(px,py,0); px+=mpx*2; py+=mpy*2; punti(p1,2); punti(p2,470); if (s==27) { setcolor(14); outtextxy(320,240,"Vuoi uscire?"); u=getch(); setfillstyle(1,0); bar(250,200,390,280); } s=22; } while (u!='y' && p1[0]!=6 && p2[0]!=6); closegraph(); }