i think i want make my enemy / Asteroid accelerate when level increase
can you help me??
i tried some method to add the speed, such like i put "int m=5;" in asteroid
and then i add in the level method
Level lvl = new Level();
int m =5;
public boolean AtWorldEdge()
{
double w=getImage().getWidth(),h=getImage().getHeight();
return getX()==w || getY()==h || getX()==getWorld().getWidth()/-(w+2) || getY()==getWorld().getHeight()-(h+2);
}
/**
* Act - do whatever the rock wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
setLocation(getX(), getY()+6);
if (AtWorldEdge()) {
int ran = Greenfoot.getRandomNumber ( 500 );
getWorld().addObject( new Asteroid(), ran, 0);
getWorld().removeObject(this);
}
}public void addLevel(){
level++;
World myWorld = getWorld();
Asteroid as = new Asteroid();
as.m+=6;
}
