Created a game of pool with a basic game engine...
I have initial cue -> cue ball movement working on mouse click, drag and release using the following code:
where ball[0] is the cue ball, g1 is the instance of the game engine.
Code
double currentPosX = (balls[0].getXPosition());
double currentPosY = (balls[0].getYPosition());
double mouseSpeedX = (g1.getFirstClickX() - g1.getSecondClickX());
double mouseSpeedY = (g1.getFirstClickY() - g1.getSecondClickY());
balls[0].setXPosition(currentPosX+mouseSpeedX);
balls[0].setYPosition(currentPosY+mouseSpeedY);
However... the movement is static i.e. it will move the ball[0] from point A to point B... I know why, because its only setting the value but i don't know how i can change it...
I want the movement to be fluid so i thought if i devide both the x and y changes by like 20 then set the movements to increase in increments of that value whilst subtracting that value from mouseSpeedX and mouseSpeedY until they reach 0???
opinions / help would be appreciated
