O'Reilly logo

Learning Libgdx Game Development by Andreas Oehlke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing assets

We are now ready to test our Assets class with the rest of the already built game code.

Add the following two imports to CanyonBunnyMain:

import com.badlogic.gdx.assets.AssetManager;
import com.packtpub.libgdx.canyonbunny.game.Assets;

After that, we add the calls to load, reload, and unload our assets with the following changes to the code:

@Override
public void create () {
  // Set Libgdx log level to DEBUG
  Gdx.app.setLogLevel(Application.LOG_DEBUG);
  // Load assets
  Assets.instance.init(new AssetManager());
  // Initialize controller and renderer
  worldController = new WorldController();
  worldRenderer = new WorldRenderer(worldController);
}

@Override
public void resume () {
  Assets.instance.init(new AssetManager()); paused = false; } @Override ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required