diff --git a/core/src/com/mygdx/game/PlatVenture.java b/core/src/com/mygdx/game/PlatVenture.java index b8d9b8c54eaa560da55e3b7e057f86aecdc62316..92e501696fd209698c5fa2d6bf81009c1cda1983 100644 --- a/core/src/com/mygdx/game/PlatVenture.java +++ b/core/src/com/mygdx/game/PlatVenture.java @@ -21,6 +21,8 @@ public class PlatVenture extends ApplicationAdapter { public static final float STEP = 1 /60f; // Pas entre deux images private float accum; + private float compteurIntro = 0; + private boolean hasPassedIntro = false; private SpriteBatch batch; private OrthographicCamera cam; @@ -42,6 +44,7 @@ public class PlatVenture extends ApplicationAdapter { hudCam = new OrthographicCamera(); hudCam.setToOrtho(false, largeur, hauteur); gsm = new GameStateManager(this); + loadContent(); } @Override @@ -50,6 +53,15 @@ public class PlatVenture extends ApplicationAdapter { // update seulement si suffisamment de temps est passé depuis la dernière étape while (accum >= STEP){ + if (compteurIntro < 3){ + compteurIntro += STEP; + }else{ + //compteurIntro = 0; + if (!hasPassedIntro) { + gsm.setState(GameStateManager.PLAY); + hasPassedIntro = true; + } + } accum -= STEP; gsm.update(STEP); gsm.render(); @@ -74,4 +86,23 @@ public class PlatVenture extends ApplicationAdapter { public OrthographicCamera getHudCam() { return hudCam; } + + private void loadContent(){ + res.loadTexture("Platform_J.png", "platJ"); + res.loadTexture("Platform_K.png", "platK"); + res.loadTexture("Platform_L.png", "platL"); + res.loadTexture("Brick_A.png", "brickA"); + res.loadTexture("Brick_B.png", "brickB"); + res.loadTexture("Brick_C.png", "brickC"); + res.loadTexture("Brick_D.png", "brickD"); + res.loadTexture("Brick_E.png", "brickE"); + res.loadTexture("Brick_F.png", "brickF"); + res.loadTexture("Brick_G.png", "brickG"); + res.loadTexture("Brick_H.png", "brickH"); + res.loadTexture("Brick_I.png", "brickI"); + res.loadTexture("Exit_Z.png", "exit"); + res.loadTexture("Back.png", "back"); + res.loadTexture("Idle__000.png", "idle_000"); + res.loadTexture("Water.png", "water"); + } } diff --git a/core/src/etat/WaitingScreen.java b/core/src/etat/WaitingScreen.java new file mode 100644 index 0000000000000000000000000000000000000000..31f286c424ad6a7befab3b8c3a26ec6818857270 --- /dev/null +++ b/core/src/etat/WaitingScreen.java @@ -0,0 +1,44 @@ +package etat; + +import static handlers.B2DVars.PPM; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.GL20; +import com.mygdx.game.PlatVenture; + +import handlers.Content; +import handlers.GameStateManager; + +public class WaitingScreen extends GameState{ + + private Content res; + + public WaitingScreen(GameStateManager gsm) { + super(gsm); + res = new Content(); + res.loadTexture("Intro.png", "intro"); + } + + @Override + public void handleInput() { + + } + + @Override + public void update(float dt) { + + } + + @Override + public void render() { + batch.setProjectionMatrix(cam.combined); + batch.begin(); + batch.draw(res.getTexture("intro"), 0, 0, PlatVenture.largeur, PlatVenture.hauteur); + batch.end(); + } + + @Override + public void dispose() { + + } +} diff --git a/core/src/handlers/GameStateManager.java b/core/src/handlers/GameStateManager.java index 9f7277127f83678df011ed8a6e307af3e2d9a61c..2a0c84043bf36dc6be7f84c2bac9f264314cb379 100644 --- a/core/src/handlers/GameStateManager.java +++ b/core/src/handlers/GameStateManager.java @@ -6,18 +6,20 @@ import java.util.Stack; import etat.GameState; import etat.Play; +import etat.WaitingScreen; public class GameStateManager { private PlatVenture platVenture; private Stack<GameState> gameStates; - public static final int PLAY = 4646; + public static final int PLAY = 1; + public static final int WAIT = 0; public GameStateManager(PlatVenture game){ this.platVenture = game; gameStates = new Stack<GameState>(); - pushState(PLAY); + pushState(WAIT); } public PlatVenture getPlatVenture(){ @@ -36,6 +38,9 @@ public class GameStateManager { if (state == PLAY){ return new Play(this); } + if (state == WAIT){ + return new WaitingScreen(this); + } return null; }