Java 2D Game Transition between Maps

Greetings. I am having trouble with teleporting between maps in my game. My issue is that even though the value of the currentMap is changed in the EventHandler class, it seems like it is not passed in other methods or class. I have already added a method that refreshes the data of the map. However I am getting an ArrayIndexOutofBound Error or NullPointerException Error.

It seems like it is reading the maxWorldCol and maxWorldRow of the original value of the currentMap, map 0.For instance:

When Map 0,
maxWorldCol: 29
maxWorldRow: 24

When map 1;
maxWorldCol: 40
maxWorldRow: 15

If I teleport from map 0 to map 1 and my location is at col 33 row 6 , it gives an arrayindexoutofbound
Was this page helpful?