I created a variable called maxtime and added a paramter to my constructor called maxtime, now it's asking me to "Modify the Barrel constructor so that the maxtime class variable is set to the maxtime parameter.
I tried to do it by setting maxtime = maxtime; but I'm stuck and I really have no idea what to do...
@danpost please help!
Here's my code:
import greenfoot.*;
public class Barrel extends Actor
{
int timer;
int maxtime;
public void act()
{
resetBarrel();
}
public Barrel(int maxtime)
{
timer = 0;
maxtime = 250;
maxtime = maxtime;
}
public void resetBarrel()
{
timer++;
if (timer > maxtime)
{
timer = 0;
setLocation(Greenfoot.getRandomNumber(650)+70, Greenfoot.getRandomNumber(450)+70);
}
}
}

