Skip to content

Instantly share code, notes, and snippets.

@perky
Created December 20, 2012 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perky/4346777 to your computer and use it in GitHub Desktop.
Save perky/4346777 to your computer and use it in GitHub Desktop.
public void updateArm(TileEntitySynthesis synthesis) {
float horizontalTimer;
float verticalTimer;
float newX;
float newY;
animationTimer += 0.1F;
//ARM UP
if(animationTimer > 0.0F && animationTimer <= 10.0F) {
verticalTimer = animationTimer;
newY = MinechemHelper.translateValue(verticalTimer, 0.0F, 10.0F, 13, 11);
bottomarm.rotationPointY = newY;
}
//ARM RIGHT
if(animationTimer > 10.0F && animationTimer <= 40.0F) {
horizontalTimer = animationTimer - 10;
newX = MinechemHelper.translateValue(horizontalTimer, 0.0F, 30.0F, -6.0F, 3.0F);
toparm.rotationPointX = newX;
bottomarm.rotationPointX = newX;
}
//ARM DOWN
if(animationTimer > 40.0F && animationTimer <= 50.0F) {
verticalTimer = animationTimer - 40;
newY = MinechemHelper.translateValue(verticalTimer, 0.0F, 10.0F, 11, 13);
bottomarm.rotationPointY = newY;
}
//ARM UP
if(animationTimer > 50.0F && animationTimer <= 60.0F) {
verticalTimer = animationTimer - 50;
newY = MinechemHelper.translateValue(verticalTimer, 0.0F, 10.0F, 13, 11);
bottomarm.rotationPointY = newY;
}
//ARM LEFT
if(animationTimer > 60.0F && animationTimer < 90.0F) {
horizontalTimer = animationTimer - 60.0F;
newX = MinechemHelper.translateValue(horizontalTimer, 0.0F, 30.0F, 3.0F, -6.0F);
toparm.rotationPointX = newX;
bottomarm.rotationPointX = newX;
}
//ARM DOWN
if(animationTimer > 90.0F && animationTimer <= 100.0F) {
verticalTimer = animationTimer - 90;
newY = MinechemHelper.translateValue(verticalTimer, 0.0F, 10.0F, 11, 13);
bottomarm.rotationPointY = newY;
}
//RESET TIMER
if(animationTimer > 100) {
animationTimer = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment