Commit 3d43bebf authored by Vitaliy Vashchenko's avatar Vitaliy Vashchenko

Merge branch 'feature-safe-cable-assets' into 'V3.7'

Cable assets game Safe

See merge request !751
parents 35f2efa4 92abe518
Pipeline #42205 passed with stages
in 23 minutes and 47 seconds
......@@ -44,6 +44,7 @@ public class BonusCableGroup extends Group {
public static final int TWEEZERS_WIDTH = 284;
public static final int TWEEZERS_HEIGHT = 228;
private int id;
private Image finalSocket;
private SafeGame safeGame;
private SafeLightImage lightImage;
......@@ -61,6 +62,7 @@ public class BonusCableGroup extends Group {
String lightGrey, String lightRed, String lightGreen, String lightBlue, float lightSize,
Music lightSound, List<SafeLightImage> listOfLights, String lightName) {
this.setDebug(true);
this.id = id;
this.safeGame = safeGame;
this.cutCableImage = cutCableImage;
......@@ -117,11 +119,37 @@ public class BonusCableGroup extends Group {
lightImage.clearListeners();
}
private float getCableCutX() {
switch (id) {
case 0:
return cable.getWidth() / 2 + 20;
case 1:
return cable.getWidth() / 2 + 30;
case 2:
return cable.getWidth() / 2 + 25;
default:
return cable.getWidth() / 2 + 10;
}
}
private float getCableCutY() {
switch (id) {
case 0:
return cable.getHeight()/2 - TWEEZERS_HEIGHT/2;
case 1:
return cable.getHeight()/2 - TWEEZERS_HEIGHT/2 - 30;
case 2:
return cable.getHeight()/2 - TWEEZERS_HEIGHT/2;
default:
return cable.getHeight()/2 - TWEEZERS_HEIGHT/2 - 10;
}
}
public void cut(SequenceAction sa) {
Image tweezers = new Image(safeGame.getScreenTextureRegion(SafeAssets.TWEEZERS1));
tweezers.setSize(TWEEZERS_WIDTH, TWEEZERS_HEIGHT);
float tweezersXPos = cable.getX() + cable.getWidth();
float tweezersYPos = cable.getY() + cable.getHeight()/2 - tweezers.getHeight()/2;
float tweezersYPos = cable.getY() + getCableCutY();
tweezers.setPosition(tweezersXPos, tweezersYPos);
addActor(tweezers);
SequenceAction tweezersAnimation = Actions.sequence();;
......@@ -139,7 +167,7 @@ public class BonusCableGroup extends Group {
sa.addAction(Actions.sequence(Actions.run(new Runnable() {
@Override
public void run() {
tweezers.addAction(Actions.moveTo(tweezersXPos - cable.getWidth()/2 - 10, tweezersYPos, 1f));
tweezers.addAction(Actions.moveTo(tweezersXPos - getCableCutX(), tweezersYPos, 1f));
}
}), Actions.delay(1f),
tweezersAnimation,
......
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