This site requires JavaScript, please enable it in your browser!
Greenfoot back
There are no scenarios tagged "match-game"
tonym840
tonym840 wrote ...

2018/2/28

Changing World Size

tonym840 tonym840

2018/2/28

#
New to Coding. I have a world, made a subclass called "Lawn" and I need to change the size of the lawn to 10x10 What I have read from the API says all I have to do is go to my "Lawn" subclass and in the constructor section put " super(int width, int height); " . I have tried that a couple times and it keeps returning "illigal start of type" so then I changed it to: "public World() { super(10, 10); } " and now it returns "invalid method declaration, return type required. When I put "void" for return type (the only one I have learned), it says "call to super must be first statement in constructor". This is going in circles. Any help would be appreciated. Thanks
danpost danpost

2018/2/28

#
In your Lawn class, the constructor would begin with:
1
public Lawn()
and the constructor calls takes a minimum of 3 parameters:. Its either 'super(int, int, int)' or 'super(int, int, int, boolean);'. Refer to the World class API documentation on its constructors.
You need to login to post a reply.