Author Topic: Another issue with the "car" example: moving the p  (Read 3359 times)

Offline drounal

  • byte
  • *
  • Posts: 16
    • View Profile
Another issue with the "car" example: moving the p
« on: May 16, 2006, 09:09:41 pm »
Here is the problem of the day.

I hijacked the PlantManager to create cubes instead of plants. I already found a way to create them wherever I want, but now gotta move them. To do this, I need to select them.

My guess was to use the array that is created in the manager. My "moveCube" fonction is in the CarTest file and needs to modify the cubes in the CubeManager ("Cube" replaces "Plant"). I wrote the function below to select the cubes:

   public Cube CubeSelect(int numero) {
       return cubes[numero];
   }

but I can't use it in the CarTest file. When launching the game, it crashes with:
Exception in thread "main" java.lang.NullPointerException

my function looks a bit like this:

      public void moveCube(int num) {

      if (cubeleft) {
          cubeMan.CubeSelect(num).turnLeft();
      }
      if (cuberight) {
         cubeMan.CubeSelect(num).turnRight();
      }

where cubeleft and cuberight are event. the problem comes from the "cubeMan. ..."

Any idea ?

thx in advance

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Another issue with the "car" example: moving the p
« Reply #1 on: May 17, 2006, 05:25:12 am »
What movement are you trying to do!, I mean, moving all the cubes on a specific way or you need to move just some of them selecting by a criteria?
Nada por ahora

Offline drounal

  • byte
  • *
  • Posts: 16
    • View Profile
Another issue with the "car" example: moving the p
« Reply #2 on: May 17, 2006, 12:53:56 pm »
sorry for posting so many messages. besides, I found a way to work out this issue by myself.
thx again