Salutations sir, I'v got a problem again..I guess this line of code is where the collision is detected right, of the ball and the wall, rite?

if(X-X<size2){// m2 & wall
if(coeff>0.){
ddt=dt-(X+size2-X)/V;
if(ddt<dt){
X-=(V-v0)*ddt;
X-=(V-v0)*ddt;
//V=-coeff*V;
V=-V;
if(frame==3)v0=(m1*V+m2*V)/mcm;
v0=V[frame];
X-=(V-v0)*ddt;
X-=(V-v0)*ddt;
}
}else if(V==V) V=V=0.;
else V=0;
}
V=(m1*V+m2*V)/mcm;
v0=V[frame];
X=((m1*X+m2*X)/mcm);
drawIt();
}

But when i changed the distance of the two walls further apart...

[color=blue]original code[/color]

[color=limegreen]g[/color].fillRect((int)X-size,yc-size4,size2,size8);
[color=limegreen]g[/color].fillRect((int)X-size,yc-size4,size2,size8);

[color=red]to this[/color]

[color=limegreen]g[/color].fillRect(0,yc-size4,size2,size8);
[color=limegreen]g[/color].fillRect((int)X+39,yc-size4,size2,size8);

..the balls [color=red]don't move rite to the wall and before even reaching the wall they bounce back[/color] as if bouncing off the walls however proceed with the normal collision  ???.

Can u help me sir in explaining how do the balls actually "know" when they hit the wall and how should I lengthen the ability of the balls to travel, similar to how the balls in your collision 2D are capable of  :-\. Thank you so much  :)