Original Post
Hi, i am moving the ball along x-axis and y a-xis,but after hitting the top wall its coming back exactly with the same position.suppose asterisk as ball hitting top wall and line as a top wall -------------------------------------------------- * * * * * * * * * * * * (ball moving upward) (ball moving downward) Idle function i m using idlefunc() { x=0.0; y=0.0; x += f * speed; y += a * speed; } when the programme will call the idle function ball will hit the top wall but after hitting top wall it have to change the direction with certain angle. the function i m using is if (x+y > e) //e is the top wall { vf = -vf; a = -a; } why its not changing the direction of ball? after hitting the topwall it have to hit the right wall instead of hitting bottom wall. i use visual C++ and opengl glut library to do this programme.