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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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 ); } } } |