Demolition Man

Hey guys, I want to create something similar to a Bomberman.



Implemented features

You can get a wall sliding effect pretty easily if you use the simplephysics package (which apparently is still not a part of the jME 2.x trunk).  See the following thread for related info.  The later posts will most likely be more relevant to you than the earlier ones.  I think that the link to the package is in there somewhere.  If not, let me know here and I'll track it down.



http://www.jmonkeyengine.com/forum/index.php?topic=5073.0

ok, now the game is using physics, this is really cool.

But i have one problem, my player can't stay on feet for more than some seconds, so i try changing the model with a little box, right, but the problem is still there, when i collide to fast with a wall the box rotate upside down, and my forward button don't work properly.

some idea? i'm thinking in a procedure that controls the balance of the player, for do that it have to check the rotation of the object and correct it.

i solve the problem of the drunken guy adding this line

 
player.setCenterOfMass( new Vector3f( 0, -.5f, 0 ) );



hi again, i’m working hard to bring up a respectable 3d model for the player, i found some troubles with the previous model, i think that not any model from the blenders can be converted in MD5, so i try with a new one. 3d5fellow.



In the other hand i have a big problem, the new implementation of the bomb, now the bomb work in a separate thread and SOMETIMES fails removing the wall nodes from rootNode.




public class Bomba extends Node implements Runnable {

...
...
...
//Detonate metod
//c is a Spatial of the wall node that have to be removed

            final PhysicsNode cc = (PhysicsNode) c;
            GameTaskQueueManager.getManager().render(
                  new Callable<Object>() {
                     public Object call() throws Exception {
                        cc.delete();
                        return null;
                     }
                  });

...
...

public void run() {
      while (countdown > 0) {
         try {
            Thread.sleep(1000);
            countdown--;
            threadMessage("s" + countdown);

         } catch (InterruptedException e) {
            e.printStackTrace();
         } catch (Throwable e) {
            e.printStackTrace();
         }
      }
      detonar();
      contador.detonarBomba();

   }



GRAVE: Exception in game loop
java.lang.IndexOutOfBoundsException: Index: 238, Size: 238
   at java.util.ArrayList.RangeCheck(ArrayList.java:547)
   at java.util.ArrayList.get(ArrayList.java:322)
   at java.util.Collections$SynchronizedList.get(Collections.java:1816)
   at com.jme.scene.Node.updateWorldBound(Node.java:570)
   at com.jme.scene.Spatial.updateGeometricState(Spatial.java:520)
   at com.jmex.physics.util.SimplePhysicsGame.update(SimplePhysicsGame.java:152)
   at com.jme.app.BaseGame.start(BaseGame.java:84)
   at jDemolitionMan.JDM.main(JDM.java:75)



the full code is available in svn repository

i have found a solution to the problem of removing nodes from a new thread.



in the simplePhysicsGame class add a new instance variable, the queue.


Queue<PhysicsNode> trashColector;



instance it with a concurrentLinkedQueue in simpleInitGame


trashColector = new ConcurrentLinkedQueue<PhysicsNode>();
}



in the thread add the node to the queue


trashColector.add( " THE PHYSICS NODE HERE " );



and finally in the simpleupdate, remove all the elements in the queue and destroy them all!!


if (!trashColector.isEmpty())
      {
         trashColector.remove().delete();
      }



is ok?

Ok guys, tomorrow is the D day, we make the best as we can.

We make this as project for Program Technologies, a signature of my ph. 



From this moment the code if property of the community. Enjoy it.

Wait–your project is done? Why not post some screenshots?