Przeglądaj źródła

Clarified jumping code explaination for deprecated method.

mitm 7 lat temu
rodzic
commit
94ae3c8d57

+ 11 - 4
src/docs/asciidoc/jme3/beginner/hello_collision.adoc

@@ -375,7 +375,11 @@ Now you use the CollisionShape to create a `CharacterControl` that represents th
 
     player.setJumpSpeed(20);
     player.setFallSpeed(30);
-    // pre jME3.2
+
+    //Some methods used for setting gravity related variables were deprecated in
+    //the 3.2 version of the engine. Choose the method that matches your version
+    //of the engine.
+    // < jME3.2
     // player.setGravity(30f);
 
     // >= jME3.2
@@ -460,16 +464,19 @@ Remember that this class implements the `ActionListener` interface, so you can c
     } else if (binding.equals("Down")) {
       if (value) { down = true; } else { down = false; }
     } else if (binding.equals("Jump")) {
-      // pre jME3.2
+      //Some methods used for setting gravity related variables were deprecated in
+      //the 3.2 version of the engine. Choose the method that matches your version
+      //of the engine.
+      // < jME3.2
       //if (isPressed) { player.jump();}
 
       // >= jME3.2
-      player.jump(new Vector3f(0,20f,0));
+      if (isPressed) { player.jump(new Vector3f(0,20f,0));}
     }
   }
 ----
 
-The only movement that you do not have to implement yourself is the jumping action. The call `player.jump()` is a special method that handles a correct jumping motion for your `PhysicsCharacterNode`.
+The only movement that you do not have to implement yourself is the jumping action. The call `player.jump(new Vector3f(0,20f,0))` is a special method that handles a correct jumping motion for your `PhysicsCharacterNode`.
 
 For all other directions: Every time the user presses one of the WASD keys, you _keep track_ of the direction the user wants to go, by storing this info in four directional Booleans. No actual walking happens here yet. The update loop is what acts out the directional info stored in the booleans, and makes the player move, as shown in the next code snippet: