January 2015
Beginner to intermediate
478 pages
9h 46m
English
We will now create our own Assets class to organize and structure our assets. First, add a new constant to the Constants class that points to the description file of the texture atlas:
public class Constants {
// Visible game world is 5 meters wide
public static final float VIEWPORT_WIDTH = 5.0f;
// Visible game world is 5 meters tall
public static final float VIEWPORT_HEIGHT = 5.0f;
// Location of description file for texture atlas
public static final String TEXTURE_ATLAS_OBJECTS = "images/canyonbunny.pack";
}Next, create a new file for the Assets class and add the following code:
package com.packtpub.libgdx.canyonbunny.game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.assets.AssetDescriptor; import com.badlogic.gdx.assets.AssetErrorListener; ...
Read now
Unlock full access