Thread: pls modify for me

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    1

    pls modify for me

    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();
    
    }

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Yeah, I'll be sure and get right on that.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    ex-DECcie
    Join Date
    Dec 2005
    Posts
    125
    Quote Originally Posted by quzah
    Yeah, I'll be sure and get right on that.


    Quzah.
    Oh, okay, Quzah, you got it. I was going to drop everything I'm doing (including my current proejct with an April 3rd deadline) and handle this.... I owe you one!
    Mr. Blonde: You ever listen to K-Billy's "Super Sounds of the Seventies" weekend? It's my personal favorite.

  4. #4
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    If you need to understand the algorithm involved, look here
    The Algorithm For Balls

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Basic port scanner code .. pls help ???
    By intruder in forum C Programming
    Replies: 18
    Last Post: 03-13-2003, 08:47 AM
  2. help me pls..... :(
    By mocha_frap024 in forum C++ Programming
    Replies: 2
    Last Post: 02-22-2002, 10:46 AM
  3. C programming - pls pls help me
    By sally arnold in forum C Programming
    Replies: 10
    Last Post: 01-16-2002, 04:55 AM
  4. pls help me!!
    By hanseler in forum C++ Programming
    Replies: 1
    Last Post: 12-05-2001, 08:46 PM
  5. Pls Help Me In This Question!!!
    By Joanna in forum Windows Programming
    Replies: 1
    Last Post: 10-20-2001, 02:05 PM