is it possible to place a timer or a blockade for the maximum number of objects so that the game does not crash This is my code where this has to be implemented somewhere but I do not know how this works and greenfoot delay does not work either.
if (done1= false){
int x;
int y;
x=0;
y=0;
if (!getWorld().getObjects(Test.class).isEmpty()){ // if a Test object is in the world
Actor actor = (Actor)getWorld().getObjects(Test.class).get(0); // get reference to Test object
x = actor.getX();
y = actor.getY();
getWorld().addObject(new Rocket(),x,y);
}
done1=true;
}
Greenfoot.delay(60);
done1=false;