In my game there is an Airplane that is suppose to drop a bomb when it gets to a certain point. I have tried to make it drop by using a getY() method but it wont work. Any help is welcome
public class Airplane extends Animal
{
public void act()
{
move();
if (getY() == 450)
{
getWorld().addObject(new bomb(), getX(), getY());
}
else if (atWorldEdge())
{
getWorld().removeObject(this);
}
else if (isTouching(Bullet.class))
{
getWorld().removeObject(this);
}
}
public class bomb extends Animal
{
private GreenfootImage image1;
public bomb()
{
image1 = new GreenfootImage("explosion.png");
}
public void act()
{
turnTowards(850,450);
move();
canSee();
}
public void move()
{
move(10);
}
public void canSee()
{
int number = 0;
if( isTouching(Wonder.class) )
{
setImage("explosion.png");
getWorld().removeObject(this);
}
}
}
