Tag Info

Hot answers tagged


You add the gravitational acceleration to the vertical component of velocity. if(fired){ pos.x -= velocity.x * delta; //since I want it to move the opposite direction of where I dragged, I subtract pos.y -= velocity.y * delta; velocity.y += g*delta; }


Gravity is a constant downward acceleration. Acceleration is a change in velocity. Simply subtract a constant value from velocity.y every update. public void update(float delta){ if(fired){ velocity.y -= GRAVITY * delta; pos.x -= velocity.x * delta; pos.y -= velocity.y * delta; } } The ideal value for GRAVITY depends ...

Only top voted, non community-wiki answers of a minimum length are eligible