Skip to content
Snippets Groups Projects
Commit c45497ba authored by timeo's avatar timeo
Browse files

Waiting screen

parent d02821cb
No related branches found
No related tags found
1 merge request!1Restart
......@@ -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");
}
}
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() {
}
}
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment