Android Open Source - ZombieBird Game Screen






From Project

Back to project page ZombieBird.

License

The source code is released under:

Apache License

If you think the Android project ZombieBird listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.kilobolt.Screens;
/*w  w w .j  a  va2  s  .c o m*/
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.kilobolt.GameWorld.GameRenderer;
import com.kilobolt.GameWorld.GameWorld;
import com.kilobolt.ZBHelpers.InputHandler;

public class GameScreen implements Screen {

  private GameWorld world;
  private GameRenderer renderer;
  private float runTime = 0;

  public GameScreen() {
    System.out.println("GameScreen Attached");
    
    float screenWidth = Gdx.graphics.getWidth();
    float screenHeight = Gdx.graphics.getHeight();
    float gameWidth = 136;
    float gameHeight = screenHeight / (screenWidth / gameWidth);
    
    int midPointY = (int)(gameHeight / 2);
        
    world = new GameWorld(midPointY); // initialize world
    renderer = new GameRenderer(world, (int)gameHeight, midPointY); // initialize renderer

    Gdx.input.setInputProcessor(new InputHandler(world.getBird()));
  }

  @Override
  public void render(float delta) {
    runTime += delta;
    world.update(delta);
    renderer.render(runTime);
  }

  @Override
  public void resize(int width, int height) {
    System.out.println("GameScreen - resizing");
  }

  @Override
  public void show() {
    System.out.println("GameScreen - show() called");
  }

  @Override
  public void hide() {
    System.out.println("GameScreen - hide() called");
  }

  @Override
  public void pause() {
    System.out.println("GameScreen - pause() called");
  }

  @Override
  public void resume() {
    System.out.println("GameScreen - resume() called");
  }

  @Override
  public void dispose() {
    // Leave blank
  }

}




Java Source Code List

com.kilobolt.GameObjects.Bird.java
com.kilobolt.GameObjects.Grass.java
com.kilobolt.GameObjects.Pipe.java
com.kilobolt.GameObjects.ScrollHandler.java
com.kilobolt.GameObjects.Scrollable.java
com.kilobolt.GameWorld.GameRenderer.java
com.kilobolt.GameWorld.GameWorld.java
com.kilobolt.Screens.GameScreen.java
com.kilobolt.ZBHelpers.AssetLoader.java
com.kilobolt.ZBHelpers.InputHandler.java
com.kilobolt.ZombieBird.MainActivity.java
com.kilobolt.ZombieBird.Main.java
com.kilobolt.ZombieBird.RobovmLauncher.java
com.kilobolt.ZombieBird.ZBGame.java
com.kilobolt.ZombieBird.client.GwtLauncher.java