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
1 Reply
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @codi! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?