Hi, I can't seem to be able to wrap my head around this null pointer exception error. I am attempting to change the image of the flower based on whether mario is to the left or the right of the flower. Here is my code:The error occurs on line 3 but I am unsure why there is an error there.
Thanks for the assistance :)
public void turnFlower() { marioX = ((MarioG) getOneIntersectingObject(MarioG.class)).getXCoord(); if (marioX > getX()) { fLeft = false; } if (marioX < getX()) { fLeft = true; } }