Commit f72d4211 authored by Aneta Steimarova's avatar Aneta Steimarova

#953 Refactoring tweezers animation

parent eaa39454
......@@ -158,14 +158,8 @@ public class SafeAssets {
public static final String BONUS_LIGHT4_BLUE = GFX_PATH + BONUS + LIGHTS + "light4_blue";
public static final String BONUS_LIGHT4_GREY = GFX_PATH + BONUS + LIGHTS + "light4_grey";
public static final String TWEEZERS_NAME = GFX_PATH + BONUS + TWEEZERS + "tweezers";
public static final String TWEEZERS1 = GFX_PATH + BONUS + TWEEZERS + "tweezers1";
public static final String TWEEZERS2 = GFX_PATH + BONUS + TWEEZERS + "tweezers2";
public static final String TWEEZERS3 = GFX_PATH + BONUS + TWEEZERS + "tweezers3";
public static final String TWEEZERS4 = GFX_PATH + BONUS + TWEEZERS + "tweezers4";
public static final String TWEEZERS5 = GFX_PATH + BONUS + TWEEZERS + "tweezers5";
public static final String TWEEZERS6 = GFX_PATH + BONUS + TWEEZERS + "tweezers6";
public static final String TWEEZERS7 = GFX_PATH + BONUS + TWEEZERS + "tweezers7";
public static final String TWEEZERS8 = GFX_PATH + BONUS + TWEEZERS + "tweezers8";
//======== TEXTS =============
public static final String REPLAY_TEXT = "game_safe_replay";
......
......@@ -124,53 +124,25 @@ public class BonusCableGroup extends Group {
float tweezersYPos = cable.getY() - tweezers.getHeight()/2 + 30;
tweezers.setPosition(tweezersXPos, tweezersYPos);
addActor(tweezers);
SequenceAction tweezersAnimation = Actions.sequence();;
for(int i=2; i<9; i++){
String assetName = SafeAssets.TWEEZERS_NAME + i;
tweezersAnimation.addAction(Actions.run(new Runnable() {
@Override
public void run() {
tweezers.setDrawable(new TextureRegionDrawable(safeGame.getScreenTextureRegion(assetName)));
}
}));
tweezersAnimation.addAction(Actions.delay(0.1f));
}
sa.addAction(Actions.sequence(Actions.run(new Runnable() {
@Override
public void run() {
tweezers.addAction(Actions.moveTo(tweezersXPos - cable.getWidth()/2, tweezersYPos, 1f));
}
}), Actions.run(new Runnable() {
@Override
public void run() {
tweezers.setDrawable(new TextureRegionDrawable(safeGame.getScreenTextureRegion(SafeAssets.TWEEZERS2)));
}
}), Actions.delay(1f),
Actions.run(new Runnable() {
@Override
public void run() {
tweezers.setDrawable(new TextureRegionDrawable(safeGame.getScreenTextureRegion(SafeAssets.TWEEZERS3)));
}
}), Actions.delay(0.1f),
Actions.run(new Runnable() {
@Override
public void run() {
tweezers.setDrawable(new TextureRegionDrawable(safeGame.getScreenTextureRegion(SafeAssets.TWEEZERS4)));
}
}), Actions.delay(0.1f),
Actions.run(new Runnable() {
@Override
public void run() {
tweezers.setDrawable(new TextureRegionDrawable(safeGame.getScreenTextureRegion(SafeAssets.TWEEZERS5)));
}
}), Actions.delay(0.1f),
Actions.run(new Runnable() {
@Override
public void run() {
tweezers.setDrawable(new TextureRegionDrawable(safeGame.getScreenTextureRegion(SafeAssets.TWEEZERS6)));
}
}), Actions.delay(0.1f),
Actions.run(new Runnable() {
@Override
public void run() {
tweezers.setDrawable(new TextureRegionDrawable(safeGame.getScreenTextureRegion(SafeAssets.TWEEZERS7)));
}
}), Actions.delay(0.1f),
Actions.run(new Runnable() {
@Override
public void run() {
tweezers.setDrawable(new TextureRegionDrawable(safeGame.getScreenTextureRegion(SafeAssets.TWEEZERS8)));
}
}), Actions.delay(0.1f),
tweezersAnimation,
Actions.run(new Runnable() {
@Override
public void run() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment