Intros
This commit is contained in:
parent
fdae895cf9
commit
a7ee3d7de7
5 changed files with 39 additions and 1 deletions
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3 KiB |
BIN
core/assets/textures/level1Intro.png
Normal file
BIN
core/assets/textures/level1Intro.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
BIN
core/assets/textures/level2Intro.png
Normal file
BIN
core/assets/textures/level2Intro.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
|
@ -103,6 +103,8 @@ public class Loading extends AbstractScreen {
|
||||||
app.assets.load("textures/pauseBackground.png", Texture.class);
|
app.assets.load("textures/pauseBackground.png", Texture.class);
|
||||||
app.assets.load("textures/failureBackground.png", Texture.class);
|
app.assets.load("textures/failureBackground.png", Texture.class);
|
||||||
app.assets.load("textures/successBackground.png", Texture.class);
|
app.assets.load("textures/successBackground.png", Texture.class);
|
||||||
|
app.assets.load("textures/level1Intro.png", Texture.class);
|
||||||
|
app.assets.load("textures/level2Intro.png", Texture.class);
|
||||||
app.assets.load("textures/pauseGlow.png", Texture.class);
|
app.assets.load("textures/pauseGlow.png", Texture.class);
|
||||||
app.assets.load("textures/position0.png", Texture.class);
|
app.assets.load("textures/position0.png", Texture.class);
|
||||||
app.assets.load("textures/position1.png", Texture.class);
|
app.assets.load("textures/position1.png", Texture.class);
|
||||||
|
|
|
@ -61,6 +61,12 @@ public class Play extends AbstractScreen {
|
||||||
private Player player;
|
private Player player;
|
||||||
private ArrayList<Platform> platforms = new ArrayList<Platform>();
|
private ArrayList<Platform> platforms = new ArrayList<Platform>();
|
||||||
|
|
||||||
|
// Intro window
|
||||||
|
private boolean isIntro;
|
||||||
|
private Window introWindow;
|
||||||
|
private Image introBackground;
|
||||||
|
private TextButton butProceed;
|
||||||
|
|
||||||
// Pause window
|
// Pause window
|
||||||
private boolean isPaused;
|
private boolean isPaused;
|
||||||
private Window pauseWindow;
|
private Window pauseWindow;
|
||||||
|
@ -96,7 +102,9 @@ public class Play extends AbstractScreen {
|
||||||
b2dCam = new OrthographicCamera();
|
b2dCam = new OrthographicCamera();
|
||||||
b2dCam.setToOrtho(false, Vars.SCREEN_WIDTH / PPM, Vars.SCREEN_HEIGHT / PPM);
|
b2dCam.setToOrtho(false, Vars.SCREEN_WIDTH / PPM, Vars.SCREEN_HEIGHT / PPM);
|
||||||
|
|
||||||
|
isIntro = true;
|
||||||
isPaused = false;
|
isPaused = false;
|
||||||
|
|
||||||
buttonSize = new Vector2(50, 50);
|
buttonSize = new Vector2(50, 50);
|
||||||
|
|
||||||
isEnd = false;
|
isEnd = false;
|
||||||
|
@ -112,13 +120,14 @@ public class Play extends AbstractScreen {
|
||||||
skin.load(Gdx.files.internal("spritesheets/uiskin.json"));
|
skin.load(Gdx.files.internal("spritesheets/uiskin.json"));
|
||||||
|
|
||||||
initLevel();
|
initLevel();
|
||||||
|
initIntroWindow();
|
||||||
initPauseWindow();
|
initPauseWindow();
|
||||||
initEndgameWindow(false);
|
initEndgameWindow(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(float dt) {
|
public void update(float dt) {
|
||||||
if(!isPaused && !isEnd)
|
if(!isPaused && !isEnd && !isIntro)
|
||||||
{
|
{
|
||||||
world.step(dt, 6, 2);
|
world.step(dt, 6, 2);
|
||||||
|
|
||||||
|
@ -185,6 +194,7 @@ public class Play extends AbstractScreen {
|
||||||
|
|
||||||
if(Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE))
|
if(Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE))
|
||||||
{
|
{
|
||||||
|
isPaused = !isPaused;
|
||||||
isPaused = !isPaused;
|
isPaused = !isPaused;
|
||||||
System.out.println("isPaused: " + isPaused);
|
System.out.println("isPaused: " + isPaused);
|
||||||
}
|
}
|
||||||
|
@ -285,6 +295,32 @@ public class Play extends AbstractScreen {
|
||||||
Box2dUtils.makeChain(body, finalV, userData, isSensor, Vars.BIT_MISC, Vars.BIT_PLAYER);
|
Box2dUtils.makeChain(body, finalV, userData, isSensor, Vars.BIT_MISC, Vars.BIT_PLAYER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initIntroWindow()
|
||||||
|
{
|
||||||
|
introWindow = new Window("Level "+levelNumber, skin);
|
||||||
|
introWindow.getTitleLabel().setPosition(350, 500);
|
||||||
|
introBackground = new Image(app.assets.get("textures/level"+levelNumber+"Intro.png", Texture.class));
|
||||||
|
introWindow.setBackground(introBackground.getDrawable());
|
||||||
|
introWindow.setSize(700, 500);
|
||||||
|
introWindow.setPosition(280, 50);
|
||||||
|
introWindow.setVisible(true);
|
||||||
|
|
||||||
|
butProceed = new TextButton("PROCEED", skin, "default");
|
||||||
|
butProceed.setPosition((introWindow.getWidth() / 4) * 3, buttonSize.y + 360);
|
||||||
|
butProceed.setSize(buttonSize.x, buttonSize.y);
|
||||||
|
butProceed.addListener(new ClickListener() {
|
||||||
|
@Override
|
||||||
|
public void clicked(com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, float y) {
|
||||||
|
introWindow.setVisible(false);
|
||||||
|
isIntro = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
introWindow.addActor(butProceed);
|
||||||
|
|
||||||
|
stage.addActor(introWindow);
|
||||||
|
}
|
||||||
|
|
||||||
private void initPauseWindow()
|
private void initPauseWindow()
|
||||||
{
|
{
|
||||||
pauseWindow = new Window("Paused", skin);
|
pauseWindow = new Window("Paused", skin);
|
||||||
|
|
Reference in a new issue