Skip to content

Instantly share code, notes, and snippets.

Created June 28, 2012 18:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/3012973 to your computer and use it in GitHub Desktop.
Interpolation
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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment