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 Phase phase;
|
||||||
private float timeLeft;
|
private float timeLeft;
|
||||||
|
|
||||||
|
public Image background;
|
||||||
|
|
||||||
private RenderedTextBlock loadingText;
|
private RenderedTextBlock loadingText;
|
||||||
|
|
||||||
private RenderedTextBlock storyMessage;
|
private RenderedTextBlock storyMessage;
|
||||||
@@ -213,7 +215,7 @@ public class InterlevelScene extends PixelScene {
|
|||||||
fadeTime = 0f;
|
fadeTime = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
Image background = new Image(loadingAsset);
|
background = new Image(loadingAsset);
|
||||||
background.scale.set(Camera.main.height/background.height);
|
background.scale.set(Camera.main.height/background.height);
|
||||||
|
|
||||||
if (Camera.main.width >= background.width()){
|
if (Camera.main.width >= background.width()){
|
||||||
@@ -274,7 +276,7 @@ public class InterlevelScene extends PixelScene {
|
|||||||
|
|
||||||
storyBG = new ShadowBox();
|
storyBG = new ShadowBox();
|
||||||
storyBG.boxRect(storyMessage.left()-10, storyMessage.top()-10, storyMessage.width()+20, storyMessage.height()+20);
|
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(storyBG);
|
||||||
add(storyMessage);
|
add(storyMessage);
|
||||||
|
|
||||||
@@ -304,7 +306,7 @@ public class InterlevelScene extends PixelScene {
|
|||||||
protected void updateValues(float progress) {
|
protected void updateValues(float progress) {
|
||||||
float uiAlpha = progress;
|
float uiAlpha = progress;
|
||||||
btnContinue.alpha(uiAlpha);
|
btnContinue.alpha(uiAlpha);
|
||||||
storyBG.alpha(uiAlpha*0.75f);
|
storyBG.alpha(uiAlpha*0.8f);
|
||||||
storyMessage.alpha(uiAlpha);
|
storyMessage.alpha(uiAlpha);
|
||||||
btnHideStory.icon().alpha(uiAlpha);
|
btnHideStory.icon().alpha(uiAlpha);
|
||||||
loadingText.alpha(uiAlpha);
|
loadingText.alpha(uiAlpha);
|
||||||
@@ -336,7 +338,7 @@ public class InterlevelScene extends PixelScene {
|
|||||||
protected void updateValues(float progress) {
|
protected void updateValues(float progress) {
|
||||||
float uiAlpha = 1 - progress;
|
float uiAlpha = 1 - progress;
|
||||||
btnContinue.alpha(uiAlpha);
|
btnContinue.alpha(uiAlpha);
|
||||||
storyBG.alpha(uiAlpha * 0.75f);
|
storyBG.alpha(uiAlpha * 0.8f);
|
||||||
storyMessage.alpha(uiAlpha);
|
storyMessage.alpha(uiAlpha);
|
||||||
icon.alpha(uiAlpha);
|
icon.alpha(uiAlpha);
|
||||||
loadingText.alpha(uiAlpha);
|
loadingText.alpha(uiAlpha);
|
||||||
@@ -360,7 +362,7 @@ public class InterlevelScene extends PixelScene {
|
|||||||
protected void updateValues(float progress) {
|
protected void updateValues(float progress) {
|
||||||
float uiAlpha = progress;
|
float uiAlpha = progress;
|
||||||
btnContinue.alpha(uiAlpha);
|
btnContinue.alpha(uiAlpha);
|
||||||
storyBG.alpha(uiAlpha*0.75f);
|
storyBG.alpha(uiAlpha*0.8f);
|
||||||
storyMessage.alpha(uiAlpha);
|
storyMessage.alpha(uiAlpha);
|
||||||
icon.alpha(uiAlpha);
|
icon.alpha(uiAlpha);
|
||||||
loadingText.alpha(uiAlpha);
|
loadingText.alpha(uiAlpha);
|
||||||
@@ -488,12 +490,15 @@ public class InterlevelScene extends PixelScene {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FADE_OUT:
|
case FADE_OUT:
|
||||||
|
background.acc.set(0);
|
||||||
|
background.speed.set(0);
|
||||||
|
|
||||||
loadingText.alpha( Math.min(1, timeLeft+0.333f) );
|
loadingText.alpha( Math.min(1, timeLeft+0.333f) );
|
||||||
|
|
||||||
if (btnContinue != null){
|
if (btnContinue != null){
|
||||||
btnContinue.alpha((timeLeft/fadeTime));
|
btnContinue.alpha((timeLeft/fadeTime));
|
||||||
storyMessage.alpha(btnContinue.alpha());
|
storyMessage.alpha(btnContinue.alpha());
|
||||||
storyBG.alpha(btnContinue.alpha()*0.75f);
|
storyBG.alpha(btnContinue.alpha()*0.8f);
|
||||||
btnHideStory.icon().alpha(btnContinue.alpha());
|
btnHideStory.icon().alpha(btnContinue.alpha());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -510,7 +515,7 @@ public class InterlevelScene extends PixelScene {
|
|||||||
if (btnContinue != null && textFadingIn) {
|
if (btnContinue != null && textFadingIn) {
|
||||||
btnContinue.alpha(Math.min(1, btnContinue.alpha() + Game.elapsed));
|
btnContinue.alpha(Math.min(1, btnContinue.alpha() + Game.elapsed));
|
||||||
storyMessage.alpha(btnContinue.alpha());
|
storyMessage.alpha(btnContinue.alpha());
|
||||||
storyBG.alpha(btnContinue.alpha()*0.75f);
|
storyBG.alpha(btnContinue.alpha()*0.8f);
|
||||||
btnHideStory.icon().alpha(btnContinue.alpha());
|
btnHideStory.icon().alpha(btnContinue.alpha());
|
||||||
|
|
||||||
if (btnContinue.alpha() == 1){
|
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) {
|
if (error != null) {
|
||||||
String errorMsg;
|
String errorMsg;
|
||||||
if (error instanceof FileNotFoundException) errorMsg = Messages.get(this, "file_not_found");
|
if (error instanceof FileNotFoundException) errorMsg = Messages.get(this, "file_not_found");
|
||||||
|
|||||||
Reference in New Issue
Block a user