Android Open Source - ZombieBird Asset Loader






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.ZBHelpers;
/*from   ww  w . j  a va2  s. co  m*/
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class AssetLoader {
  public static Texture texture;
  public static TextureRegion bg, grass;

  public static Animation birdAnimation;
  public static TextureRegion bird, birdDown, birdUp;

  public static TextureRegion skullUp, skullDown, bar;

  public static void load() {
    texture = new Texture(Gdx.files.internal("data/texture.png"));
    texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
    
    bg = new TextureRegion(texture, 0, 0, 136, 43);
    bg.flip(false,  true);
    
    grass = new TextureRegion(texture, 0, 43, 143, 11);
    grass.flip(false, true);
    
    birdDown = new TextureRegion(texture, 136, 0, 17, 12);
    birdDown.flip(false, true);
    
    bird = new TextureRegion(texture, 153, 0, 17, 12);
    bird.flip(false, true);
    
    birdUp = new TextureRegion(texture, 170, 0, 17, 12);
    birdUp.flip(false, true);
    
    TextureRegion[] birds = {birdDown, bird, birdUp};
    birdAnimation = new Animation(0.06f, birds);
    birdAnimation.setPlayMode(Animation.LOOP_PINGPONG);
    
    skullUp = new TextureRegion(texture, 192, 0, 24, 14);
    // Create skullDown by flipping skullUp
    skullDown = new TextureRegion(skullUp);
    skullDown.flip(false, true);
    
    bar = new TextureRegion(texture, 136, 16, 22, 3);
    bar.flip(false, true);
  }

  public static void dispose() {
    // dispose of the texture when we are done with it
    texture.dispose();
  }
}




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