Problem in loop

This is the code:

[java]public ActionListener actionListener = new ActionListener()

{

public void onAction(String name, boolean keyPressed, float tpf)

{



if (name.equals(“Pause”)) {

if(keyPressed){

isRunning = !isRunning;

if (isRunning) {

nifty.removeScreen(“start”);

mouseInput.setCursorVisible(false);

flyCam.setEnabled(true);





}



else {

mouseInput.setCursorVisible(true);

pause();

flyCam.setEnabled(false);



}

}





}

if ((name.equals(“Space”)) && (keyPressed)) {

physicsCharacter.jump();

}

}

};[/java]

I’ve integrated character movement from wiki,and I have some problems.The pause menu work,but when I press “space”,then I try to enter in pause menu,it’s trigered automaticaly pause().How to avoid this?

  1. you dont have “if (isRunning)” in physicsCharacter.jump();

    2)

    [java]

    public ActionListener actionListener = new ActionListener()

    {

    public void onAction(String name, boolean keyPressed, float tpf)

    {

    if (name.equals(“Pause”)&&keyPressed)

    {

    if (isPaused)

    {

    nifty.removeScreen(“start”);

    mouseInput.setCursorVisible(false);

    flyCam.setEnabled(true);

    isPaused = false;

    }

    else

    {

    mouseInput.setCursorVisible(true);

    pause();

    flyCam.setEnabled(false);

    isPaused = true;

    }

    }

    if ((name.equals(“Space”)) && (keyPressed) && !isPaused)

    {

    physicsCharacter.jump();

    }

    }

    };

    [/java]

Don’t work,the same.

Maybe there is something else:

[java]import com.jme3.app.SimpleApplication;

import com.jme3.asset.plugins.ZipLocator;

import com.jme3.audio.AudioNode;

import com.jme3.bullet.BulletAppState;

import com.jme3.bullet.PhysicsSpace;

import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;

import com.jme3.bullet.control.CharacterControl;

import com.jme3.bullet.objects.PhysicsCharacter;

import com.jme3.input.KeyInput;

import com.jme3.input.controls.ActionListener;

import com.jme3.input.controls.AnalogListener;

import com.jme3.input.controls.KeyTrigger;

import com.jme3.input.controls.MouseButtonTrigger;

import com.jme3.input.controls.Trigger;

import com.jme3.light.DirectionalLight;

import com.jme3.math.Vector3f;

import com.jme3.niftygui.NiftyJmeDisplay;

import com.jme3.renderer.RenderManager;

import com.jme3.scene.Node;

import com.jme3.scene.Spatial;

import com.jme3.shadow.BasicShadowRenderer;

import com.jme3.system.AppSettings;

import com.jme3.texture.Texture;

import com.jme3.util.SkyFactory;

import de.lessvoid.nifty.Nifty;

import de.lessvoid.nifty.controls.CheckBox;

import de.lessvoid.nifty.controls.DropDown;

import de.lessvoid.nifty.render.NiftyImage;

import de.lessvoid.nifty.screen.Screen;

import de.lessvoid.nifty.screen.ScreenController;

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.IOException;

import java.util.Properties;

import java.util.logging.Level;

import java.util.logging.Logger;

import mygame.PhysicsTestHelper;

public class MainGUI extends SimpleApplication

implements ScreenController

