Hello,
I hope I m not too annoying with all my questions… :mrgreen:
I m going through the first tutorial (about Flag Rush) and I m stuck again…
The problem seems to come from the update method. I ve already written the rest.
@Override
protected void update(float interpolation) {
timer.update();
interpolation = timer.getTimePerFrame();
//if escape was pressed, we exit
if (KeyBindingManager.getKeyBindingManager().isValidCommand("exit")) {
finished = true;
}
}
When I execute the "game", I get the settings dialog, and then, a black screen (the game) and no sphere that directly shuts down. The console gives me a NullPointerException in the update method.
I think the problem comes from the timer, because if I put the first two lines in comments, I get a nice black screen with my textured sphere in the center.
I really dont know how to fix that...
Anyways here s the complete code:
package flag_rush;
import com.jme.app.BaseGame;
import com.jme.bounding.BoundingSphere;
import com.jme.image.Texture;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.shape.Sphere;
import com.jme.scene.state.TextureState;
import com.jme.system.DisplaySystem;
import com.jme.system.JmeException;
import com.jme.util.TextureManager;
import com.jme.util.Timer;
/**
*
* @author BAROZFR4
*/
public class Game extends BaseGame {
protected int width, height, depth, freq;
protected boolean fullscreen;
protected Camera cam ;
protected Timer timer;
private Node scene;
private TextureState textState;
@Override
protected void initSystem() {
//Propri