Q:

moving an object in a striaght line

i have to make an application in which on every click it should throw an object and that object should travel in a straight line. I am done with creating an object on every click. But how to move an object in a straight line at the time when i click. any example.

A:

At any given time t your object has a position (x, y).  It is also moving with a velocity vector (v_x, v_y).
After a change in time of dt, if you can assume that your object is moving with constant velocity over the entire time interval, you can calculate a new position like this: 
dx = v_x*dt;
dy = v_y*dt;
x += dx;
y += dy;
t += dt;

If that constant velocity assumption is bad, it means you need to reduce dt until it's close enough to true.

