Game Development Reference
In-Depth Information
After this, make the following changes to the same class:
@Override
public void show () {
GamePreferences.instance.load();
worldController = new WorldController(game);
worldRenderer = new WorldRenderer(worldController);
Gdx.input.setCatchBackKey(true);
}
The added code ensures that the game screen will always work with the latest game
settings. Next, add the following import lines to BunnyHead :
import com.packtpub.libgdx.canyonbunny.util.CharacterSkin;
import com.packtpub.libgdx.canyonbunny.util.GamePreferences;
After this, make the following change to the same class:
@Override
public void render (SpriteBatch batch) {
TextureRegion reg = null;
// Apply Skin Color
batch.setColor(
CharacterSkin.values()[GamePreferences.instance.charSkin]
.getColor());
// Set special color when game object has a feather power-up
if (hasFeatherPowerup)
batch.setColor(1.0f, 0.8f, 0.0f, 1.0f);
// Draw image
reg = regHead;
batch.draw(reg.getTexture(),
position.x, position.y,
origin.x, origin.y,
dimension.x, dimension.y,
scale.x, scale.y,
rotation,
reg.getRegionX(), reg.getRegionY(),
reg.getRegionWidth(), reg.getRegionHeight(),
viewDirection == VIEW_DIRECTION.LEFT, false);
// Reset color to white
batch.setColor(1, 1, 1, 1);
}
 
Search WWH ::




Custom Search