1 Reply Latest reply: May 21, 2010 1:42 PM by 843851 RSS

    Java me map editing

    843851
      hello everybody, need advice an help. so I have a map matrix like this:
         { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0 },
                      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                      { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
                      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                      { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0 },
                      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                      { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
                      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
      for exemple, and when my sprite collides with 1 I need to change it to 0; how to do it ? I triesd to write like this:
       if(map[x][y]==1)
                  map[x][y] == 0
      and I get this
       Uncaught exception: java.lang.ArrayIndexOutOfBoundsException:   0
              at MazeCanvas.lightSabres(MazeCanvas.java:208)
              at MazeCanvas.input(MazeCanvas.java:136)
              at MazeCanvas.run(MazeCanvas.java:115)
              at java.lang.Thread.run(), bci=11
      javacall_lifecycle_state_changed() lifecycle: event is JAVACALL_LIFECYCLE_MIDLET_SHUTDOWNstatus is JAVACALL_OK