Game Development Reference
In-Depth Information
Then, add the following new code to the same class:
public AssetBunny bunny;
public AssetRock rock;
public AssetGoldCoin goldCoin;
public AssetFeather feather;
public AssetLevelDecoration levelDecoration;
public void init (AssetManager assetManager) {
this.assetManager = assetManager;
// set asset manager error handler
assetManager.setErrorListener(this);
// load texture atlas
assetManager.load(Constants.TEXTURE_ATLAS_OBJECTS,
TextureAtlas.class);
// start loading assets and wait until finished
assetManager.finishLoading();
Gdx.app.debug(TAG, "# of assets loaded: "
+ assetManager.getAssetNames().size);
for (String a : assetManager.getAssetNames())
Gdx.app.debug(TAG, "asset: " + a);
}
TextureAtlas atlas =
assetManager.get(Constants.TEXTURE_ATLAS_OBJECTS);
// enable texture filtering for pixel smoothing
for (Texture t : atlas.getTextures()) {
t.setFilter(TextureFilter.Linear, TextureFilter.Linear);
}
// create game resource objects
bunny = new AssetBunny(atlas);
rock = new AssetRock(atlas);
goldCoin = new AssetGoldCoin(atlas);
feather = new AssetFeather(atlas);
levelDecoration = new AssetLevelDecoration(atlas);
}
 
Search WWH ::




Custom Search