import greenfoot.*;
/**
* Write a description of class plane here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class plane extends Actor
{
/**
* Act - do whatever the plane wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
int a = 2;int isRight=0;
public static final int MAX_DELAY = 50;
int delay = 0;
public void act()
{
if (delay < MAX_DELAY) {
delay++;
if(this.isAtEdge()){
if(isRight/2==1){
a=4;
isRight=4;
}
else{
a=-4;
isRight=2;
}
}
return;
} else {
delay = 0;
}
Bomb Bomb = new Bomb();
Actor anchor = getOneObjectAtOffset(0,0,anchor.class);
World world = getWorld();
world.addObject(Bomb, getX(),getY());
move(a);
}
}
