Using the JME3 Tests template, jme3test/games/CubeField.java is a sample game that allows the player to move right and left to avoid oncoming cubes. Line 73 of the original has:
private float speed, coreTime,coreTime2;
changed to
private float gameSpeed, coreTime, coreTime2;
because the jMonkeyPlatform complained that this variable masked speed in superclass Application. The speed variable was renamed in 6 other lines of the sample.
In function gameReset(), line 115 of the original has:
colorInt = 0;
changed to
colorInt = 8;
original lines 134-136
coreTime = 20.0f;
coreTime2 = 10.0f;
changed to
coreTime = timer.getTimeInSeconds();
coreTime2 = coreTime;
added line:
solidBox = true;
all to make variables reset properly between games.
In function gameLogic(), line 266 of the original has:
cubeField.remove(0);
changed to
Geometry g;
g = cubeField.get(0);
g.removeFromParent();
cubeField.remove(g);
to properly remove cubes from the playing field.
In function onAnalog(), after line 314, added:
gameReset();
to reset variables between games.
Product Version: jMonkeyEngine SDK 3.0RC2 Java: 1.7.0_01; Java HotSpot(TM) Server VM 21.1-b02 System: Windows 7 version 6.1 running on x86; MS949; ko_KR (jmonkeyplatform)Proposed new version of CubeField.java: