I was able to get my actors to spawn on the left side and then move to the right side but I seem to have messed up somewhere and it does not work now. Here is the code. I would also like to know how I can put a limit on how many actors can spawn thanks.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class Pond_world extends World
{
public Pond_world()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1440, 810, 1);
prepare();
}
public void prepare()
{
User_fish user_fish = new User_fish();
addObject(user_fish,1152,313);
user_fish.setLocation(770,405);
}
private int spawnCounter = 0;
public void Right_count()
{
if (spawnCounter > 100)
{
spawnCounter = 0;
addObject(new AI_right(),0 , Greenfoot.getRandomNumber(getHeight()));
}
spawnCounter++;
}
}
