package example7_2.game.characters; import example7_2.game.GameCharacter; import example7_2.game.Game; import example7_2.game.MoveBehavior; import java.util.List; /** * This class represents a Bee. Bee extends GameCharacter, which contains a GameCharacterImage, and * thus it can paint itself in a window. * @author hornick */ public class Bee extends GameCharacter { /** * ctor - creates an instance of a Bee * @param the bee's name * @param imageFile image to display * @param soundFile sound to make */ public Bee(String name, String imageFile, String soundFile ) { super( name, imageFile, soundFile ); // make the GameCharacter ctor do the work... } /** * This method is called by the Game framework at the end of every move to give the GameCharacter * the chance to take some action. * @param list a list of GameCharacters in the same board cell as this GameCharacter */ @Override public void finishMove(List list) { for( GameCharacter neighbor: list ) { // iterate through each neighboring GameCharacter in the same cell int points = Game.tag(this, neighbor); // try to tag it in order to score points if(points==0) // if no points were obtained, buzz! makeSound(); } } public static Bee createBee(String name, String imageName, String soundFile, MoveBehavior.behaviorType moveBehaviorType) { Bee bee = new Bee(name, imageName, soundFile); bee.setMoveBehavior(moveBehaviorType); return bee; } }