its a Pacman game on claras world.

1 answer below »
Answered Same DayOct 12, 2021

Answer To: its a Pacman game on claras world.

Abr Writing answered on Oct 17 2021
142 Votes
Ghost.java
Ghost.java
/**
 * Ghost Class
 * 
 * Available functions (see Assignment document for explanations on what each function does):
 * treeFront, treeAbove, tr
eeBelow, treeToLeft, treeToRight,
 * getDirection, setDirection,
 * move,
 * isScared,
 * animate, animateDead, animateScared,
 * getClara, getGhostHealer,
 * isAboveMe, isBelowMe, isToMyLeft, isToMyRight,
 * makeClaraDead,
 * playGhostEatenSound,
 * isPacmanIntroStillPlaying,
 * wrapAroundWorld
 */
class Ghost extends Character
{
    //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...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here