ive changed it sow the shell fly backwards and down :D
import greenfoot.*;
public class shell extends Animal
{
int gravity=1;
int vSpeed=4;
int i=0;
int d=200;
public void act()
{
eject();
delay();
}
public void eject()
{
if(!atWorldEdge())
{
turn(20);
setLocation(getX()+Greenfoot.getRandomNumber(8)-4,getY()-vSpeed);
}else{
setRotation(0);
}
timer(2);
}
public void timer(int time)
{
i++;
if(i==time)
vSpeed-=gravity;
if(i==time+1)
i=0;
}
public void delay()
{
if(d<0){getWorld().removeObject(this);d=200;}else{d-=1;}
}
} public int t;
public static boolean hit=false;
public int health=100;
public void act()
{
move(-0.5);
if(hit==true)
{
Actor Bullet;
Bullet = getOneIntersectingObject(Bullet.class);
World world;
world = getWorld();
world.removeObject(Bullet);
move(0.25);hit=false;
health-=Counter.getValue();
}
if(health<0)
{
Gold.add(5);
Counter.add(1);
getWorld().removeObject(this);
}
}
public static void mov(){hit=true;}