com.sixteencolorgames.sandbox.IntroScreen.java Source code

Java tutorial

Introduction

Here is the source code for com.sixteencolorgames.sandbox.IntroScreen.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sixteencolorgames.sandbox;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;

/**
 *
 * @author Allen
 */
class IntroScreen extends MenuScreen {

    float alpha = .001f;
    float direction = .005f;
    GameLauncher game;

    public IntroScreen(GameLauncher aThis) {
        game = aThis;
    }

    @Override
    public void render(float delta) {
        super.render(delta);
        game.batch.begin();
        game.batch.setColor(1, 1, 1, alpha);
        game.batch.draw(game.textures.get("logo"), 200, 200, 100, 100);
        game.batch.setColor(Color.WHITE);
        game.batch.end();
        alpha += direction;
        if (alpha > 1) {
            direction *= -1;
        }
        if (alpha < 0) {
            game.setScreen(new LoadingScreen(game));
            dispose();
        }
        if (Gdx.input.justTouched()) {
            game.setScreen(new LoadingScreen(game));
            dispose();
        }
    }

}