public void checkCollisions(int nextX, int nextY, RPG rpg, boolean setDir) {
        if(setDir) {
            //set the direction based on x and y change (x takes precedence)
            if(nextX - this.boundingBox.x > 0) {
                dir = "right";
            }
            else if(nextX - this.boundingBox.x < 0) {
                dir = "left";
            }
            else if(nextY - this.boundingBox.y > 0) {
                dir = "down";
            }
            else if(nextY - this.boundingBox.y < 0) {
                dir = "up";
            }
        }
        //apply knockback
        if(knockback[0] > 0) {
            nextX += knockback[0]--;
        }
        else if(knockback[0] < 0) {
            nextX += knockback[0]++;
        }
        if(knockback[1] > 0) {
            nextY += knockback[1]--;
        }
        else if(knockback[1] < 0) {
            nextY += knockback[1]++;
        }
        
        //check if there are any collisions that will happen, and if so, reset the x or y
        int currentX = boundingBox.x;
        int currentY = boundingBox.y;
        boundingBox.setLocation(nextX, currentY);
        nextX = collide(nextX, currentX, rpg);
        
        boundingBox.setLocation(currentX, nextY);
        nextY = collide(nextY, currentY, rpg);
        
        //move the player's bounding box
        boundingBox.setLocation(nextX, nextY);
        
        //move the player
        x = boundingBox.x - boundingBoxOffsetX;
        y = boundingBox.y - boundingBoxOffsetY;
    }