This method finds what direction the player is facing based on the previous tile, and assigns it to the 'direction' string. private void checkPlayerDirection() { int currentX = myPlayer().getX(); int currentY = myPlayer().getY(); int deltaX = currentX - previousX; int deltaY = currentY - previousY; if (deltaX == 0 && deltaY == 0) { direction = previousDirection; // Use the previous direction when not moving } else if (de