This site requires JavaScript, please enable it in your browser!
Greenfoot back
sultan.haider95@gmail.com
sultan.haider95@gmail.com wrote ...

2016/5/25

Pacman

The Ghosts must pose a threat to Clara, and as such, they must kill her if they catch her. In order to do so, you will need to check if they have collided with Clara. To do so, you will need to use the methods “intersects(Actor)”, “getClara()” and “makeClaraDead()” inside the Ghost class. Clara will need to use the method “isClaraDead()” to signal that the game is over. It is important for the Ghosts to be continually checking whether they have caught Clara, and it is important for Clara to check whether she is dead to prevent further movement and animation. Once you have Clara capable of checking whether she is dead, you will need to show the appropriate death image, with Clara’s method “animateDead()” and play the appropriate sound with the method “playClaraDieSound()”. It is important that the method “playClaraDieSound()” is only called once. It is also important that you stop processing keyboard input from the player at the point of Clara’s death. Note that Clara’s “animateDead()” method only contains one frame, and so it is acceptable to run it every time the act method is called after Clara is dead. Part 10 – Eating Mushrooms and Making Ghosts Eatable Clara will need to able to eat mushrooms and get her super power. In order to do so, you will need to use methods “onMushroom()” and “removeMushroom()”. Then you will need to appropriately place the method “makeScared()” when Clara has eaten a mushroom. The Ghosts will need to check whether or not they should be scared, and switch to the appropriate animation when they are. You will need to use the methods “isScared()” and “animateScared()”. Note that the “animateScared()” method will need to be run every so many times that the act method is called, just like the “animate()” method. It is acceptable, but not compulsory to increase the Ghosts’ speed when they are scared, but they should be slower than Clara. You will then need to ensure that the Ghosts don’t kill Clara when they collide with her if they are scared, and instead, die themselves. It will be up to you to create your own variable that checks if the Ghosts are dead. You will need the “animateDead()”and “playGhostEatenSound()” methods. It is important to note that the Ghosts do not stop moving when they are dead, and that the Ghost’s “animateDead()” method will need to be run every so many times that the act method is called, just like the “animate()” method. It is also important that the Ghosts should not harm Clara when they are scared or when they are dead. Also note that the game will automatically decide how long the Ghosts should be scared for. Part 11 - Ghosts and Regeneration When a Ghost is dead, it will need to return to the Ghost Healer, which is the red object near where the Ghosts start. It will be up to you to decide how they should logically make their way back to the Ghost Healer object. You will need to use the “isAboveMe(Actor)”, “isBelowMe(Actor)”, “isToMyLeft(Actor)”, “isToMyRight(Actor)” and “getGhostHealer()” methods to make this happen. Note that the “isAboveMe(Actor)”, “isBelowMe(Actor)”, “isToMyLeft(Actor)”, “isToMyRight(Actor)” methods need to be sent an Actor, and that only two are available to you, through the “getGhostHealer()” and “getClara()” methods. You will need to send those ‘get’ methods to the ‘is’ methods in order to get an appropriate answer. An example of how to use the above functions is below: “isAboveMe( getGhostHealer() );” If the above example returns true, then the Ghost Healer is above the Ghost. When the Ghost returns to the Ghost Healer object, it will need to make itself no longer dead. You will need the “intersects(Actor)” and “getGhostHealer()” methods to make this work. How do you do this PART? Stuck at these three
You need to login to post a reply.