import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Enemy here. * * @author (Quinn Sapp) * @version (5 July 2013) */ public class Enemy extends Animal { /** * Act - do whatever the Enemy wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { move(3); turnAtEdge(); randomTurn(); tryToEatMainPlayer(); } public void turnAtEdge(){ if (atWorldEdge()){ turn(17); }//end if } public void randomTurn() { if (Greenfoot.getRandomNumber(100)<10) { turn(5); }//end if } public void tryToEatMainPlayer(){ if(canSee(MainPlayer.class)){ eat(MainPlayer.class); Greenfoot.playSound("au.wav"); } } }