Skip to content
Create a gist now

Instantly share code, notes, and snippets.

anonymous /interpolate.java
Created Jun 28, 2012

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
Something went wrong with that request. Please try again.