Hello! I am attempting to put an array in a constructor, but when I attempt to define the array in the constructor, it always throws an error. Here is the code:
private void prepare()
{
Alligator alligator1 = new Alligator(Greenfoot.getRandomNumber(10),(Greenfoot.getRandomNumber(10)),(Greenfoot.getRandomNumber(10)));
addObject(alligator1,(Greenfoot.getRandomNumber(600)),Greenfoot.getRandomNumber(400));
}
I also have the code for the Actor in case the problem is there.
public class Alligator extends Actor
{
private int alligatorspeed;
private int alligatordirection;
private int alligatornumerofturns;
private int alligatormove;
public Alligator(int speed, int direction, int numerofturns, int move)
{
alligatorspeed = speed;
alligatordirection = direction;
alligatornumerofturns = numerofturns;
alligatormove = move;
}
}
Thanks!