plz help me guyzz....pls modify this....this code should have two balls and wen they bump each other they go in separate ways....
i need it as soon as possible guyzz help...thanx
Code:#include<conio.h> #include<graphics.h> #include<dos.h> #include<stdlib.h> main() { int gdriver=DETECT, gmode, r, col, row, pathx, pathy,speed; int forecolor, bkcolor, linecolor; initgraph(&gdriver,&gmode,"C:\\TCLITE\\BGI"); randomize(); r=random(40)+10; col=r+random(640-2*r); row=r+random(480-2*r); forecolor=random(14)+1; bkcolor=random(14)+1; linecolor=random(14)+1; speed=random(5)+1; pathx=(pathy=speed); setbkcolor(bkcolor); while (!kbhit()) { col+=pathx; row+=pathy; setcolor(linecolor); circle(col,row,r); setfillstyle(SOLID_FILL,forecolor); floodfill(col,row,linecolor); delay(10); setfillstyle(SOLID_FILL,bkcolor); floodfill(col,row,linecolor); setcolor(bkcolor); circle(col,row,r); col+=pathx; row+=pathy; if (col+r>640) pathx=-(speed); if (row+r>480) pathy=-(speed); if (col-r<0) pathx=speed; if (row-r<0) pathy=speed; } closegraph(); }



LinkBack URL
About LinkBacks


