I'm trying to make a world that constructs itself based on info written in a file. So it would read its width and height from file, assign them to variables, such as worldWidth and worldHeight, and then call the super, as in:
(This is a simplification; I took out all the parts that says throws IOException bla bla bla. )
But the problem is that Greenfoot does not seem to like variables in the super constructor (even if I just declare them at the beginning of the class), and it also doesn't like anything to come before the super constructor in the world constructor.
So is there any way to do this without actually going in and rewriting the World class in Greenfoot itself? I hope so, or else this project I'm working on will take much longer than I thought!
Also, I'm sure someone would ask why I would do it this way, why not just write the size of the world in myself. It's because I am trying to make a scrolling world builder that allows a person to place actors outside of the world and define the amount you can scroll the world.
1 2 3 4 5 | public MyWorld(String worldBuilderFile) { [...reads the file and assigns the variables worldWidth and worldHeight from it...] super (worldWidth, worldHeight, 1 ); } |