Commit 35f2efa4 authored by Vitaliy Vashchenko's avatar Vitaliy Vashchenko

Merge branch 'feature-tweezers-animation' into 'V3.7'

Tweezers animation

See merge request !748
parents c0eadca5 9267e63b
...@@ -32,6 +32,7 @@ public class SafeAssets { ...@@ -32,6 +32,7 @@ public class SafeAssets {
private static final String MEDIUM = "medium/"; private static final String MEDIUM = "medium/";
private static final String HARD = "hard/"; private static final String HARD = "hard/";
private static final String BONUS = "bonus/"; private static final String BONUS = "bonus/";
private static final String TWEEZERS = "tweezers/";
private static final String LIGHTS = "lights/"; private static final String LIGHTS = "lights/";
private static final String VISUALIZATION = "visualization/"; private static final String VISUALIZATION = "visualization/";
private static final String ALPHABET = "alphabet/"; private static final String ALPHABET = "alphabet/";
...@@ -116,7 +117,6 @@ public class SafeAssets { ...@@ -116,7 +117,6 @@ public class SafeAssets {
public static final String MEDIUM_HARD_LIGHT4_GREY = GFX_PATH + LIGHTS + "4grey"; public static final String MEDIUM_HARD_LIGHT4_GREY = GFX_PATH + LIGHTS + "4grey";
//======== SAFE BONUS ============= //======== SAFE BONUS =============
public static final String TWEEZERS = GFX_PATH + BONUS + "tweezers";
public static final String BOOM = GFX_PATH + BONUS + "boom"; public static final String BOOM = GFX_PATH + BONUS + "boom";
public static final String BONUS_BACKGROUND = GFX_PATH + BONUS + "background"; public static final String BONUS_BACKGROUND = GFX_PATH + BONUS + "background";
...@@ -158,6 +158,9 @@ public class SafeAssets { ...@@ -158,6 +158,9 @@ public class SafeAssets {
public static final String BONUS_LIGHT4_BLUE = GFX_PATH + BONUS + LIGHTS + "light4_blue"; 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 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";
//======== TEXTS ============= //======== TEXTS =============
public static final String REPLAY_TEXT = "game_safe_replay"; public static final String REPLAY_TEXT = "game_safe_replay";
public static final String SCORE_TEXT = "score"; public static final String SCORE_TEXT = "score";
......
...@@ -42,7 +42,7 @@ import cz.nic.tablexia.screen.AbstractTablexiaScreen; ...@@ -42,7 +42,7 @@ import cz.nic.tablexia.screen.AbstractTablexiaScreen;
public class BonusCableGroup extends Group { public class BonusCableGroup extends Group {
public static final int TWEEZERS_WIDTH = 284; public static final int TWEEZERS_WIDTH = 284;
public static final int TWEEZERS_HEIGHT = 179; public static final int TWEEZERS_HEIGHT = 228;
private Image finalSocket; private Image finalSocket;
private SafeGame safeGame; private SafeGame safeGame;
...@@ -118,18 +118,32 @@ public class BonusCableGroup extends Group { ...@@ -118,18 +118,32 @@ public class BonusCableGroup extends Group {
} }
public void cut(SequenceAction sa) { public void cut(SequenceAction sa) {
Image tweezers = new Image(safeGame.getScreenTextureRegion(SafeAssets.TWEEZERS)); Image tweezers = new Image(safeGame.getScreenTextureRegion(SafeAssets.TWEEZERS1));
tweezers.setSize(TWEEZERS_WIDTH, TWEEZERS_HEIGHT); tweezers.setSize(TWEEZERS_WIDTH, TWEEZERS_HEIGHT);
float tweezersXPos = cable.getX() + cable.getWidth(); float tweezersXPos = cable.getX() + cable.getWidth();
float tweezersYPos = cable.getY() - tweezers.getHeight()/2 + 20; float tweezersYPos = cable.getY() + cable.getHeight()/2 - tweezers.getHeight()/2;
tweezers.setPosition(tweezersXPos, tweezersYPos); tweezers.setPosition(tweezersXPos, tweezersYPos);
addActor(tweezers); 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() { sa.addAction(Actions.sequence(Actions.run(new Runnable() {
@Override @Override
public void run() { public void run() {
tweezers.addAction(Actions.moveTo(tweezersXPos - cable.getWidth()/2, tweezersYPos, 1f)); tweezers.addAction(Actions.moveTo(tweezersXPos - cable.getWidth()/2 - 10, tweezersYPos, 1f));
} }
}), Actions.delay(1f),Actions.run(new Runnable() { }), Actions.delay(1f),
tweezersAnimation,
Actions.run(new Runnable() {
@Override @Override
public void run() { public void run() {
cable.setDrawable(new TextureRegionDrawable(cutCableImage)); cable.setDrawable(new TextureRegionDrawable(cutCableImage));
......
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