{

Nifty nifty;

Screen screen;

boolean start = false;

NiftyJmeDisplay niftyDisplay;

Boolean isRunning = Boolean.valueOf(true);

private DropDown dropDown;

private CheckBox checkBox;

public static boolean fullscreen = false;

public static Properties prop;

private Properties p;

private static MainGUI app = null;

private AudioNode audio_nature;

private CharacterControl physicsCharacter;

public ActionListener actionListener = new ActionListener()

{

public void onAction(String name, boolean keyPressed, float tpf)

{

if (name.equals(“Pause”)&&keyPressed && !isRunning)

{

nifty.removeScreen(“start”);

mouseInput.setCursorVisible(false);

flyCam.setEnabled(true);

isRunning = true;

}

else if (name.equals(“Pause”)&&keyPressed && isRunning){

mouseInput.setCursorVisible(true);

flyCam.setEnabled(false);

isRunning = false;

pause();

}

if ((name.equals(“Space”)) && (keyPressed) && isRunning)

{

physicsCharacter.jump();

isRunning=true;

}

}

};

public static void main(String[] args)

throws FileNotFoundException, IOException

{

app = new MainGUI();

setAppSettings();

app.start();

}

private String playerName;

private String chatLine;

private NiftyImage avatarImage;

private BulletAppState bulletAppState;

public void setupKeys() {

inputManager.addMapping(“Pause”, new Trigger[] { new KeyTrigger(1) });

inputManager.addListener(this.actionListener, new String[] { “Pause” });

inputManager.addMapping(“Space”, new KeyTrigger(KeyInput.KEY_SPACE));

inputManager.addListener(this.actionListener, new String[] { “Space” });

inputManager.addMapping(“Lefts”, new KeyTrigger(KeyInput.KEY_H));

inputManager.addMapping(“Rights”, new KeyTrigger(KeyInput.KEY_K));

inputManager.addMapping(“Ups”, new KeyTrigger(KeyInput.KEY_U));

inputManager.addMapping(“Downs”, new KeyTrigger(KeyInput.KEY_J));

}

public void simpleInitApp()

{

getInputManager().deleteMapping(“SIMPLEAPP_Exit”);

flyCam.setEnabled(false);

this.niftyDisplay = new NiftyJmeDisplay(this.assetManager, this.inputManager, this.audioRenderer, this.guiViewPort);

this.nifty = this.niftyDisplay.getNifty();

this.nifty.fromXml(“Interface/GUI.xml”, “start”, new ScreenController[] { this });

this.guiViewPort.addProcessor(this.niftyDisplay);

initAudio();

}

private PhysicsSpace getPhysicsSpace() {

return bulletAppState.getPhysicsSpace();

}

public void LoadMainGame()

{

audio_nature.stop();

bulletAppState = new BulletAppState();

stateManager.attach(this.bulletAppState);

PhysicsTestHelper.createPhysicsTestWorld(this.rootNode, this.assetManager, this.bulletAppState.getPhysicsSpace());

if (this.settings.getRenderer().startsWith(“LWJGL”)) {

BasicShadowRenderer bsr = new BasicShadowRenderer(this.assetManager, 512);

bsr.setDirection(new Vector3f(-0.5F, -0.3F, -0.3F).normalizeLocal());

this.viewPort.addProcessor(bsr);

flyCam.setEnabled(true);

// Add a physics character to the world

physicsCharacter = new CharacterControl(new CapsuleCollisionShape(0.5f,1.8f), .1f);

physicsCharacter.setPhysicsLocation(new Vector3f(3, 6, 0));

Spatial model = assetManager.loadModel(“Models/Sinbad/Sinbad.mesh.xml”);

model.scale(0.25f);

model.setLocalTranslation(0, 2, 0);

model.addControl(physicsCharacter);

getPhysicsSpace().add(physicsCharacter);

rootNode.attachChild(model);

}

PhysicsTestHelper.createPhysicsTestWorld(this.rootNode, this.assetManager, this.bulletAppState.getPhysicsSpace());

buildSky();

setupKeys();

DirectionalLight dl = new DirectionalLight();

dl.setDirection(new Vector3f(-0.5F, -1.0F, -0.3F).normalizeLocal());

this.rootNode.addLight(dl);

dl = new DirectionalLight();

dl.setDirection(new Vector3f(0.5F, -0.1F, 0.3F).normalizeLocal());

this.rootNode.addLight(dl);

}

public void start2()

{

this.nifty.exit();

System.out.println(“Welcome”);

LoadMainGame();

this.inputManager.setCursorVisible(false);

}

@Override

public void simpleUpdate(float tpf) {

if (this.start);

}

@Override

public void simpleRender(RenderManager rm)

{

}

public void bind(Nifty nifty, Screen screen)

{

this.nifty = nifty;

this.screen = screen;

this.p = prop;

this.dropDown = ((DropDown)screen.findNiftyControl(“dropDown1”, DropDown.class));

if (this.dropDown != null) {

this.dropDown.addItem(" 800 x 600 “);

this.dropDown.addItem(” 1024 x 768 “);

this.dropDown.addItem(” 1280 x 800 “);

this.dropDown.addItem(” 1366 x 768 “);

this.dropDown.selectItem(” " + this.p.getProperty(“reswidth”) + " x " + this.p.getProperty(“resheight”) + " “);

}

this.checkBox = ((CheckBox)screen.findNiftyControl(“checkBox”, CheckBox.class));

if (this.checkBox != null) {

this.checkBox = ((CheckBox)screen.findNiftyControl(“checkBox”, CheckBox.class));

this.checkBox.setChecked(Boolean.getBoolean(this.p.getProperty(“setFullScreen”)));

}

}

public void onStartScreen() {

}

public void onEndScreen() {

}

private void buildSky() {

Texture west = this.assetManager.loadTexture(“Textures/Sky/Lagoon/lagoon_west.jpg”);

Texture east = this.assetManager.loadTexture(“Textures/Sky/Lagoon/lagoon_east.jpg”);

Texture north = this.assetManager.loadTexture(“Textures/Sky/Lagoon/lagoon_north.jpg”);

Texture south = this.assetManager.loadTexture(“Textures/Sky/Lagoon/lagoon_south.jpg”);

Texture up = this.assetManager.loadTexture(“Textures/Sky/Lagoon/lagoon_up.jpg”);

Texture down = this.assetManager.loadTexture(“Textures/Sky/Lagoon/lagoon_down.jpg”);

Spatial sky = SkyFactory.createSky(this.assetManager, west, east, north, south, up, down);

this.rootNode.attachChild(sky);

}

public void exit() {

stop();

}

public void pause() {

nifty.setAlternateKeyForNextLoadXml(“fade”);

this.nifty.fromXml(“Interface/pause.xml”, “start”);

}

public void SettingsOK() {

String resWidth = null;

String resHeight = null;

this.dropDown = ((DropDown)this.screen.findNiftyControl(“dropDown1”, DropDown.class));

String resValue = (String)this.dropDown.getSelection();

if (resValue.equals(” 800 x 600 “)) {

resWidth = “800”;

resHeight = “600”;

} else if (resValue.equals(” 1024 x 768 “)) {

resWidth = “1024”;

resHeight = “768”;

} else if (resValue.equals(” 1280 x 800 “)) {

resWidth = “1280”;

resHeight = “800”;

}

else if (resValue.equals(” 1366 x 768 ")) {

resWidth = “1366”;

resHeight = “768”;

}

this.p.setProperty(“reswidth”, resWidth);

this.p.setProperty(“resheight”, resHeight);

this.checkBox = ((CheckBox)this.screen.findNiftyControl(“checkBox”, CheckBox.class));

this.p.setProperty(“fullscreen”, Boolean.toString(this.checkBox.isChecked()));

FileOutputStream out = null;

try {

out = new FileOutputStream(“settings.properties”);

this.p.store(out, “”);

out.close();

} catch (FileNotFoundException ex) {

Logger.getLogger(MainGUI.class.getName()).log(Level.SEVERE, null, ex);

} catch (IOException ex) {

Logger.getLogger(MainGUI.class.getName()).log(Level.SEVERE, null, ex);

}

this.nifty.setAlternateKeyForNextLoadXml(“fade”);

this.nifty.fromXml(“Interface/GUI.xml”, “start”);

}

public void onSettings() {

this.nifty.setAlternateKeyForNextLoadXml(“fade”);

this.nifty.fromXml(“Interface/options.xml”, “start”);

}

private static void setAppSettings() throws FileNotFoundException, IOException {

Properties p = new Properties();

FileInputStream in = new FileInputStream(“settings.properties”);

p.load(in);

in.close();

AppSettings newSettings = new AppSettings(true);

newSettings.setFrameRate(Integer.parseInt(p.getProperty(“framerate”)));

newSettings.setFullscreen(Boolean.parseBoolean(p.getProperty(“fullscreen”)));

newSettings.setResolution(Integer.parseInt(p.getProperty(“reswidth”)), Integer.parseInt(p.getProperty(“resheight”)));

fullscreen = Boolean.parseBoolean(p.getProperty(“fullscreen”));

prop = p;

app.setSettings(newSettings);

app.setShowSettings(false);

}

public void chat() {

this.nifty.setAlternateKeyForNextLoadXml(“fade”);

this.nifty.fromXml(“Interface/chat.xml”, “start”);

}

private void initAudio() {

/* gun shot sound is to be triggered by a mouse click. /

/
nature sound - keeps playing in a loop. */

this.assetManager.registerLocator(“data/test.zip”, ZipLocator.class.getName());

audio_nature = new AudioNode(audioRenderer, assetManager, “Loveshadow_-_Almost_Given_Up.ogg”);

audio_nature.setLooping(true);

audio_nature.setPositional(true);

audio_nature.setLocalTranslation(Vector3f.ZERO.clone());

audio_nature.setVolume(3);

audioRenderer.playSource(audio_nature); // play continuously!

}

}[/java]



Or maybe something wrong with pause()

That xml contains a button,if I press that button, exit() is trigerred.

Found a temporar solution:to make a new button,that will trigger the method from first button,and first button it will trigger an inexistent method,and it will be hided(invisible).How I can paint the layer with an transparent color,for example blue?

I have problems with the movement of the character:

[java]import com.jme3.app.SimpleApplication;

import com.jme3.asset.plugins.ZipLocator;

import com.jme3.audio.AudioNode;

import com.jme3.bullet.BulletAppState;

import com.jme3.bullet.PhysicsSpace;

import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;

import com.jme3.bullet.collision.shapes.SphereCollisionShape;

import com.jme3.bullet.control.CharacterControl;

import com.jme3.input.KeyInput;

import com.jme3.input.controls.ActionListener;

import com.jme3.input.controls.KeyTrigger;

import com.jme3.input.controls.Trigger;

import com.jme3.light.DirectionalLight;

import com.jme3.material.Material;

import com.jme3.math.Vector3f;

import com.jme3.niftygui.NiftyJmeDisplay;

import com.jme3.renderer.RenderManager;

import com.jme3.scene.Spatial;

import com.jme3.scene.shape.Sphere;

import com.jme3.scene.shape.Sphere.TextureMode;

import com.jme3.shadow.BasicShadowRenderer;

import com.jme3.system.AppSettings;

import com.jme3.texture.Texture;

import com.jme3.util.SkyFactory;

import de.lessvoid.nifty.Nifty;

import de.lessvoid.nifty.controls.CheckBox;

import de.lessvoid.nifty.controls.DropDown;

import de.lessvoid.nifty.render.NiftyImage;

import de.lessvoid.nifty.screen.Screen;

import de.lessvoid.nifty.screen.ScreenController;

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.IOException;

import java.util.Properties;

import java.util.logging.Level;

import java.util.logging.Logger;

import mygame.PhysicsTestHelper;



public class MainGUI extends SimpleApplication

implements ScreenController

{

Nifty nifty;

Screen screen;

boolean start = false;

NiftyJmeDisplay niftyDisplay;

Boolean isRunning = Boolean.valueOf(false);

private DropDown dropDown;

private CheckBox checkBox;

public static boolean fullscreen = false;

public static Properties prop;

private Properties p;

private static MainGUI app = null;

private AudioNode audio_nature;

public CharacterControl physicsCharacter;

public Vector3f walkDirection = new Vector3f();

private Material mat;

private Sphere bullet;

private SphereCollisionShape bulletCollisionShape;

public ActionListener actionListener = new ActionListener()

{

public void onAction(String name, boolean keyPressed, float tpf)

{

isRunning=!isRunning;



if (name.equals("Pause")&&keyPressed && !isRunning)

{

isRunning=true;

nifty.removeScreen("start");

mouseInput.setCursorVisible(false);

flyCam.setEnabled(true);





}

else if (name.equals("Pause")&&keyPressed && isRunning){



mouseInput.setCursorVisible(true);

isRunning=false;

flyCam.setEnabled(false);

pause();



}

else if ((name.equals("Space")) && (keyPressed) && isRunning)

{

physicsCharacter.jump();





}

else if (name.equals("Lefts")&&(isRunning)) {

if (keyPressed) {

walkDirection.addLocal(new Vector3f(-.1f, 0, 0));

} else {

walkDirection.addLocal(new Vector3f(.1f, 0, 0));

}

} else if (name.equals("Rights")&&(isRunning)) {

if (keyPressed) {

walkDirection.addLocal(new Vector3f(.1f, 0, 0));

} else {

walkDirection.addLocal(new Vector3f(-.1f, 0, 0));

}

} else if (name.equals("Ups")&&(isRunning)) {

if (keyPressed) {

walkDirection.addLocal(new Vector3f(0, 0, -.1f));

} else {

walkDirection.addLocal(new Vector3f(0, 0, .1f));

}

} else if (name.equals("Downs")&&(isRunning)) {

if (keyPressed) {

walkDirection.addLocal(new Vector3f(0, 0, .1f));

} else {

walkDirection.addLocal(new Vector3f(0, 0, -.1f));

}

}



}

};



public static void main(String[] args)

throws FileNotFoundException, IOException

{

app = new MainGUI();

setAppSettings();

app.start();

}

private String playerName;

private String chatLine;

private NiftyImage avatarImage;

private BulletAppState bulletAppState;



public void setupKeys() {

inputManager.addMapping("Pause", new Trigger[] { new KeyTrigger(1) });

inputManager.addListener(this.actionListener, new String[] { "Pause" });

inputManager.addMapping("Space", new KeyTrigger(KeyInput.KEY_SPACE));

inputManager.addListener(this.actionListener, new String[] { "Space" });

inputManager.addMapping("Lefts", new KeyTrigger(KeyInput.KEY_H));

inputManager.addMapping("Rights", new KeyTrigger(KeyInput.KEY_K));

inputManager.addMapping("Ups", new KeyTrigger(KeyInput.KEY_U));

inputManager.addMapping("Downs", new KeyTrigger(KeyInput.KEY_J));

inputManager.addListener(this.actionListener, new String[] { "Lefts" });

inputManager.addListener(this.actionListener, new String[] { "Rights" });

inputManager.addListener(this.actionListener, new String[] { "Ups" });

inputManager.addListener(this.actionListener, new String[] { "Downs" });

}



public void simpleInitApp()

{

getInputManager().deleteMapping("SIMPLEAPP_Exit");



flyCam.setEnabled(false);

this.niftyDisplay = new NiftyJmeDisplay(this.assetManager, this.inputManager, this.audioRenderer, this.guiViewPort);



this.nifty = this.niftyDisplay.getNifty();

this.nifty.fromXml("Interface/GUI.xml", "start", new ScreenController[] { this });



this.guiViewPort.addProcessor(this.niftyDisplay);

initAudio();



}



private PhysicsSpace getPhysicsSpace() {

return bulletAppState.getPhysicsSpace();

}



public void LoadMainGame()

{

audio_nature.stop();

bulletAppState = new BulletAppState();

stateManager.attach(this.bulletAppState);

bullet = new Sphere(32, 32, 0.4f, true, false);

bullet.setTextureMode(TextureMode.Projected);

bulletCollisionShape = new SphereCollisionShape(0.4f);

PhysicsTestHelper.createPhysicsTestWorld(this.rootNode, this.assetManager, this.bulletAppState.getPhysicsSpace());



if (this.settings.getRenderer().startsWith("LWJGL")) {

BasicShadowRenderer bsr = new BasicShadowRenderer(this.assetManager, 512);

bsr.setDirection(new Vector3f(-0.5F, -0.3F, -0.3F).normalizeLocal());

this.viewPort.addProcessor(bsr);

flyCam.setEnabled(true);



// Add a physics character to the world

physicsCharacter = new CharacterControl(new CapsuleCollisionShape(0.5f,1.8f), .1f);

physicsCharacter.setPhysicsLocation(new Vector3f(3, 6, 0));



Spatial model = assetManager.loadModel("Models/Sinbad/Sinbad.mesh.xml");

model.scale(0.25f);

model.setLocalTranslation(0, 2, 0);

model.addControl(physicsCharacter);

getPhysicsSpace().add(physicsCharacter);

rootNode.attachChild(model);

}



PhysicsTestHelper.createPhysicsTestWorld(this.rootNode, this.assetManager, this.bulletAppState.getPhysicsSpace());



buildSky();

setupKeys();



DirectionalLight dl = new DirectionalLight();

dl.setDirection(new Vector3f(-0.5F, -1.0F, -0.3F).normalizeLocal());

this.rootNode.addLight(dl);



dl = new DirectionalLight();

dl.setDirection(new Vector3f(0.5F, -0.1F, 0.3F).normalizeLocal());

this.rootNode.addLight(dl);

}



public void start2()

{

this.nifty.exit();

System.out.println("Welcome");

LoadMainGame();

this.inputManager.setCursorVisible(false);



}



@Override

public void simpleUpdate(float tpf) {

if (start){

physicsCharacter.setWalkDirection(walkDirection);

physicsCharacter.setViewDirection(walkDirection);

cam.lookAt(physicsCharacter.getPhysicsLocation(), Vector3f.UNIT_Y);

}



}



@Override

public void simpleRender(RenderManager rm)

{

}



public void bind(Nifty nifty, Screen screen)

{

this.nifty = nifty;

this.screen = screen;

this.p = prop;

this.dropDown = ((DropDown)screen.findNiftyControl("dropDown1", DropDown.class));

if (this.dropDown != null) {

this.dropDown.addItem(" 800 x 600 ");

this.dropDown.addItem(" 1024 x 768 ");

this.dropDown.addItem(" 1280 x 800 ");

this.dropDown.addItem(" 1366 x 768 ");

this.dropDown.selectItem(" " + this.p.getProperty("reswidth") + " x " + this.p.getProperty("resheight") + " ");

}



this.checkBox = ((CheckBox)screen.findNiftyControl("checkBox", CheckBox.class));

if (this.checkBox != null) {

this.checkBox = ((CheckBox)screen.findNiftyControl("checkBox", CheckBox.class));

this.checkBox.setChecked(Boolean.getBoolean(this.p.getProperty("setFullScreen")));

}

}



public void onStartScreen() {

}



public void onEndScreen() {

}



private void buildSky() {

Texture west = this.assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg");

Texture east = this.assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg");

Texture north = this.assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg");

Texture south = this.assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg");

Texture up = this.assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg");

Texture down = this.assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg");

Spatial sky = SkyFactory.createSky(this.assetManager, west, east, north, south, up, down);

this.rootNode.attachChild(sky);

}



public void exit() {

stop();

}

public void pause() {

nifty.setAlternateKeyForNextLoadXml("fade");

nifty.fromXml("Interface/pause.xml", "start");

}

public void SettingsOK() {

String resWidth = null;

String resHeight = null;

this.dropDown = ((DropDown)this.screen.findNiftyControl("dropDown1", DropDown.class));

String resValue = (String)this.dropDown.getSelection();

if (resValue.equals(" 800 x 600 ")) {

resWidth = "800";

resHeight = "600";

} else if (resValue.equals(" 1024 x 768 ")) {

resWidth = "1024";

resHeight = "768";

} else if (resValue.equals(" 1280 x 800 ")) {

resWidth = "1280";

resHeight = "800";

}

else if (resValue.equals(" 1366 x 768 ")) {

resWidth = "1366";

resHeight = "768";

}

this.p.setProperty("reswidth", resWidth);

this.p.setProperty("resheight", resHeight);

this.checkBox = ((CheckBox)this.screen.findNiftyControl("checkBox", CheckBox.class));

this.p.setProperty("fullscreen", Boolean.toString(this.checkBox.isChecked()));

FileOutputStream out = null;

try {

out = new FileOutputStream("settings.properties");

this.p.store(out, "");

out.close();

} catch (FileNotFoundException ex) {

Logger.getLogger(MainGUI.class.getName()).log(Level.SEVERE, null, ex);

} catch (IOException ex) {

Logger.getLogger(MainGUI.class.getName()).log(Level.SEVERE, null, ex);

}



this.nifty.setAlternateKeyForNextLoadXml("fade");

this.nifty.fromXml("Interface/GUI.xml", "start");

}

public void onSettings() {

this.nifty.setAlternateKeyForNextLoadXml("fade");

this.nifty.fromXml("Interface/options.xml", "start");

}

private static void setAppSettings() throws FileNotFoundException, IOException {

Properties p = new Properties();

FileInputStream in = new FileInputStream("settings.properties");

p.load(in);

in.close();



AppSettings newSettings = new AppSettings(true);

newSettings.setFrameRate(Integer.parseInt(p.getProperty("framerate")));

newSettings.setFullscreen(Boolean.parseBoolean(p.getProperty("fullscreen")));

newSettings.setResolution(Integer.parseInt(p.getProperty("reswidth")), Integer.parseInt(p.getProperty("resheight")));



fullscreen = Boolean.parseBoolean(p.getProperty("fullscreen"));

prop = p;



app.setSettings(newSettings);

app.setShowSettings(false);

}

public void chat() {

this.nifty.setAlternateKeyForNextLoadXml("fade");

this.nifty.fromXml("Interface/chat.xml", "start");



}

private void initAudio() {

/* gun shot sound is to be triggered by a mouse click. /



/
nature sound - keeps playing in a loop. */

this.assetManager.registerLocator("data/test.zip", ZipLocator.class.getName());

audio_nature = new AudioNode(audioRenderer, assetManager, "Loveshadow_-_Almost_Given_Up.ogg");

audio_nature.setLooping(true);

audio_nature.setPositional(true);

audio_nature.setLocalTranslation(Vector3f.ZERO.clone());

audio_nature.setVolume(3);

audioRenderer.playSource(audio_nature); // play continuously!

}

}[/java]

It can only jump.

So,anyone find what’s wrong?The problem is in simpleUpdate(),if I put a part of code in another method it works,but I cannot do without an update,the character it cannot stop.