to be added to Hero class:

    public Boolean isTouchingObstacle( Obstacle obst ) {
        Boolean answer;

        if ( obst.getRightEdge() < over ) {
            answer = false;
        }
        else if ( obst.getLeftEdge() > over + width ) {
            answer = false;
        }
        else if ( obst.getBottomEdge() < down ) {
            answer = false;
        }
        else if ( obst.getTopEdge() > down + height ) {
            answer = false;
        }
        else {
            answer = true;
        }

        return answer;
    } // end of isTouchingObstacle()

    Hero is RIGHT of Obstacle   (obst.getRightEdge() < over)

    Hero is LEFT of Obstacle   (obst.getLeftEdge() > over + width)

    Hero is BELOW Obstacle   (obst.getBottomEdge() < down)

    Hero is ABOVE Obstacle   (obst.getTopEdge() > down + height)

 

to be added to Obstacle class:

    public Integer getLeftEdge() {
        return whatever_the_left_edge_of_the_obstacle_is;
    } // end of getLeftEdge()

    public Integer getRightEdge() {
        return whatever_the_right_edge_of_the_obstacle_is;
    } // end of getRightEdge()

    public Integer getTopEdge() {
        // return ....
    } // end of getTopEdge()

    public Integer getBottomEdge() {
        // return ....
    } // end of getBottomEdge()

in MUPanel.java:

    for (Integer index = 0; index < obstacleArray.length; index++) {

        if ( hero.isTouchingObstacle( obstacleArray[index] ) ) {

            // do something with or to obstacleArray[index]
            // or
            // do something with or to hero

        } // end if

    } // end for