Game Development Reference
In-Depth Information
@Override
public void resume() {
}
@Override
public void dispose() {
}
}
The last method that actually does something is the pause() method. Here, we make sure that
the settings are saved to the SD card, because the user can change the sound settings on this
screen.
The Help Screens
We have a total of five help screens, all of which work the same way: load the help screen
image, render it along with the arrow button, and wait for a touch of the arrow button to move
to the next screen. The screens differ only in the image that each loads and the screen to which
each transitions. For this reason, we'll look at the code of the first help screen only, as shown
in Listing 9-7, which transitions to the second help screen. The image files for the help screens
are named help1.png , help2.png , and so on, up to help5.png . The respective screen classes
are called HelpScreen , Help2Screen , and so on. The last screen, Help5Screen , transitions to the
MainMenuScreen again.
Listing 9-7. HelpScreen.java, the First Help Screen
package com.badlogic.androidgames.jumper;
import java.util.List;
import javax.microedition.khronos.opengles.GL10;
import com.badlogic.androidgames.framework.Game;
import com.badlogic.androidgames.framework.Input.TouchEvent;
import com.badlogic.androidgames.framework.gl.Camera2D;
import com.badlogic.androidgames.framework.gl.SpriteBatcher;
import com.badlogic.androidgames.framework.gl.Texture;
import com.badlogic.androidgames.framework.gl.TextureRegion;
import com.badlogic.androidgames.framework.impl.GLScreen;
import com.badlogic.androidgames.framework.math.OverlapTester;
import com.badlogic.androidgames.framework.math.Rectangle;
import com.badlogic.androidgames.framework.math.Vector2;
public class HelpScreen extends GLScreen {
Camera2D guiCam;
SpriteBatcher batcher;
Rectangle nextBounds;
Vector2 touchPoint;
Texture helpImage;
TextureRegion helpRegion;
 
Search WWH ::




Custom Search