v2.5.0: added a panning function to region backgrounds in portrait
This commit is contained in:
@@ -90,7 +90,9 @@ public class InterlevelScene extends PixelScene {
|
||||
}
|
||||
private Phase phase;
|
||||
private float timeLeft;
|
||||
|
||||
|
||||
public Image background;
|
||||
|
||||
private RenderedTextBlock loadingText;
|
||||
|
||||
private RenderedTextBlock storyMessage;
|
||||
@@ -213,7 +215,7 @@ public class InterlevelScene extends PixelScene {
|
||||
fadeTime = 0f;
|
||||
}
|
||||
|
||||
Image background = new Image(loadingAsset);
|
||||
background = new Image(loadingAsset);
|
||||
background.scale.set(Camera.main.height/background.height);
|
||||
|
||||
if (Camera.main.width >= background.width()){
|
||||
@@ -274,7 +276,7 @@ public class InterlevelScene extends PixelScene {
|
||||
|
||||
storyBG = new ShadowBox();
|
||||
storyBG.boxRect(storyMessage.left()-10, storyMessage.top()-10, storyMessage.width()+20, storyMessage.height()+20);
|
||||
storyBG.alpha(0.75f);
|
||||
storyBG.alpha(0.8f);
|
||||
add(storyBG);
|
||||
add(storyMessage);
|
||||
|
||||
@@ -304,7 +306,7 @@ public class InterlevelScene extends PixelScene {
|
||||
protected void updateValues(float progress) {
|
||||
float uiAlpha = progress;
|
||||
btnContinue.alpha(uiAlpha);
|
||||
storyBG.alpha(uiAlpha*0.75f);
|
||||
storyBG.alpha(uiAlpha*0.8f);
|
||||
storyMessage.alpha(uiAlpha);
|
||||
btnHideStory.icon().alpha(uiAlpha);
|
||||
loadingText.alpha(uiAlpha);
|
||||
@@ -336,7 +338,7 @@ public class InterlevelScene extends PixelScene {
|
||||
protected void updateValues(float progress) {
|
||||
float uiAlpha = 1 - progress;
|
||||
btnContinue.alpha(uiAlpha);
|
||||
storyBG.alpha(uiAlpha * 0.75f);
|
||||
storyBG.alpha(uiAlpha * 0.8f);
|
||||
storyMessage.alpha(uiAlpha);
|
||||
icon.alpha(uiAlpha);
|
||||
loadingText.alpha(uiAlpha);
|
||||
@@ -360,7 +362,7 @@ public class InterlevelScene extends PixelScene {
|
||||
protected void updateValues(float progress) {
|
||||
float uiAlpha = progress;
|
||||
btnContinue.alpha(uiAlpha);
|
||||
storyBG.alpha(uiAlpha*0.75f);
|
||||
storyBG.alpha(uiAlpha*0.8f);
|
||||
storyMessage.alpha(uiAlpha);
|
||||
icon.alpha(uiAlpha);
|
||||
loadingText.alpha(uiAlpha);
|
||||
@@ -488,12 +490,15 @@ public class InterlevelScene extends PixelScene {
|
||||
break;
|
||||
|
||||
case FADE_OUT:
|
||||
background.acc.set(0);
|
||||
background.speed.set(0);
|
||||
|
||||
loadingText.alpha( Math.min(1, timeLeft+0.333f) );
|
||||
|
||||
if (btnContinue != null){
|
||||
btnContinue.alpha((timeLeft/fadeTime));
|
||||
storyMessage.alpha(btnContinue.alpha());
|
||||
storyBG.alpha(btnContinue.alpha()*0.75f);
|
||||
storyBG.alpha(btnContinue.alpha()*0.8f);
|
||||
btnHideStory.icon().alpha(btnContinue.alpha());
|
||||
}
|
||||
|
||||
@@ -510,7 +515,7 @@ public class InterlevelScene extends PixelScene {
|
||||
if (btnContinue != null && textFadingIn) {
|
||||
btnContinue.alpha(Math.min(1, btnContinue.alpha() + Game.elapsed));
|
||||
storyMessage.alpha(btnContinue.alpha());
|
||||
storyBG.alpha(btnContinue.alpha()*0.75f);
|
||||
storyBG.alpha(btnContinue.alpha()*0.8f);
|
||||
btnHideStory.icon().alpha(btnContinue.alpha());
|
||||
|
||||
if (btnContinue.alpha() == 1){
|
||||
@@ -525,6 +530,21 @@ public class InterlevelScene extends PixelScene {
|
||||
}
|
||||
}
|
||||
|
||||
//slowly pan the background side to side in portait mode, if story text is displayed
|
||||
if (btnContinue != null && !textFadingIn && !landscape()){
|
||||
if (background.speed.isZero() && background.acc.isZero()){
|
||||
background.acc.x = background.center().x > Camera.main.width ? -1f : 1f;
|
||||
} else {
|
||||
background.speed.x = GameMath.gate(-10, background.speed.x, 10);
|
||||
if (background.acc.x > 0 && background.x >= -25){
|
||||
background.acc.x = -2.5f;
|
||||
} else if (background.acc.x < 0 && background.x + background.width() <= Camera.main.width+25){
|
||||
background.acc.x = 2.5f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (error != null) {
|
||||
String errorMsg;
|
||||
if (error instanceof FileNotFoundException) errorMsg = Messages.get(this, "file_not_found");
|
||||
|
||||
Reference in New Issue
Block a user