Story Screen - UQcsse3200/2023-studio-3 GitHub Wiki

Introduction

The story screen describes the premise of the game. image

Development

The story screen uses a basic screen model that includes:

  • show()
  • render()
  • resize()
  • dispose()

Using AnimatedText class we can animate the text, and using table we can add and position all the buttons and text.

@Override
    public void show() {
        batch = new SpriteBatch();
        introImage = new Texture(TEXTURE);
        introSprite = new Sprite(introImage);
        introSprite.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

        stage = new Stage(new ScreenViewport());
        Gdx.input.setInputProcessor(stage);

        Skin skin = new Skin(Gdx.files.internal("flat-earth/skin/flat-earth-ui.json"));
        continueButton = new TextButton("Continue", skin);
        continueButton.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                game.setScreen(GdxGame.ScreenType.LEVEL_SELECT);
            }

        });

        Table table = new Table();
        table.setFillParent(true);
        table.add(continueButton).padBottom(-400).row();
        stage.addActor(table);
    }

Test Plan

Due to the state of UI, it cannot be directly JUNIT/mockito tested. Here is a test plan for the screen:

  • Background appears.
  • Text correctly displays and animates
  • Clicking continue takes you to the level select screen

The test was manually conducted 3 times, all tests passed.