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 ...
Get Learning Libgdx Game Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.