Hallo
At the moment I'm trying to creat my first game in Greenfoot. Actually it's
a Tower Defense game. Now I have created a method, which should move my enemies
around the map on a path. The problem is now that the more enemies I create, the slower my
program gets.
Does anyone out there know how I could fix taht problem?
Here is the code of the method which is responsible for the moving:
public void LaufeEntlangPfad1()
{
if(Zähler > Startverzögerung){
Position++;
}
int[] Koordinaten = Welt1.Pfadpunkte.get(Position);
int x = Koordinaten[0];
int y = Koordinaten[1];
setLocation(x,y);
Greenfoot.delay(Geschwindigkeit);
if(this.getX()==880)
{
getWorld().removeObject(this);
}
++Zähler;
}
