public
anonymous / interpolate.java
Created

Interpolation

  • Download Gist
interpolate.java
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
private void interpolate(float interpolation){
xAccum += xSpeed * interpolation;
yAccum += ySpeed * interpolation;
if(xAccum >= 1 || xAccum <= 1){
xPos += (int)xAccum;
xAccum -= (int)xAccum;
}
if(yAccum >= 1 || yAccum <= 1){
yPos += (int)yAccum;
yAccum -= (int)yAccum;
}
bound.setBounds(xPos, yPos, 20, 20);
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.