Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Null Pointer Exception while using a 2D array?

0
Posted

Null Pointer Exception while using a 2D array?

0

You’re not checking to make sure that PlayerX -1 is inside your array. The null pointer exception makes me think you’re outside of it. This may not have anything to do with your problem, just readability for someone trying else trying to help you debug it, but in two dimensions, X is usually the horizontal axis(left or right) and Y is vertical ( up or down). Without the method name, I’d assume that this function moves one to the left.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123