I'm making a pretty basic spaceship game. Every time I update or change a main parameter, that affects others(acceleration, acceleration change speed, direction change speed) then I want to recalculate all parameters.
I have the following parameters at the beginning of the movement:
long currentTime = System.currentTimeMillis();
double timeDelta = (currentTime - lastUpdate) / 1000.0;
lastUpdate = currentTime;
double posX = params.get(Param.POS_X);
double posY = params.get(Param.POS_Y);
double accX = params.get(Param.SPEED_X_PIX_SEC); // ship acceleration x axis.
double accY = params.get(Param.SPEED_Y_PIX_SEC); // ship acceleration y axis.
double dir = params.get(Param.DIRECTION_RAD);
double dirSpeed = params.get(Param.DIRECTION_SPEED_RAD_SEC);
double thrust = params.get(Param.THRUST_PIX_SEC); // acceleration change speed. Depends on direction change.
And now I want to set the parameter values to what they should be after a certain amount of time has passed(timeDelta). Two parameters don't need updating since they are there only to affect other parameters - thrust and dirSpeed.
It would be a piece of cake to figure it out when there would not be any direction change...