Solution
Abr Writing answered on
Oct 17 2021
Ghost.java
Ghost.java
**
 * Ghost Class
 *Â
 * Available functions (see Assignment document for explanations on what each function does):
 * treeFront, treeAbove, treeBelow, treeToLeft, treeToRight,
 * getDirection, setDirection,
 * move,
 * isScared,
 * animate, animateDead, animateScared,
 * getClara, getGhostHealer,
 * isAboveMe, isBelowMe, isToMyLeft, isToMyRight,
 * makeClaraDead,
 * playGhostEatenSound,
 * isPacmanIntroStillPlaying,
 * wrapAroundWorld
 *
class Ghost extends Characte
{
   Â
Add and initialise Ghost variables here
    public final String  UP = "up";   Â
    public final String  DOWN = "down";   Â
    public final String  LEFT = "left";   Â
    public final String  RIGHT = "right";       Â
    public final int moveby = 10;
    String[] directions = {UP, DOWN, LEFT, RIGHT};
    /**
     * Act method, runs on every frame
     *
    public void act()
    {
       Â
Make the Ghost do things here
        int random = Clara.getRandomNumber(4);
        String direction = directions[random];
        setDirection(direction);
        if (!treeFront()) {
            move(moveby);
            wrapAroundWorld();
        }
        animate();
        if (intersects(getClara())) {
            makeClaraDead();
        }
    }
   Â
   Â
Give the Ghost functions here
}
MyClara.java
MyClara.java
**
 * MyClara
 *Â
 * Available functions (see Assignment document for explanations on what each function does):
 * treeFront, ghostWallFront,
 * getDirection, setDirection,
 * move,
 * makeScared, isScared,
 * animate, animateDead,Â
 * onLeaf, removeLeaf,Â
 * onMushroom, removeMushroom,
 * allLeavesEaten,Â
 * isClaraDead,
 * playC...