Ive gotten this far..
They move down just not back up.
Thank you xx
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.lang.Object;
/**
* Write a description of class Minnow here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Minnow extends Animal
{
private GreenfootImage image3;
private GreenfootImage image4;
private int sharksEaten;
/**
* Act - do whatever the Minnow wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public Minnow()
{
image3 = new GreenfootImage("Minnow1.png");
image4 = new GreenfootImage("Minnow2.png");
}
public void act()
{
changeImage();
movingMinnow();// Add your action code here.
eatShark();
}
public void changeImage()
{
if (Greenfoot.isKeyDown("n"))
{
setImage(image4);
}
else
{
setImage(image3);
}
}
public void movingMinnow()
{
setLocation(getX(),getY()+5);
if (atWorldEdge())
{
setLocation(getX(),getY()-5);
setRotation(180);
}
}
public void eatShark()
{
if (canSee(Shark.class))
{
eat(Shark.class);
sharksEaten = sharksEaten +1;
}
if (canSee(Shark2.class))
{
eat(Shark2.class);
sharksEaten = sharksEaten +1;
}
if (sharksEaten == 2)
{
Greenfoot.stop();
}
}
}
